public override void LoadSave(object obj) { AuditorServiceSave save = obj as AuditorServiceSave; if (save != null) { Auditors.Clear(); save.Validate(); foreach (var kvp in save.auditors) { Dictionary <string, Auditor> generatorAuditors = new Dictionary <string, Auditor>(); foreach (var kvp2 in kvp.Value) { generatorAuditors.Add(kvp2.Key, new Auditor(kvp2.Value)); } Auditors.Add(kvp.Key, generatorAuditors); } SpeedMults.Clear(); SpeedMults.CopyFrom(save.speedMults); IsLoaded = true; } else { LoadDefaults(); } }
public override void LoadSave(object obj) { TempMechanicServiceSave save = obj as TempMechanicServiceSave; if (save != null) { TempMechanics.Clear(); save.Validate(); foreach (var kvp in save.tempMechanics) { Dictionary <string, TempMechanicInfo> generatorMechanics = new Dictionary <string, TempMechanicInfo>(); foreach (var kvp2 in kvp.Value) { generatorMechanics.Add(kvp2.Key, new TempMechanicInfo(kvp2.Value)); } TempMechanics.Add(kvp.Key, generatorMechanics); } SpeedMults.Clear(); SpeedMults.CopyFrom(save.speedMults); IsLoaded = true; } else { LoadDefaults(); } }
public int GetSpeedMult(int generatorId) { if (!SpeedMults.ContainsKey(generatorId)) { SpeedMults.Add(generatorId, 1); } return(SpeedMults[generatorId]); }
private void MultSpeed(int generatorId, int val) { if (!SpeedMults.ContainsKey(generatorId)) { SpeedMults.Add(generatorId, 1); } SpeedMults[generatorId] *= val; UniRx.MessageBroker.Default.Publish <SpeedMultChangedArgs>(new SpeedMultChangedArgs { SpeedModifier = this, Name = "secretary", GeneratorId = generatorId }); }
public override object GetSave() { Dictionary <int, Dictionary <string, AuditorSave> > auditorSaves = new Dictionary <int, Dictionary <string, AuditorSave> >(); foreach (var kvp in Auditors) { if (kvp.Value.Count > 0) { Dictionary <string, AuditorSave> generatorAuditors = new Dictionary <string, AuditorSave>(); foreach (var kvp2 in kvp.Value) { AuditorSave saveObj = kvp2.Value.GetSave(); generatorAuditors.Add(saveObj.id, saveObj); } auditorSaves.Add(kvp.Key, generatorAuditors); } } return(new AuditorServiceSave { auditors = auditorSaves, speedMults = SpeedMults.ToDictionary(kvp => kvp.Key, kvp => kvp.Value) }); }
public override object GetSave() { Dictionary <int, Dictionary <string, TempMechanicInfoSave> > tempMechanicInfoSaves = new Dictionary <int, Dictionary <string, TempMechanicInfoSave> >(); foreach (var kvp in TempMechanics) { if (kvp.Value.Count > 0) { Dictionary <string, TempMechanicInfoSave> generatorMechanics = new Dictionary <string, TempMechanicInfoSave>(); foreach (var kvp2 in kvp.Value) { TempMechanicInfoSave saveObj = kvp2.Value.GetSave(); generatorMechanics.Add(saveObj.id, saveObj); } tempMechanicInfoSaves.Add(kvp.Key, generatorMechanics); } } return(new TempMechanicServiceSave { tempMechanics = tempMechanicInfoSaves, speedMults = SpeedMults.ToDictionary(kvp => kvp.Key, kvp => kvp.Value) }); }
public override void LoadDefaults() { Auditors.Clear(); SpeedMults.Clear(); IsLoaded = true; }
public override void LoadDefaults() { TempMechanics.Clear(); SpeedMults.Clear(); IsLoaded = true; }