Beispiel #1
0
        public void Refresh(bool partialRefresh = false)
        {
            List <ComponentDesign> labDesigns = _factionEntity.GetDataBlob <FactionInfoDB>().ComponentDesigns.Values.Where(item => item.HasAttribute <ResearchPointsAtbDB>()).ToList();

            _allLabs = new Dictionary <Guid, int>();

            //ResearchableTechs = new ObservableCollection<TechSD>(_factionTech.ResearchableTechs.Keys);
            ResearchableTechs = new DictionaryVM <TechSD, string>(DisplayMode.Value);
            foreach (var tech in _factionTech.GetResearchableTechs())
            {
                ResearchableTechs.Add(tech.tech, tech.tech.Name);
            }

            /*
             * foreach (var kvp in _colonyEntity.GetDataBlob<ComponentInstancesDB>().ComponentsByDesign)
             * {
             *  if (labDesigns.Contains(kvp.Key))
             *      _allLabs.Add(kvp.Key.ID, kvp.Value.Count);
             * }*/
            AllLabs = AllLabs;

            _freeLabs = 0;
            foreach (var kvp in AllLabs)
            {
                _freeLabs += kvp.Value;
            }
            foreach (var scientist in Scientists)
            {
                _freeLabs -= scientist.ScientistAssignedLabs;
            }
            FreeLabs = _freeLabs;
        }
Beispiel #2
0
        public ColonyResearchVM(StaticDataStore staticData, Entity colonyEntity)
        {
            //_factionEntity;// = colonyEntity.GetDataBlob<OwnedDB>().OwnedByFaction;
            colonyEntity.Manager.FindEntityByGuid(colonyEntity.FactionOwner, out _factionEntity);
            _colonyEntity = colonyEntity;
            _factionTech  = _factionEntity.GetDataBlob <FactionTechDB>();
            Scientists    = new List <ScientistControlVM>();

            var researchables = _factionTech.GetResearchableTechs();

            if (researchables.Count > 0)
            {
                //ResearchableTechs = new ObservableCollection<TechSD>(_factionTech.ResearchableTechs.Keys);
                ResearchableTechs = new DictionaryVM <TechSD, string>(DisplayMode.Value);
                foreach (var tech in researchables)
                {
                    ResearchableTechs.Add(tech.tech, tech.tech.Name);
                }
                SelectedTechIndex = 0;
            }

            foreach (Scientist scientist in _colonyEntity.GetDataBlob <TeamsHousedDB>().TeamsByType[TeamTypes.Science])
            {
                Scientists.Add(new ScientistControlVM(staticData, _factionTech, scientist));
            }
            SelectedScientist = Scientists[0];
            Refresh();
        }