public ViewModel GetWorkspace(IZetboxContext ctx) { if (Managers.ContainsKey(ctx)) { return(Managers[ctx] as ViewModel); } else { return(null); } }
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)); } }
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; } }
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); } }
public ManagerData GetManagerData(int id) { return(Managers.ContainsKey(id) ? Managers[id] : null); }