public override void Update()
        {
            ConsoleUI.ColorText("Choice : ", ConsoleColor.Green);

            string keyInput = Console.ReadLine();

            if (GetKeyInput(keyInput, "0"))
            {
                PopState();
            }
            else if (GetKeyInput(keyInput, "1"))
            {
                SetName();
            }
            else if (GetKeyInput(keyInput, "2"))
            {
                SetClass();
            }
            else if (GetKeyInput(keyInput, "3"))
            {
                SelectStats();
            }
            else
            {
                ConsoleUI.Error("\nPlease select a valid option...\n");
            }
        }
Example #2
0
        public override void Update()
        {
MakeChoice:
            ConsoleUI.ColorText("Choice : ", ConsoleColor.Green);
            string keyInput = Console.ReadLine();

            int[] validIndex = SaveManager.Instance.GetValidIndex();

            if (int.TryParse(keyInput, out int numberInput))
            {
                if (numberInput == 0)
                {
                    PopState();
                    return;
                }
                foreach (var index in validIndex)
                {
                    if (numberInput == index)
                    {
                        ConsoleUI.Warning($"Character {numberInput} Selected");
                        SaveManager.Instance.Load(GameManager.Instance.PlayerCharacter, numberInput);
                        Console.ReadLine();
                        PopState();
                        return;
                    }
                }
            }
            ConsoleUI.Error("Please select a valid option...");
            goto MakeChoice;
        }
Example #3
0
        public override void Update()
        {
            ConsoleUI.ColorText("Choice : ", ConsoleColor.Green);
            string keyInput = Console.ReadLine();

            if (GetKeyInput(keyInput, "0"))
            {
                PopState();
            }
            else if (GetKeyInput(keyInput, "1"))
            {
                OnUpdateUI?.Invoke();
                Console.WriteLine("IMPLEMENT GAME STATE...");
                Console.ReadKey();
            }
            else if (GetKeyInput(keyInput, "2"))
            {
                PushState(new CreateCharacterState(States));
            }
            else if (GetKeyInput(keyInput, "3"))
            {
                if (SaveManager.Instance.SaveCount() > 0)
                {
                    PushState(new SelectCharacterState(States));
                }
                else
                {
                    OnUpdateUI?.Invoke();
                    ConsoleUI.Error("Unable to find any save, please create one...");
                }
            }
            else if (GetKeyInput(keyInput, "4"))
            {
                OnUpdateUI?.Invoke();
                Save();
            }
            else if (GetKeyInput(keyInput, "5"))
            {
                OnUpdateUI?.Invoke();
                Load();
            }
            else if (GetKeyInput(keyInput, "6"))
            {
                if (SaveManager.Instance.SaveCount() >= 1)
                {
                    Delete();
                }
                else
                {
                    ConsoleUI.Error("There is no save to delete...");
                }
            }
            else if (GetKeyInput(keyInput, "7"))
            {
                GameManager.Instance.PlayerCharacter.DisplayInfo();
                Console.WriteLine("Press Any Key...");
                Console.ReadKey();
                OnUpdateUI?.Invoke();
            }
            else
            {
                OnUpdateUI?.Invoke();
                ConsoleUI.Error("Please select a valid option...");
            }
        }