Enhance school creation and staffing management with native language support
- Updated protocol documentation to include `nativeLanguages` in `nameSets` and added `nativeLanguage` to school creation options. - Enhanced the UI for school creation to allow selection of native languages, improving user experience. - Revised API interfaces to accommodate new native language features, ensuring proper data handling. - Improved localization strings to support new native language functionalities in both English and Russian. - Updated tests to validate the new native language features and ensure robust functionality in staffing scenarios.
This commit is contained in:
@@ -328,10 +328,23 @@ internal sealed class GameLoopService(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!catalog.NameSets.TryGetValue(nameSetId, out var names))
|
||||
{
|
||||
command.Result.TrySetResult(new SchoolCreationOutcome(null, SchoolCreationError.UnknownNameSet));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(command.NativeLanguage) && !NativeLanguages.Allows(names, command.NativeLanguage))
|
||||
{
|
||||
command.Result.TrySetResult(new SchoolCreationOutcome(null, SchoolCreationError.UnknownNativeLanguage));
|
||||
return;
|
||||
}
|
||||
|
||||
var id = _nextId++;
|
||||
store.WriteNextId(_nextId);
|
||||
var nativeLanguage = NativeLanguages.Pick(names, id, command.NativeLanguage, rollIfOmitted: true);
|
||||
|
||||
var worker = SpawnWorker(id, normalized, command.StartDate, running: true, ClockSpeed.DefaultIndex, isNew: true, packIds, command.Map, nameSetId);
|
||||
var worker = SpawnWorker(id, normalized, command.StartDate, running: true, ClockSpeed.DefaultIndex, isNew: true, packIds, command.Map, nameSetId, nativeLanguage);
|
||||
Track(worker);
|
||||
worker.Start();
|
||||
|
||||
@@ -499,6 +512,7 @@ internal sealed class GameLoopService(
|
||||
save.ModIds,
|
||||
save.Map,
|
||||
save.NameSetId,
|
||||
save.NativeLanguage,
|
||||
save.Presence);
|
||||
worker.Start();
|
||||
|
||||
@@ -547,6 +561,7 @@ internal sealed class GameLoopService(
|
||||
IReadOnlyList<string>? modIds,
|
||||
MapLayout? map,
|
||||
string? nameSetId,
|
||||
string? nativeLanguage,
|
||||
IReadOnlyList<PresenceSnapshot>? presence = null) =>
|
||||
new(
|
||||
id,
|
||||
@@ -558,6 +573,7 @@ internal sealed class GameLoopService(
|
||||
modIds,
|
||||
map,
|
||||
nameSetId,
|
||||
nativeLanguage,
|
||||
presence,
|
||||
_options,
|
||||
clients,
|
||||
|
||||
Reference in New Issue
Block a user