Example #1
0
        public override UIStep NextStep(int option)
        {
            UIStep nextStep = this;

            switch (option)
            {
            case 1:
                List <Type> types      = new List <Type>(ModHandler.GetAllUnits());
                int         typesCount = types.Count;

                Console.WriteLine("Choose type:");
                ConsoleUI.PrintNumericList(1, types.Select(x => x.Name));
                int typeNumber = ConsoleUI.GetNumericOption(1, typesCount);

                Console.Write("Choose count: ");
                int count = ConsoleUI.GetNumericOption(0, int.Parse(Config.GetValue("UnitsStack:MAXSIZE")));

                Unit instance = (Unit)(types[typeNumber - 1]).GetProperty("Instance").GetValue(null, null);
                firstPlayer.army.AddStack(new UnitsStack(instance, (uint)count));

                break;

            case 2:
                ConsoleUI.PrintNumericList(1, firstPlayer.army.unitsStackList.Select(x => x.ToString()));
                Console.Write("Choose nubmer: ");
                int stackNumber = ConsoleUI.GetNumericOption(1, firstPlayer.army.unitsStackList.Count);

                firstPlayer.army.RemoveStack(firstPlayer.army.unitsStackList[stackNumber - 1]);
                break;

            case 3:
                nextStep = new SecondPlayerInterface(firstPlayer, secondPlayer, this);
                break;

            case 4:
                firstPlayer.army.Clear();
                break;

            case 5:
                nextStep = prevStep;
                break;
            }
            return(nextStep);
        }
Example #2
0
        public void MakeNewArmy()
        {
            int stacksCount = 0;

            ConsoleUI.PrintNumericList(1, "Add stack", "End");
            int option = ConsoleUI.GetNumericOption(1, 2);

            var unitTypes  = new List <Type>(ModHandler.GetAllUnits());
            int typesCount = unitTypes.Count;

            int maxSize = (int)Army.MAXSIZE;

            while (option != 2 && stacksCount < maxSize)
            {
                stacksCount++;
                Console.WriteLine("Choose type:");
                ConsoleUI.PrintNumericList(1, unitTypes.Select(x => x.Name));
                int typeNumber = ConsoleUI.GetNumericOption(1, typesCount);

                Console.Write("Choose count: ");
                int count = ConsoleUI.GetNumericOption(0, int.Parse(Config.GetValue("UnitsStack:MAXSIZE")));


                Unit instance = (Unit)(unitTypes[typeNumber - 1]).GetProperty("Instance").GetValue(null, null);
                army.AddStack(new UnitsStack(instance, (uint)count));

                if (stacksCount < maxSize)
                {
                    ConsoleUI.PrintNumericList(1, "Add stack", "End");
                    option = ConsoleUI.GetNumericOption(1, 2);
                }
            }

            Console.WriteLine($"{nickname}'s army:");
            ConsoleUI.PrintList(army.unitsStackList, "\t");
        }
Example #3
0
 public EffectHelpInterface(UIStep _prevStep)
 {
     prevStep   = _prevStep;
     types      = new List <Type>(ModHandler.GetAllEffects());
     typesCount = types.Count;
 }
Example #4
0
 public ModifiersHelpInterface(UIStep _prevStep)
 {
     prevStep   = _prevStep;
     types      = new List <Type>(ModHandler.GetAllModifiers());
     typesCount = types.Count;
 }