示例#1
0
        /// <summary>
        /// Displays the visual part of the menu.
        /// </summary>
        /// <param name="options">The options to display.</param>
        /// <param name="currentHoveredOver">The option to highlight.</param>
        /// <param name="title">Title to display.</param>
        private static void MenuDisplay(string[] options, byte currentHoveredOver = 0, string title = null)
        {
            OutPut.FullScreenClear();
            if (title != null)
            {
                OutPut.DisplayColouredMessage(title, Colours.White);
            }
            Colours colour;
            byte    indent;

            for (int n = 0; n < options.Length; n++)
            {
                if (n == currentHoveredOver)
                {
                    colour = Colours.Red;
                    indent = 2;
                }
                else
                {
                    colour = Colours.White;
                    indent = 1;
                }
                OutPut.DisplayColouredMessageAtLocation(options[n], indent, n + 1, colour, true);
            }
        }
示例#2
0
        private static void RunNonBasicInformationDisplay(string[,] textToDisplay, string[] columnNames, int[] columnStartLocation, int totalLength) //rename
        {
            byte maxLength = (byte)textToDisplay.GetLength(0);

            while (columnStartLocation[maxLength - 1] > OutPut.UIWidth())
            {
                maxLength--;
            }

            OutPut.FullScreenClear();
            string underscore = "|".PadRight(totalLength, '-');
            int    y          = 1;

            OutPut.DisplayColouredMessageAtLocation(underscore, 0, y, Colours.White);
            for (int n = 0; n < maxLength; n++) //displays all information in the 2D array textToDisplay
            {
                y = 0;
                OutPut.DisplayColouredMessageAtLocation("|" + columnNames[n], columnStartLocation[n], y, Colours.White);
                for (int m = 0; m < textToDisplay.GetLength(1); m++)
                {
                    OutPut.DisplayColouredMessageAtLocation("|" + textToDisplay[n, m], columnStartLocation[n], m + 2, Colours.White);
                }
            }

            Support.WaitOnKeyInput();
            Support.ActiveCursor();
        }
示例#3
0
        /// <summary>
        /// Ensures only the part of the menu that should be changed is updated.
        /// </summary>
        /// <param name="options">The options of the menu.</param>
        /// <param name="oldHoveredOver">The currently highlighted option's index.</param>
        /// <param name="currentHoveredOver">The last highlighted option's index.</param>
        private static void MenuDisplayUpdater(string[] options, ref byte oldHoveredOver, byte currentHoveredOver = 0)
        {
            if (oldHoveredOver != currentHoveredOver)
            {
                Paint(2, currentHoveredOver, Colours.Red, options[currentHoveredOver]);
                Paint(1, oldHoveredOver, Colours.White, options[oldHoveredOver]);
                oldHoveredOver = currentHoveredOver;
            }

            void Paint(byte indent, byte y, Colours colour, string text)
            {
                byte length = (byte)text.Length;

                OutPut.ClearPart((byte)(length + indent + 2), y + optionDisplayLowering);
                OutPut.DisplayColouredMessageAtLocation(text, indent, y + optionDisplayLowering, colour);
            }
        }
示例#4
0
        /// <summary>
        /// Displays the basic information listen in <paramref name="information"/>.
        /// </summary>
        /// <param name="information">Contains the information to display. Each string[] should be a seperate object</param>
        public static void WareDisplay(List <string[]> information)
        {
            OutPut.FullScreenClear();
            Support.DeactiveCursor();
            int y = 0;

            string[] titles       = new string[] { "Name", "ID", "Amount", "Type" };
            int[]    xLocation    = new int[titles.Length];
            byte     increasement = 20;

            for (int n = 1; n < xLocation.Length; n++) //calculates the start location of each column
            {
                xLocation[n] = increasement * n;
            }
            for (int n = 0; n < titles.Length; n++) //displays the titles and '|'
            {
                OutPut.DisplayColouredMessageAtLocation("| " + titles[n], xLocation[n], 0, Colours.White);
            }
            y += 2;
            string underline = "|";

            foreach (int xloc in xLocation) //calculates the line seperator
            {
                underline += Pad(increasement, '-', "|");
            }
            OutPut.DisplayMessage(Pad(increasement - titles[titles.Length - 1].Length - 2, ' ') + "|" + Environment.NewLine + underline, true); //Console.WriteLine(Pad(increasement - titles[titles.Length-1].Length-2,' ') + "|" + Environment.NewLine + underline);
            for (int n = 0; n < information.Count; n++)                                                                                         //writes out the information of each string array
            {
                string[] wareInfo = information[n];
                for (int m = 0; m < wareInfo.Length; m++)
                {
                    OutPut.DisplayColouredMessageAtLocation("| " + wareInfo[m], xLocation[m], y, Colours.White);
                }
                y++;
                OutPut.DisplayMessage(Pad(increasement - wareInfo[wareInfo.Length - 1].Length - 2) + "|");;
                OutPut.DisplayColouredMessageAtLocation(underline, 0, y++, Colours.White);
            }
            Support.ActiveCursor();

            string Pad(int value, char padding = ' ', string addToo = "")
            {
                value = value < 0 ? 0 : value;
                return(addToo.PadLeft(value, padding));
            }
        }