예제 #1
0
        private void PrintMarketInventory(object sender, string[] marketInventoryTable)
        {
            Console.ForegroundColor = Write.ColorDisplayFG;
            Console.BackgroundColor = Write.ColorDisplayBG;

            var maxCapacity = (sender as EventBroadcaster)?.maxCapacity;

            Console.SetCursorPosition(origin.X + 88, origin.Y - 9);
            Console.Write($"Max Capacity: {maxCapacity}");
            var offset = 0;

            if (previousInventoryLength > marketInventoryTable.Length)
            {
                offset = marketInventoryTable.Length / 5 * 44;
                for (int i = marketInventoryTable.Length; i < previousInventoryLength; i++)
                {
                    Console.SetCursorPosition(origin.X + 3 + offset, origin.Y - 6 + (i % 5));
                    Write.EmptySpace(25);
                }
                offset = 0;
            }

            for (int i = 0; i < marketInventoryTable.Length; i++)
            {
                offset += (i > 0 && (i % 5 == 0)) ? 44 : 0;

                Console.SetCursorPosition(origin.X + 3 + offset, origin.Y - 6 + (i % 5));
                Console.Write($"{marketInventoryTable[i]}");
            }

            previousInventoryLength = marketInventoryTable.Length;
        }
예제 #2
0
        private static void PrintUnselectedOption(string menuOption, int optionWidth)
        {
            Console.ForegroundColor = Write.ColorUnselectedOptionFG;
            Console.BackgroundColor = Write.ColorDisplayBG;

            Console.Write(menuOption);
            Write.EmptySpace(optionWidth - menuOption.Length);
        }
예제 #3
0
        private void PrintMessageBox()
        {
            for (int i = 0; i < messageBoxHeight; i++)
            {
                Console.SetCursorPosition(origin.X, origin.Y - i);

                Write.EmptySpace(messageBoxWidth);
            }
        }
예제 #4
0
        private static void PrintSelectedOption(string menuOption, int optionWidth)
        {
            Console.ForegroundColor = Write.ColorSelectedOptionFG;
            Console.BackgroundColor = Write.ColorSelectedOptionBG;

            Console.Write(Write.SelectionIndicator);
            Console.Write(menuOption);
            Write.EmptySpace(optionWidth - menuOption.Length - Write.SelectionIndicator.Length);
        }
예제 #5
0
        private void PrintButtonBevel(int buttonSize, int orderedButtonOffset, Coord buttonOrigin)
        {
            Console.BackgroundColor = Write.ColorBevelBG;
            Console.ForegroundColor = Write.ColorSurfaceFG;

            for (int i = 0; i < 3; i++)
            {
                Console.SetCursorPosition(buttonOrigin.X, buttonOrigin.Y + orderedButtonOffset + i);
                Write.EmptySpace(buttonSize);
            }
        }
예제 #6
0
        private void PrintHUDScreen()
        {
            Console.ForegroundColor = Write.ColorDisplayFG;
            Console.BackgroundColor = Write.ColorDisplayBG;

            for (int i = 0; i < hudHeight; i++)
            {
                Console.SetCursorPosition(origin.X, origin.Y - i);
                Write.EmptySpace(hudWidth);
            }
        }
예제 #7
0
        internal void PrintBlankViewScreen()
        {
            Console.ForegroundColor = Write.ColorDisplayFG;
            Console.BackgroundColor = Write.ColorDisplayBG;

            for (int i = 0; i < sizeHeight; i++)
            {
                Console.SetCursorPosition(origin.X, origin.Y - i);
                Write.EmptySpace(sizeWidth);
            }
        }
예제 #8
0
        private void PrintSurface()
        {
            Console.BackgroundColor = Write.ColorSurfaceBG;
            Console.ForegroundColor = Write.ColorSurfaceFG;

            for (int i = 0; i < sizeHeight; i++)
            {
                Console.SetCursorPosition(origin.X, origin.Y - i);
                Write.EmptySpace(sizeWidth);
            }

            Console.ResetColor();
        }
예제 #9
0
        private void PrintBevel()
        {
            int bevel = 1;

            Console.ForegroundColor = Write.ColorDefaultFG;
            Console.BackgroundColor = Write.ColorBevelBG;

            for (int i = 0; i < hudHeight + (bevel * 2); i++)
            {
                Console.SetCursorPosition(origin.X - bevel, origin.Y + bevel - i);
                Write.EmptySpace(hudWidth + (bevel * 2));
            }
        }
예제 #10
0
        private void PrintMenuPrompt(string prompt, int optionWidth)
        {
            var promptIndention = 4;

            Console.ForegroundColor = Write.ColorUnselectedOptionFG;
            Console.BackgroundColor = Write.ColorDisplayBG;

            Console.SetCursorPosition(origin.X + promptIndention, origin.Y - 11);

            Console.Write(prompt);

            Write.EmptySpace(optionWidth - prompt.Length - promptIndention);
        }
예제 #11
0
        /// <summary>
        /// Displays a menu of options for selection with a prompt message
        /// </summary>
        /// <param name="menu">Max 9 menu options allowed</param>
        public void PrintMenuSelections(object sender, IMenu menu)
        {
            var optionWidth = selectionWidth - 2;

            if (previousMenuOptions == null || previousMenuOptions != menu || forceRefresh)
            {
                PrintMenuPrompt(menu.Prompt, optionWidth);
                if (!forceRefresh)
                {
                    previousSelection = currentSelection = 0;
                }
            }

            for (int i = 0; i < menu.Options.Count; i++)
            {
                Console.SetCursorPosition(origin.X + 1, origin.Y - 9 + i);

                if (previousMenuOptions == null || previousMenuOptions != menu || forceRefresh)
                {
                    if (menu.Options[i].IsSelected)
                    {
                        previousSelection = i;
                        PrintSelectedOption(menu.Options[i].Title, optionWidth);
                    }
                    else
                    {
                        PrintUnselectedOption(menu.Options[i].Title, optionWidth);
                    }
                }
                else
                {
                    if (previousSelection == i && menu.Options.Count > 1)
                    {
                        PrintUnselectedOption(menu.Options[i].Title, optionWidth);
                    }

                    if (menu.Options[i].IsSelected)
                    {
                        PrintSelectedOption(menu.Options[i].Title, optionWidth);
                        currentSelection = i;
                    }
                }
            }

            if (previousMenuOptions != null &&
                previousMenuOptions != menu &&
                previousMenuOptions.Options.Count > menu.Options.Count)
            {
                Console.BackgroundColor = Write.ColorDisplayBG;

                for (int i = menu.Options.Count; i < previousMenuOptions.Options.Count; i++)
                {
                    Console.SetCursorPosition(origin.X + 1, origin.Y - 9 + i);
                    Write.EmptySpace(optionWidth);
                }
            }

            forceRefresh        = false;
            previousSelection   = currentSelection;
            previousMenuOptions = menu;
        }