Пример #1
0
        public void UpdateTroopTab()
        {
            var acc  = getSelectedAcc();
            var vill = getSelectedVillage(acc);

            if (acc.AccInfo.Tribe != null)
            {
                if (vill.Troops.TroopToTrain != null)
                {
                    labelTroopsToTrain.Text = $"Selected: {VillageHelper.EnumStrToString(vill.Troops.TroopToTrain.ToString() ?? "")}";
                }
                else
                {
                    labelTroopsToTrain.Text = "Selected:";
                }

                comboBoxTroopsToTrain.Items.Clear();
                int troopsEnum = ((int)acc.AccInfo.Tribe - 1) * 10;
                for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
                {
                    Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
                    comboBoxTroopsToTrain.Items.Add(VillageHelper.EnumStrToString(troop.ToString()));
                }
                if (comboBoxTroopsToTrain.Items.Count > 0)
                {
                    comboBoxTroopsToTrain.SelectedIndex = 0;
                }
            }
            else
            {
                labelTroopsToTrain.Text = "Selected:";
                comboBoxTroopsToTrain.Items.Clear();
            }
        }
Пример #2
0
 private string[] GetPossibleTroops(Classificator.BuildingEnum building)
 {
     List<string> ret = new List<string>();
     ret.Add("None");
     var acc = getSelectedAcc();
     if (acc.Villages.Count == 0) return ret.ToArray(); //Acc has now been initialised
     int troopsEnum = ((int)acc.AccInfo.Tribe - 1) * 10;
     for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
     {
         Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
         if (TroopsHelper.GetTroopBuilding(troop, false) == building)
         {
             ret.Add(VillageHelper.EnumStrToString(troop.ToString()));
         }
     }
     return ret.ToArray();
 }
Пример #3
0
        private string[] GetPossibleTroops(Classificator.BuildingEnum building)
        {
            List <string> ret = new List <string>();

            ret.Add("None");
            var acc = GetSelectedAcc();

            if (acc.Villages.Count == 0)
            {
                return(ret.ToArray());                         //Acc has now been initialised
            }
            var tribes = new List <Classificator.TribeEnum>(5);

            if (NYS.Checked)
            {
                tribes.Add(Classificator.TribeEnum.Egyptians);
                tribes.Add(Classificator.TribeEnum.Gauls);
                tribes.Add(Classificator.TribeEnum.Huns);
                tribes.Add(Classificator.TribeEnum.Romans);
                tribes.Add(Classificator.TribeEnum.Teutons);
            }
            else
            {
                tribes.Add(acc.AccInfo.Tribe ?? Classificator.TribeEnum.Any);
            }

            foreach (var tribe in tribes)
            {
                int troopsEnum = ((int)tribe - 1) * 10;
                for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
                {
                    Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
                    if (TroopsHelper.GetTroopBuilding(troop, false) == building)
                    {
                        ret.Add(VillageHelper.EnumStrToString(troop.ToString()));
                    }
                }
            }
            return(ret.ToArray());
        }
Пример #4
0
        public void UpdateUc()
        {
            var acc  = GetSelectedAcc();
            var vill = GetSelectedVillage(acc);

            if (acc.AccInfo.Tribe != null)
            {
                if (vill.Troops.TroopToTrain != null)
                {
                    labelTroopsToTrain.Text = $"Selected: {VillageHelper.EnumStrToString(vill.Troops.TroopToTrain.ToString() ?? "")}";
                }
                else
                {
                    labelTroopsToTrain.Text = "Selected:";
                }

                comboBoxTroopsToTrain.Items.Clear();
                int troopsEnum = ((int)acc.AccInfo.Tribe - 1) * 10;
                for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
                {
                    Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
                    comboBoxTroopsToTrain.Items.Add(VillageHelper.EnumStrToString(troop.ToString()));
                }
                if (comboBoxTroopsToTrain.Items.Count > 0)
                {
                    comboBoxTroopsToTrain.SelectedIndex = 0;
                }
            }
            else
            {
                labelTroopsToTrain.Text = "Selected:";
                comboBoxTroopsToTrain.Items.Clear();
            }

            // Village troops info
            string infoText = "-- Troops already researched:\n";

            infoText += string.Join(", ", vill.Troops.Researched) + "\n";
            infoText += "-- Troops to be researched:\n";
            infoText += string.Join(", ", vill.Troops.ToResearch) + "\n";
            infoText += "-- Troop smithy levels:\n";

            List <string> levels = new List <string>();

            foreach (var level in vill.Troops.Levels)
            {
                levels.Add(level.Troop + ": " + level.Level);
            }
            infoText += string.Join(", ", levels) + "\n";

            infoText += "-- Troop to be improved:\n";
            infoText += string.Join(", ", vill.Troops.ToImprove) + "\n";
            infoText += $"-- Settlers already trained: {vill.Troops.Settlers}";

            //List<string> ctStr = new List<string>();
            //foreach(var ct in vill.Troops.CurrentlyTraining.)
            //{
            //    ctStr.Add(ct.)
            //}

            troopsInfo.Text = infoText;
        }