Defining the actions for the main-menu
상속: MonoBehaviour
예제 #1
0
 public void OpenMenu()
 {
     enabled          = true;
     m_Actions        = playerInput.GetActions <MenuActions>();
     m_Actions.active = true;
     menu.SetActive(true);
 }
예제 #2
0
    public MenuActions draw()
    {
        MenuActions menuAction = MenuActions.none;

        GUI.DrawTexture(backgroundRect, background, ScaleMode.ScaleAndCrop, false, 0);

        GUILayout.BeginArea(guiRect);
        GUILayout.BeginVertical();
        {
            GUILayout.Label("Set left and right mouse buttons", GuiFunctions.getNormalStyle(Color.black));

            GUILayout.BeginHorizontal();
            foreach (GameOptions.toolModes toolMode in Enum.GetValues(typeof(GameOptions.toolModes)))
            {
                if (GUILayout.Button(ResourceLookup.getToolModeTexture(toolMode), toolGuiOptions))
                {
                    setMouseButton(toolMode);
                }
                GUILayout.Space(toolIconSpacing);
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(toolIconSpacing);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            drawMouseIcon(0);
            GUILayout.FlexibleSpace();
            drawMouseIcon(1);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();

        return(menuAction);
    }
예제 #3
0
 public static void getAllUsers()
 {
     foreach (UserAccount user in Users)
     {
         MenuActions.displayUser(user, true);
     }
 }
예제 #4
0
        /// <summary>Make a new button.</summary>
        /// <param name="screenWidth">The width of the game window.</param>
        /// <param name="btn">The button texture.</param>
        /// <param name="action">The action the button triggers.</param>
        /// <param name="offsetY">The y coördinate of the button.</param>
        public Button(int screenWidth, Texture2D btn, MenuActions action, int offsetY)
        {
            this.btn = btn;
            this.action = action;

            btnBox = new Rectangle(screenWidth / 2 - btn.Width / 2, offsetY, btn.Width, btn.Height);
        }
예제 #5
0
    void OnGUI()
    {
        if (gameMode == GameModes.gameplay)
        {
            menuAction = MenuActions.none;
            gameHUD.draw();
        }
        else if (gameMode == GameModes.paused)
        {
            menuAction = pauseMenu.draw();
        }
        else if (gameMode == GameModes.toolSelect)
        {
            menuAction = toolSelectMenu.draw();
        }
        else if (gameMode == GameModes.blockSelect)
        {
            menuAction = blockSelectMenu.draw();
        }

        if (menuAction != null)
        {
            updateMenu();
        }
    }
예제 #6
0
    private void processMenuAction()
    {
        if (menuAction == MenuActions.none)
        {
            return;
        }

        if (menuAction == MenuActions.exitGame)
        {
            Application.Quit();
        }
        if (menuAction == MenuActions.gotoMainMenu)
        {
            setCurrentMenu(Menus.main);
        }
        if (menuAction == MenuActions.loadGame)
        {
            GameOptions.loadSavedGame = true;
            Application.LoadLevel("Starport");
        }
        if (menuAction == MenuActions.newGame)
        {
            menuAction = MenuActions.submitNewGame;
            //setCurrentMenu(Menus.newGame);
        }
        if (menuAction == MenuActions.submitNewGame)
        {
            GameOptions.loadSavedGame = false;
            Application.LoadLevel("Starport");
        }

        menuAction = MenuActions.none;
    }
예제 #7
0
    public static MenuActions CreateWithDefaultBindings()
    {
        var actions = new MenuActions();

        actions.Up.AddDefaultBinding(Key.UpArrow);
        actions.Down.AddDefaultBinding(Key.DownArrow);
        actions.Left.AddDefaultBinding(Key.LeftArrow);
        actions.Right.AddDefaultBinding(Key.RightArrow);

        actions.Left.AddDefaultBinding(InputControlType.LeftStickLeft);
        actions.Right.AddDefaultBinding(InputControlType.LeftStickRight);
        actions.Up.AddDefaultBinding(InputControlType.LeftStickUp);
        actions.Down.AddDefaultBinding(InputControlType.LeftStickDown);

        actions.Left.AddDefaultBinding(InputControlType.DPadLeft);
        actions.Right.AddDefaultBinding(InputControlType.DPadRight);
        actions.Up.AddDefaultBinding(InputControlType.DPadUp);
        actions.Down.AddDefaultBinding(InputControlType.DPadDown);

        actions.Submit.AddDefaultBinding(Key.Return);
        actions.Submit.AddDefaultBinding(Key.Space);
        actions.Submit.AddDefaultBinding(InputControlType.Action1);

        actions.Cancel.AddDefaultBinding(Key.Escape);
        actions.Cancel.AddDefaultBinding(InputControlType.Action2);

        // actions.OpenMenu.AddDefaultBinding( Key.Escape );
        // actions.OpenMenu.AddDefaultBinding( InputControlType.Command );

        return(actions);
    }
예제 #8
0
    private void drawNewGame()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(buttonSpace);
        GUILayout.BeginVertical();

        GUILayout.Label("Ship Name:", GuiFunctions.getButtonStyle());
        newShipName = GUILayout.TextField(newShipName);

        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Begin", GuiFunctions.getButtonStyle()))
            {
                menuAction = MenuActions.submitNewGame;
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
        GUILayout.Space(buttonSpace);
        GUILayout.EndHorizontal();
    }
예제 #9
0
    public static MenuActions CreateWithAllBindings()
    {
        var actions = new MenuActions();

        actions.Left.AddDefaultBinding(Key.LeftArrow);
        actions.Left.AddDefaultBinding(Key.A);
        actions.Right.AddDefaultBinding(Key.RightArrow);
        actions.Right.AddDefaultBinding(Key.D);

        actions.Up.AddDefaultBinding(Key.UpArrow);
        actions.Up.AddDefaultBinding(Key.W);
        actions.Down.AddDefaultBinding(Key.DownArrow);
        actions.Down.AddDefaultBinding(Key.S);

        actions.Confirm.AddDefaultBinding(Key.Space);
        actions.Present.AddDefaultBinding(Key.Return);

        actions.CloseInventory.AddDefaultBinding(Key.Tab);

        //controller
        actions.Left.AddDefaultBinding(InputControlType.LeftStickLeft);
        actions.Right.AddDefaultBinding(InputControlType.LeftStickRight);
        actions.Up.AddDefaultBinding(InputControlType.LeftStickUp);
        actions.Down.AddDefaultBinding(InputControlType.LeftStickDown);


        actions.Confirm.AddDefaultBinding(InputControlType.Action1);
        actions.Present.AddDefaultBinding(InputControlType.Action4);
        actions.CloseInventory.AddDefaultBinding(InputControlType.Action4);

        return(actions);
    }
예제 #10
0
        /// <summary>
        /// Links between interface and controller for User Input when logged out
        /// </summary>
        private void UserInput(string informationMessage, MenuActions.PacketCreation packetCreation)
        {
            bool        flag        = false;
            MenuActions menuActions = new MenuActions();

            do
            {
                Console.Out.WriteLine(informationMessage);

                Console.Out.WriteLine("Username (write \"leave\" to leave): ");
                var username = Console.ReadLine();

                // Checking if user wants to leave
                if (username != null && username.Equals("leave"))
                {
                    flag = true;
                }
                else
                {
                    Console.Out.WriteLine("Password: ");
                    var password = Console.ReadLine();

                    flag = menuActions.HandleUser(username, password, out var message, packetCreation);
                    Console.Out.WriteLine(message);
                }
            } while (!flag);
        }
예제 #11
0
        //Public Void Methods
        public static void ItemToCartPrompt()
        {
            Console.Clear();
            Console.WriteLine("Please provide the following product information");
            int productNumber   = getProductNumber();
            int productQuantity = getProductQuantity();
            var productToAdd    = InventoryItem.getProductByNumber(productNumber);

            switch (productToAdd.Count())
            {
            case 0:
                Console.WriteLine("Could not find product with the number " + productNumber.ToString());
                break;

            case 1:
                foreach (InventoryItem i in productToAdd)
                {
                    addItemToCart(i, productQuantity);
                    Console.WriteLine(productQuantity.ToString() + " " + i.ProductName + " succesfully added to cart");
                }
                break;

            default:
                Console.WriteLine("Error: duplicate products with the same number found!");
                break;
            }
            MenuActions.returnToMainMenu();
        }
예제 #12
0
 protected void RaiseMenuItemSelected(MenuActions menuAction)
 {
     if (this.MenuItemSelected != null)
     {
         MenuItemSelected(this, new MenuItemEventArgs(menuAction));
     }
 }
예제 #13
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            lastMouseButton = 0;
        }
        if (Input.GetMouseButtonDown(1))
        {
            lastMouseButton = 1;
        }

        if (!escIsEnabled && !Input.GetButton("Escape"))
        {
            escIsEnabled = true;
        }

        if (Input.GetButton("Escape") && escIsEnabled)
        {
            if (gameMode == GameModes.paused)
            {
                menuAction = MenuActions.resumeGame;
            }
            else if (gameMode == GameModes.gameplay)
            {
                setPause();
            }
        }

        if (Input.GetButton("Tools"))
        {
            if (gameMode == GameModes.gameplay)
            {
                setToolSelect();
            }
        }
        else if (gameMode == GameModes.toolSelect)
        {
            setResume();
        }

        if (Input.GetButton("Block Select"))
        {
            if (gameMode == GameModes.gameplay)
            {
                setBlockSelect();
            }
        }
        else if (gameMode == GameModes.blockSelect)
        {
            setResume();
        }

        if (!Screen.showCursor)
        {
            Screen.lockCursor = true;
        }
    }
예제 #14
0
    public void RequestMenu()
    {
        var u = GetSelected();

        if (u == null)         // чел улетел с переднего места
        {
            return;
        }
        MenuActions.Show(u.id, u.name);
    }
예제 #15
0
        protected List <MenuAction> FilterAndShufflMenuActions()
        {
            List <MenuAction> nonHiddenMenuActions = MenuActions.Where(ma => !ma.IsHidden).ToList();

            if (_shuffleInputsFlag)
            {
                nonHiddenMenuActions = _chanceService.Shuffle(nonHiddenMenuActions).ToList();
            }

            return(nonHiddenMenuActions);
        }
예제 #16
0
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
예제 #17
0
 public override void Select(PlayerCursor cursor)
 {
     if (GameModeSelect.gameMode == GameMode.Mode.RagOfTheHill)
     {
         SceneManager.LoadScene("RagOfTheHill");
         //MenuActions.ToCharacterSelect();
     }
     else
     {
         MenuActions.ToLevelSelect();
     }
 }
예제 #18
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     HorizontalPanel.gameObject.SetActive(false);
     actions = MenuActions.CreateWithAllBindings();
 }
 protected override void OnReturn(InputValue inputValue)
 {
     if (hasControl)
     {
         MenuActions.ToLevelSelect();
     }
     else
     {
         hasControl = true;
         CharacterSelect.playerSelectionEvent?.Invoke(this);
         GetComponent <Image>().color = Color.white;
     }
 }
예제 #20
0
    void ResetInput()
    {
        if (MenuActions != null)
        {
            MenuActions.Destroy();
            MenuActions = null;
        }

        if (GameActions != null)
        {
            GameActions.Destroy();
            GameActions = null;
        }
    }
예제 #21
0
    void BuildAnimationLayer()
    {
        var action = new MenuActions.MenuAction();

        action.menuType  = MenuActions.MenuAction.MenuType.Slider;
        action.parameter = parameter;
        action.name      = "VisimeAnimation";
        action.fxLayerAnimations.enter = animationFx;

        List <MenuActions.MenuAction> list = new List <MenuActions.MenuAction>();

        list.Add(action);
        MenuActions.BuildSliderLayer(list, AnimationLayer.FX, action.parameter);
    }
예제 #22
0
        static void Main(string[] args)
        {
            MenuActions currentAction = MenuActions.Help;
            string      param         = "";

            do
            {
                (currentAction, param) = GetMenuAction();

                switch (currentAction)
                {
                case MenuActions.Add:
                    AddToDo(param);
                    break;

                case MenuActions.Print:
                    Print(3);
                    break;

                case MenuActions.PrintAll:
                    Print();
                    break;

                case MenuActions.Done:
                    Done(param);
                    break;

                case MenuActions.Exit:
                    break;

                case MenuActions.Help:
                    PrintHelp();
                    break;

                case MenuActions.Clear:
                    Clear();
                    break;

                case MenuActions.ReOrder:
                    ReOrder(param);
                    break;

                default:
                    break;
                }

                Console.WriteLine();
            } while (currentAction != MenuActions.Exit);
        }
예제 #23
0
    private void drawMain()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(buttonSpace);
        GUILayout.BeginVertical();

        if (GUILayout.Button("New Ship", GuiFunctions.getButtonStyle()))
            menuAction = MenuActions.newGame;
        if (GUILayout.Button("Continue", GuiFunctions.getButtonStyle()))
            menuAction = MenuActions.loadGame;
        if (GUILayout.Button("Exit", GuiFunctions.getButtonStyle()))
            menuAction = MenuActions.exitGame;

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
예제 #24
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (currentMenu == Menus.main)
            {
                menuAction = MenuActions.exitGame;
            }
            else
            {
                menuAction = MenuActions.gotoMainMenu;
            }
        }

        processMenuAction();
    }
예제 #25
0
        static void Main(string[] args)
        {
            var  flatAppliances       = new Flat();
            var  mainMenu             = new MenuActions();
            bool appliactionNeverStop = false;

            mainMenu.MainMenu();
            string userChoiceMainMenu = Console.ReadLine();

            flatAppliances.CreateFlatAppliances(userChoiceMainMenu);
            do
            {
                mainMenu.FunctionsMenu();
                string userChoiceFunctionsMenu = Console.ReadLine();
                flatAppliances.ChangeFlatAppliances(userChoiceFunctionsMenu);
            } while (appliactionNeverStop == false);
        }
예제 #26
0
        private static (MenuActions action, string param) GetMenuAction()
        {
            MenuActions action = MenuActions.Help;

            Console.Write("What would you like to do: ");
            string fullAction   = Console.ReadLine();
            string actionString = fullAction;
            string param        = "";

            if (fullAction.IndexOf(' ') >= 0)
            {
                actionString = fullAction.Substring(0, fullAction.IndexOf(' '));
                param        = fullAction.Substring(fullAction.IndexOf(' ') + 1);
            }

            if (Enum.TryParse(actionString, out action) == false)
            {
                action = MenuActions.Help;
            }

            /*switch (action.ToLower())
             * {
             *  case "add":
             *      output = MenuActions.Add;
             *      break;
             *  case "Print":
             *      output = MenuActions.Print;
             *      break;
             *  case "PrintAll":
             *      output = MenuActions.PrintAll;
             *      break;
             *  case "Done":
             *      output = MenuActions.Done;
             *      break;
             *  case "Exit":
             *      output = MenuActions.Exit;
             *      break;
             *  case "Help":
             *      output = MenuActions.Help;
             *      break;
             *  default:
             *      break;
             * }*/
        }
예제 #27
0
    void SetupInput()
    {
        // Create the action sets for our menu and game controls.
        MenuActions = MenuActions.CreateWithDefaultBindings();
        GameActions = GameActions.CreateWithDefaultBindings();

        // Get the InControlInputModule, and attach menu navigation controls.
        var inputModule = EventSystem.current.GetComponent <InControlInputModule>();

        Debug.Assert(inputModule != null, "inputModule != null");
        if (inputModule != null)
        {
            inputModule.MoveAction   = MenuActions.Move;
            inputModule.SubmitAction = MenuActions.Submit;
            inputModule.CancelAction = MenuActions.Cancel;
        }

        // Jump straight to the bindings menu.
        BindingsMenu.Show(GameActions);
    }
예제 #28
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Lab1\n");

            ConsoleReader reader = new ConsoleReader();
            ConsoleWriter writer = new ConsoleWriter();

            PathController pathController = new PathController(reader);

            pathController.ReadBlocksInfo();
            MenuActions    menuActions    = new MenuActions(pathController, reader, writer);
            MenuController menuController = new MenuController(menuActions, reader, writer);

            bool finished = false;

            while (!finished)
            {
                finished = !menuController.PressKey();
            }
        }
예제 #29
0
    private void drawMain()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(buttonSpace);
        GUILayout.BeginVertical();

        if (GUILayout.Button("New Ship", GuiFunctions.getButtonStyle()))
        {
            menuAction = MenuActions.newGame;
        }
        if (GUILayout.Button("Continue", GuiFunctions.getButtonStyle()))
        {
            menuAction = MenuActions.loadGame;
        }
        if (GUILayout.Button("Exit", GuiFunctions.getButtonStyle()))
        {
            menuAction = MenuActions.exitGame;
        }

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
예제 #30
0
        public static void userSearchByEmail()
        {
            Console.Clear();
            Console.Write("Email to search: ");
            var emailAddress = Console.ReadLine();

            var accounts      = getUserByEmail(emailAddress);
            int totalAccounts = accounts.Count();

            if (totalAccounts == 0)
            {
                Console.WriteLine("No users found with email address - " + emailAddress);
            }
            else
            {
                Console.WriteLine("Total Users Found: " + totalAccounts);
                foreach (var user in accounts)
                {
                    MenuActions.displayUser(user, true);
                }
            }
        }
예제 #31
0
        public static void removeItemFromCartPrompt()
        {
            Console.WriteLine("Please provide the product number of the item you would like to remove from your cart, along with the quantity.");
            var itemsInCart = getAllCartItems();

            if (itemsInCart.Count() > 0)
            {
                foreach (ShoppingCart cartItem in itemsInCart)
                {
                    Console.WriteLine("####################");
                    Console.WriteLine("Product Name: " + cartItem.ProductName);
                    Console.WriteLine("Product Number: " + cartItem.ProductNumber);
                    Console.WriteLine("Current Quantity: " + cartItem.quantity);
                    Console.WriteLine("####################");
                    Console.WriteLine();
                }
                int productNumber   = getProductNumber();
                int productQuantity = getProductQuantity();
                removeItemFromCart(productNumber, productQuantity);
                MenuActions.returnToMainMenu();
            }
        }
예제 #32
0
        private static (MenuActions action, string param) GetMenuAction()
        {
            MenuActions action = MenuActions.Help;

            Console.Write("What would you like to do: ");
            string fullAction = Console.ReadLine();

            string actionString = fullAction;
            string param        = "";

            if (fullAction.IndexOf(' ') >= 0)
            {
                actionString = fullAction.Substring(0, fullAction.IndexOf(' '));
                param        = fullAction.Substring(fullAction.IndexOf(' ') + 1);
            }

            if (Enum.TryParse(actionString, out action) == false)
            {
                action = MenuActions.Help;
            }

            return(action, param);
        }
예제 #33
0
    private void drawNewGame()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(buttonSpace);
        GUILayout.BeginVertical();

        GUILayout.Label("Ship Name:", GuiFunctions.getButtonStyle());
        newShipName=GUILayout.TextField(newShipName);

        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Begin", GuiFunctions.getButtonStyle()))
                menuAction = MenuActions.submitNewGame;

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
        GUILayout.Space(buttonSpace);
        GUILayout.EndHorizontal();
    }
예제 #34
0
 public void ApplyMenuAction(MenuActions menuAct)
 {
     switch (menuAct)
     {
     case MenuActions.Agree:
         SetReviewStatus(ReviewStatus.Agreed);
         break;
     case MenuActions.Disagree:
         SetReviewStatus(ReviewStatus.Disagreed);
         break;
     case MenuActions.Flag:
         SetReviewStatus(ReviewStatus.Flagged);
         break;
     case MenuActions.Reset:
         SetReviewStatus(ReviewStatus.Unknown);
         break;
     case MenuActions.MarkRead:
         MarkRead(true);
         break;
     case MenuActions.MarkUnread:
         MarkRead(false);
         break;
     default:
         break;
     }
 }
예제 #35
0
 private void AddKey(MenuActions action, Keys key)
 {
     //MenuKeys.Add(action, key);
     MenuKeys[action] = key;
 }
예제 #36
0
		private void RaiseMenuActionEvent(MenuActions act)
		{
			ContextMenuActionEventArgs args = new ContextMenuActionEventArgs(ContextMenuActionEvent, this);
			args.MenuAction = act;
			RaiseEvent(args);
		}
예제 #37
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (currentMenu == Menus.main)
            {
                menuAction = MenuActions.exitGame;
            }
            else
            {
                menuAction = MenuActions.gotoMainMenu;
            }
        }

        processMenuAction();
    }
예제 #38
0
    private void processMenuAction()
    {
        if (menuAction == MenuActions.none)
            return;

        if (menuAction == MenuActions.exitGame)
            Application.Quit();
        if (menuAction == MenuActions.gotoMainMenu)
            setCurrentMenu(Menus.main);
        if (menuAction == MenuActions.loadGame)
        {
            GameOptions.loadSavedGame = true;
            Application.LoadLevel("Starport");
        }
        if (menuAction == MenuActions.newGame)
        {
            menuAction = MenuActions.submitNewGame;
            //setCurrentMenu(Menus.newGame);
        }
        if (menuAction == MenuActions.submitNewGame)
        {
            GameOptions.loadSavedGame = false;
            Application.LoadLevel("Starport");
        }

        menuAction = MenuActions.none;
    }
예제 #39
0
 public ActionStates GetMenuActionState(PlayerIndex playerIndex, MenuActions menuAction)
 {
     return playersMenuActionStatesMap[playerIndex][menuAction];
 }