예제 #1
0
파일: Input.cs 프로젝트: nokizorque/CAB201
 public Input(string displayText, InputMenu parentMenu, bool allowBlanks, BasicDisplayable childMenu = null,
              InputValidator inputValidator = null) : base(displayText, childMenu)
 {
     this.parentMenu     = parentMenu;
     this.inputValidator = inputValidator;
     this.allowBlanks    = allowBlanks;
 }
예제 #2
0
        public Menu GetMenu(Menu menu, string header)
        {
            if (isInputMenu)
            {
                InputMenu inputMenu = new InputMenu();
                inputMenu.GetMenu(menu, header);
            }
            else
            {
                var  menuPainter = new ConsoleMenuPainter(menu);
                bool done        = false;
                do
                {
                    Console.CursorVisible = false;
                    menuPainter.Paint(header);
                    var keyInfo = Console.ReadKey();
                    switch (keyInfo.Key)
                    {
                    case ConsoleKey.UpArrow:
                        menu.MoveUp();
                        break;

                    case ConsoleKey.DownArrow:
                        menu.MoveDown();
                        break;

                    case ConsoleKey.Enter:
                        done = true;
                        break;
                    }
                }while (!done);
            }
            Console.CursorVisible = true;
            return(menu);
        }
예제 #3
0
 public Menu(DataManager dataManager)
 {
     DataManager = dataManager;
     DataManager.LoadData();
     InputMenu   = new InputMenu(DataManager);
     DisplayMenu = new DisplayMenu(DataManager);
     SearchMenu  = new SearchMenu(DataManager);
     ReportMenu  = new ReportMenu(DataManager);
 }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		private void UpdateMenu(InputMenu pMenu) {
			UnityEngine.Transform tx = gameObject.transform;

			pMenu.IsAvailable = IsAvailable;
			pMenu.Position = tx.localPosition;
			pMenu.Rotation = tx.localRotation;
			pMenu.DisplayStrength = DisplayStrength;
			pMenu.NavigateBackStrength = NavigateBackStrength;
		}
예제 #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateMenu(InputMenu pMenu)
        {
            UnityEngine.Transform tx = gameObject.transform;

            pMenu.IsAvailable          = IsAvailable;
            pMenu.Position             = tx.localPosition;
            pMenu.Rotation             = tx.localRotation;
            pMenu.DisplayStrength      = DisplayStrength;
            pMenu.NavigateBackStrength = NavigateBackStrength;
        }
예제 #6
0
            public Menu GetMenu(Menu menu, string header)
            {
                /// <summary>
                /// Returns a InputMenu
                /// </summary>
                /// <para>
                /// Return: A filled ItemContent list in menu
                /// </para>
                /// <returns></returns>
                var  menuPainter = new ConsoleMenuPainter(menu);
                bool done        = false;

                do
                {
                    Console.CursorVisible = false;
                    menuPainter.Paint(header);
                    var keyInfo = Console.ReadKey(false);
                    Console.CursorVisible = true;
                    int Xoffset = menu.Items[menu.SelectedIndex].Length + 4;
                    int Yoffset = 2 + menu.SelectedIndex;
                    Console.SetCursorPosition(Xoffset, Yoffset);

                    switch (keyInfo.Key)
                    {
                    case ConsoleKey.UpArrow:
                        menu.MoveUp();
                        break;

                    case ConsoleKey.DownArrow:
                        menu.MoveDown();
                        break;

                    case ConsoleKey.Enter:
                        menu.ItemContent[menu.SelectedIndex] = Console.ReadLine();
                        break;

                    default:

                        Console.SetCursorPosition(0, menu.Items.Count + 2);
                        Console.WriteLine(' ');

                        Console.SetCursorPosition(Xoffset, Yoffset);
                        Console.Write(keyInfo.KeyChar);
                        menu.ItemContent[menu.SelectedIndex] = keyInfo.KeyChar + Console.ReadLine();
                        break;
                    }
                    if (InputMenu.isComplete(menu))
                    {
                        done = true;
                    }
                }while (!done);
                Console.SetCursorPosition(0, menu.Items.Count + 3);
                Console.CursorVisible = true;
                return(menu);
            }
예제 #7
0
        public string[] ShowMyDialogBox()//method that uses an InputBox to collect the users choice on map size
        {
            object InputMenu;
            string defaultResponse = "20,20";

            InputMenu = Interaction.InputBox("Please enter a map size, WIDTH comma HEIGHT", "Map size editor", defaultResponse);

            if ((string)InputMenu == "")
            {
                return(defaultResponse.Split(','));
            }
            else
            {
                return(InputMenu.ToString().Split(','));
            }
        }
예제 #8
0
        public void DrawMenu()
        {
            int choice;

            Console.Clear();
            Console.WriteLine("1. Nhap du lieu.");
            Console.WriteLine("2. Hien thi du lieu.");
            Console.WriteLine("3. Tim kiem du lieu.");
            Console.WriteLine("4. Bao cao.");
            Console.Write("Nhap vao lua chon cua ban : ");
            try
            {
                choice = Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception e)
            {
                DrawMenu();
                throw;
            }
            switch (choice)
            {
            case 1:
                InputMenu.ShowInputMenu();
                DrawMenu();
                break;

            case 2:
                DisplayMenu.ShowDisplayMenu();
                break;

            case 3:
                SearchMenu.ShowSearchMenu();
                break;

            case 4:
                ReportMenu.ShowReportMenu();
                break;

            default:
                Console.WriteLine("Nhap sai, vui long nhap lai: ");
                DrawMenu();
                break;
            }
        }
예제 #9
0
 private void OnEvent(MonoBehaviour behaviour, Common.Events ev)
 {
     if (behaviour.GetType() == typeof(SettingsManager) &&
         ev == Common.Events.AfterStart &&
         behaviour.name == "PauseMenuManagers")
     {
         var settingsManager = (SettingsManager)behaviour;
         PauseMenu.Initialize(settingsManager);
         ModsMenu.Initialize(PauseMenu);
     }
     else if (behaviour.GetType() == typeof(TitleScreenManager) &&
              ev == Common.Events.AfterStart)
     {
         var titleScreenManager = (TitleScreenManager)behaviour;
         MainMenu.Initialize(titleScreenManager);
         var inputMenu = titleScreenManager
                         .GetComponent <ProfileMenuManager>()
                         .GetValue <PopupInputMenu>("_createProfileConfirmPopup");
         InputMenu.Initialize(inputMenu);
         InputCombinationElementMenu.Initialize(inputMenu);
         ModsMenu.Initialize(MainMenu);
     }
 }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public virtual void Awake() {
			vMenuL = new InputMenu(true);
			vMenuR = new InputMenu(false);
		}
예제 #11
0
 protected override void Open()
 {
     InputMenu.OnConfirm += OnConfirm;
     InputMenu.OnCancel  += OnCancel;
     InputMenu.Open(InputType.Number, Value.ToString());
 }
예제 #12
0
 static void Main(string[] args)
 {
     InputMenu.Start(args);
 }
예제 #13
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public virtual void Awake()
 {
     vMenuL = new InputMenu(true);
     vMenuR = new InputMenu(false);
 }
예제 #14
0
 protected override void Open()
 {
     InputMenu.OnConfirm += OnConfirm;
     InputMenu.OnCancel  += OnCancel;
     InputMenu.Open(InputType.Text, Value);
 }