Exemplo n.º 1
0
 public ManagerEfficiencyRollbackLevel GetManagerEfficiencyRollbackLevel(int managerId)
 {
     if (ManagerEfficiencyRollbackLevels.ContainsKey(managerId))
     {
         return(ManagerEfficiencyRollbackLevels[managerId]);
     }
     else
     {
         ManagerEfficiencyRollbackLevel level = new ManagerEfficiencyRollbackLevel(managerId);
         ManagerEfficiencyRollbackLevels.Add(managerId, level);
         return(level);
     }
 }
Exemplo n.º 2
0
        public override void LoadSave(object obj)
        {
            ManagerServiceSave save = obj as ManagerServiceSave;

            if (save != null)
            {
                if (save.managers != null)
                {
                    Managers.Clear();
                    foreach (var kvp in save.managers)
                    {
                        var           managerData   = Services.ResourceService.Managers.GetManagerData(kvp.Key);
                        GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(kvp.Key);
                        ManagerInfo   manager       = new ManagerInfo(managerData, generatorData, kvp.Value);
                        Managers.Add(manager.Id, manager);
                    }

                    save.Validate();
                    ManagerEfficiencyRollbackLevels.Clear();
                    foreach (var me in save.efficiencyRollbackImproveLevels)
                    {
                        ManagerEfficiencyRollbackLevels.Add(me.Key, new ManagerEfficiencyRollbackLevel(me.Value));
                    }

                    IsLoaded = true;
                }
                else
                {
                    LoadDefaults();
                }
            }
            else
            {
                LoadDefaults();
            }
        }