Exemplo n.º 1
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>();
            if (_factionTech.ResearchableTechs.Count > 0)
            {
                //ResearchableTechs = new ObservableCollection<TechSD>(_factionTech.ResearchableTechs.Keys);
                ResearchableTechs = new DictionaryVM <TechSD, string>(DisplayMode.Value);
                foreach (var tech in _factionTech.ResearchableTechs.Keys)
                {
                    ResearchableTechs.Add(tech, tech.Name);
                }
                SelectedTechIndex = 0;
            }

            foreach (var scientist in _colonyEntity.GetDataBlob <ColonyInfoDB>().Scientists)
            {
                Scientists.Add(new ScientistControlVM(staticData, _factionTech, scientist));
            }
            SelectedScientist = Scientists[0];
            Refresh();
        }
Exemplo n.º 2
0
        public void Refresh(bool partialRefresh = false)
        {
            List <Entity> labDesigns = _factionEntity.GetDataBlob <FactionInfoDB>().ComponentDesigns.Values.Where(item => item.HasDataBlob <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.ResearchableTechs.Keys)
            {
                ResearchableTechs.Add(tech, tech.Name);
            }

            /*
             * foreach (var kvp in _colonyEntity.GetDataBlob<ComponentInstancesDB>().ComponentsByDesign)
             * {
             *  if (labDesigns.Contains(kvp.Key))
             *      _allLabs.Add(kvp.Key.Guid, 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;
        }
        /// <summary>
        /// Constructor for filled
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="abilitySD"></param>
        /// <param name="parentList"></param>
        /// <param name="staticData"></param>
        public ComponentAbilityTemplateVM(ComponentTemplateParentVM parent, ComponentTemplateAbilitySD abilitySD, ObservableCollection <ComponentAbilityTemplateVM> parentList, StaticDataStore staticData) : this(parent, parentList, staticData)
        {
            Name        = abilitySD.Name;
            Description = abilitySD.Description;
            SelectedGuiHint.SelectedIndex = (int)abilitySD.GuiHint;
            if (abilitySD.AbilityDataBlobType != null)
            {
                AbilityDataBlobType = abilitySD.AbilityDataBlobType;
            }
            AbilityFormula = abilitySD.AbilityFormula;
            MinFormula     = abilitySD.MinFormula;
            MaxFormula     = abilitySD.MaxFormula;
            StepFormula    = abilitySD.StepFormula;
            //GuidDictionary = abilitySD.GuidDictionary;
            DictionaryVM <Guid, string> techSelected = new DictionaryVM <Guid, string>();

            if (abilitySD.GuiHint == GuiHint.GuiTechSelectionList)
            {
                foreach (var item in abilitySD.GuidDictionary)
                {
                    techSelected.Add(Guid.Parse(item.Key.ToString()), _staticData.Techs[Guid.Parse(item.Key.ToString())].Name);
                }
                GuidDict = new TechListVM(techSelected, _staticData);
            }
        }
Exemplo n.º 4
0
 public TechListVM(DictionaryVM <Guid, string> selectedItems, StaticDataStore staticData) : this(staticData)
 {
     SelectedItems = selectedItems;
     foreach (var item in SelectedItems)
     {
         PossibleItems.Remove(item.Key);
     }
 }
Exemplo n.º 5
0
 public MineralFormulaVM(ComponentTemplateParentVM parent, StaticDataStore staticDataStore) : base(parent)
 {
     _dataStore = staticDataStore;
     Minerals   = new DictionaryVM <Guid, string>(DisplayMode.Value);
     foreach (var item in staticDataStore.Minerals.Values)
     {
         Minerals.Add(item.ID, item.Name);
     }
 }
Exemplo n.º 6
0
 public TechListVM(StaticDataStore staticData)
 {
     SelectedItems = new DictionaryVM <Guid, string>();
     PossibleItems = new DictionaryVM <Guid, string>();
     foreach (var item in staticData.Techs.Values)
     {
         PossibleItems.Add(item.ID, item.Name);
     }
 }
Exemplo n.º 7
0
 public RefineryAbilityVM(StaticDataStore staticData, Entity colonyEntity) : base(staticData, colonyEntity)
 {
     ItemDictionary = new DictionaryVM <Guid, string>(DisplayMode.Value);
     foreach (var kvp in _staticData_.ProcessedMaterials)
     {
         ItemDictionary.Add(kvp.Key, kvp.Value.Name);
     }
     //NewJobSelectedItem = ItemDictionary[ItemDictionary.ElementAt(0).Key];
     NewJobSelectedIndex = 0;
     NewJobBatchCount    = 1;
     NewJobRepeat        = false;
 }
Exemplo n.º 8
0
 public ConstructionAbilityVM(StaticDataStore staticData, Entity colonyEntity) : base(staticData, colonyEntity)
 {
     ItemDictionary = new DictionaryVM <Guid, string>(DisplayMode.Value);
     foreach (var kvp in _factionInfo.ComponentDesigns)
     {
         ItemDictionary.Add(kvp.Key, kvp.Value.Name);
     }
     //NewJobSelectedItem = ItemDictionary.SelectedKey;
     NewJobSelectedIndex = 0;
     NewJobBatchCount    = 1;
     NewJobRepeat        = false;
 }
Exemplo n.º 9
0
        public FormulaEditorVM(ComponentTemplateParentVM parent, StaticDataStore staticData)
        {
            _parent = parent;

            TechList = new DictionaryVM <Guid, string>();
            foreach (var item in staticData.Techs.Values)
            {
                TechList.Add(item.ID, item.Name);
            }
            TechList.SelectionChangedEvent += TechList_SelectionChangedEvent;

            ParameterButtons = new List <ButtonInfo>();
            ParameterButtons.Add(new ButtonInfo("[Size]", "Links to the Size formula field", this));
            ParameterButtons.Add(new ButtonInfo("[Crew]", "Links to the Crew requred formula field", this));
            ParameterButtons.Add(new ButtonInfo("[HTK]", "Links to the Hit To Kill formula field", this));
            ParameterButtons.Add(new ButtonInfo("[ResearchCost]", "Links to the Research cost formula field", this));
            ParameterButtons.Add(new ButtonInfo("[MineralCost]", "Links to the Mineral cost formula field", this));
            ParameterButtons.Add(new ButtonInfo("[CreditCost]", "Links to the Credit Cost formula field", this));
            ParameterButtons.Add(new ButtonInfo("[GuidDict]", "A special parameter for a key value pair collection, used in ability formula fields", this));

            FunctionButtons = new List <ButtonInfo>();
        }