Ejemplo n.º 1
0
        /// <summary>
        /// Writes the passed line to the console window with the passed colour.
        /// Encloses the line in box-end UI elements.
        /// </summary>
        /// <param name="line">The line to write to the console</param>
        /// <param name="colour">The colour of the text to write</param>
        public static void WriteLine(string line, MenuColours colour)
        {
            int WORKING_AREA = Console.WindowWidth - 2;

            Write("|");
            Write(line, colour);
            Console.WriteLine("|".PadLeft(WORKING_AREA - line.Length));
        }
Ejemplo n.º 2
0
 public MenuSelection(
     string option,
     string text,
     MenuColours colour = MenuColours.DEFAULT)
 {
     Option     = option;
     Text       = text;
     TextColour = colour;
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (PhotonNetwork.connected)
     {
         GetComponent <BoxCollider>().enabled = true;
         if (GetComponent <Image>().color == MenuColours.GetColour(MenuColours.ColourType.DarkGreen))
         {
             GetComponent <Image>().color = MenuColours.GetColour(MenuColours.ColourType.LightGreen);
         }
     }
     else
     {
         GetComponent <BoxCollider>().enabled = false;
         GetComponent <Image>().color         = MenuColours.GetColour(MenuColours.ColourType.DarkGreen);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Writes the passed line to the console window with the passed colour, optionally centered.
        /// </summary>
        /// <param name="line">The line to write to the console</param>
        /// <param name="colour">The colour of the text to write.</param>
        /// <param name="centered">True if the line should be center-justified, false if the line should be left-aligned</param>
        public static void WriteLine(string line, MenuColours colour, bool centered = false)
        {
            if (!centered)
            {
                WriteLine(line, colour);
            }
            else
            {
                int WORKING_AREA = Console.WindowWidth - 2;
                Console.Write("|");

                Write(line.PadLeft(WORKING_AREA / 2 + line.Length / 2), colour);
                //if working area is odd
                if (WORKING_AREA % 2 != 0)
                {
                    Console.WriteLine("|".PadLeft(WORKING_AREA / 2 - line.Length / 2 + 1)); //add an extra padding char
                }
                else
                {
                    Console.WriteLine("|".PadLeft(WORKING_AREA / 2 - line.Length / 2));
                }
            }
        }
Ejemplo n.º 5
0
        public void SetTitle(string title, MenuColours colour = MenuColours.DEFAULT)
        {
            MenuTitle newTitle = new MenuTitle(title, colour);

            Title = newTitle;
        }
Ejemplo n.º 6
0
 public MenuLine(string line, MenuColours colour = MenuColours.DEFAULT)
 {
     Text   = line;
     Colour = colour;
 }
Ejemplo n.º 7
0
 public MenuTitle(string text, MenuColours colour = MenuColours.DEFAULT)
 {
     Text   = text;
     Colour = colour;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Constructs a new MenuSelection and adds it to this Menu
        /// </summary>
        /// <param name="option">Represents an expected user input for this MenuSelection</param>
        /// <param name="text">A string which should be displayed beside the option that describes what the option should accomplish</param>
        /// <param name="colour">The colour the new MenuSelection should be, defaults to white</param>
        public void AddMenuSelection(string option, string text, MenuColours colour = MenuColours.DEFAULT)
        {
            MenuSelection newItem = new MenuSelection(option, text, colour);

            MenuSelections.Add(newItem);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Constructs a new MenuItem and adds it to this Menu's list of MenuLines
        /// </summary>
        /// <param name="line">The string to be displayed</param>
        /// <param name="colour">Optional MenuColour for the line</param>
        public void AddLine(string line, MenuColours colour = MenuColours.DEFAULT)
        {
            MenuLine newLine = new MenuLine(line, colour);

            MenuLines.Add(newLine);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Writes the passed line to the console coloured with the passed colour.
 /// Does not prepend or append the box-edge UI elements
 /// </summary>
 /// <param name="line">The line to write</param>
 /// <param name="colour">The colour of the line text</param>
 private static void WriteColouredLine(string line, MenuColours colour)
 {
     Console.ForegroundColor = (ConsoleColor)colour;
     Console.WriteLine(line);
     Console.ResetColor();
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Writes the passed message to the console coloured with the passed colour.
 /// Does not prepend or append the box-edge UI elements
 /// </summary>
 /// <param name="message">The message to be coloured and written to the console</param>
 /// <param name="colour">The colour of the message text</param>
 private static void Write(string message, MenuColours colour)
 {
     Console.ForegroundColor = (ConsoleColor)colour;
     Console.Write(message);
     Console.ResetColor();
 }