Example #1
0
 public ViewModel GetWorkspace(IZetboxContext ctx)
 {
     if (Managers.ContainsKey(ctx))
     {
         return(Managers[ctx] as ViewModel);
     }
     else
     {
         return(null);
     }
 }
Example #2
0
        public bool CanShowModel(ViewModel mdl)
        {
            if (mdl == null)
            {
                throw new ArgumentNullException("mdl");
            }

            var dom = mdl as DataObjectViewModel;

            if (dom == null)
            {
                return(true);
            }
            else
            {
                return(Managers.ContainsKey(dom.Object.Context));
            }
        }
Example #3
0
        public void Setup(object obj)
        {
            efficiencyUpdateTimer.Setup(1.0f, (delta) => {
                if (IsLoaded && Services.ResourceService.IsLoaded && Services.GameModeService.IsGame)
                {
                    UpdateManagersEfficiency(delta);
                }
            });

            if (!isInitialized)
            {
                GameEvents.ManagerDataReplacedSubject.Subscribe(data => {
                    if (Managers.ContainsKey(data.Id))
                    {
                        Managers[data.Id].UpdateData(data);
                    }
                }).AddTo(gameObject);
                isInitialized = true;
            }
        }
Example #4
0
 public ManagerInfo GetManager(int id)
 {
     if (Managers.ContainsKey(id))
     {
         return(Managers[id]);
     }
     else
     {
         //var data = GameData.instance.managers.FirstOrDefault(m => m.Id == id);
         var           data          = Services.ResourceService.Managers.GetManagerData(id);
         GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(id);
         if (data == null)
         {
             throw new UnityException($"manager data {id} not founded");
         }
         ManagerInfo manager = new ManagerInfo(data, generatorData);
         Managers.Add(manager.Id, manager);
         return(manager);
     }
 }
Example #5
0
 public ManagerData GetManagerData(int id)
 {
     return(Managers.ContainsKey(id) ? Managers[id] : null);
 }