Ejemplo n.º 1
0
    /// <summary>
    /// Sets the root of a multiplayer event system to a submenu that can only be controlled by that player
    /// </summary>
    /// <param name="eventSystem">A multiplayer event system that corresponds to `playerNumber`</param>
    protected virtual void SetPlayerRoot(MultiplayerEventSystem eventSystem)
    {
        eventSystem.playerRoot = activeMenu;
        GameObject defaultButton = GetDefaultButton(activeMenu);

        eventSystem.firstSelectedGameObject = defaultButton;
        eventSystem.SetSelectedGameObject(defaultButton);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Navigate to the previous menu, if any
    /// </summary>
    public override void PopMenu()
    {
        base.PopMenu();
        SetPlayerRoot(playerEventSystem);
        GameObject button = PopButton();

        playerEventSystem.SetSelectedGameObject(button);
    }
Ejemplo n.º 3
0
 public void NextMenu()
 {
     try
     {
         GameObject upcomingMenu = playerSetupMenus[currentMenu + 1];
     }
     catch
     {
         Debug.Log("The Menu you are trying to reach doesnt exist");
         return;
     }
     playerSetupMenus[currentMenu].SetActive(false);
     currentMenu += 1;
     playerSetupMenus[currentMenu].SetActive(true);
     Button[] buttonsInNextMenu = playerSetupMenus[currentMenu].GetComponentsInChildren <Button>();
     mpEventSystem.SetSelectedGameObject(null);
     mpEventSystem.SetSelectedGameObject(buttonsInNextMenu[0].gameObject);
 }
Ejemplo n.º 4
0
 public void Pause(InputAction.CallbackContext ctx)
 {
     if (ctx.started)
     {
         if (GameManager.Instance.gameIsPaused == false)
         {
             GameManager.Instance.gameIsPaused = true;
             selectedBeforePause = mpEventSystem.currentSelectedGameObject;
             Time.timeScale      = 0;
             PausePanel.SetActive(true);
             List <Button> buttonsInPauseMenu = PausePanel.GetComponentsInChildren <Button>().ToList <Button>();
             mpEventSystem.SetSelectedGameObject(null);
             mpEventSystem.SetSelectedGameObject(buttonsInPauseMenu[0].gameObject);
         }
         else if (GameManager.Instance.gameIsPaused == true && PausePanel.activeSelf == true)
         {
             Resume();
         }
     }
 }
Ejemplo n.º 5
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // currently selected object
        GameObject curr = mes.currentSelectedGameObject;

        // is Selection active
        if (transform.Find("Selection").gameObject.activeSelf)
        {
            // scrollbar is not selected, curr->Weapons->Weapon Group Type->Content->Viewport->ScrollView->Player Input #
            if (curr != scroller && !curr.transform.parent.parent.parent.parent.parent.parent.parent.name.Contains(playerId.ToString()))
            {
                mes.SetSelectedGameObject(scroller);
            }
        }

/*        // if Selection not active, curr->(Back/Front) Arm Loadout->Loadouts->Player Input #
 *      else if (!curr.transform.parent.parent.parent.name.Contains(playerId.ToString()))
 *      {
 *          mes.SetSelectedGameObject(scroller);
 *      }*/
    }
Ejemplo n.º 6
0
    /// <summary>
    /// sets up
    /// </summary>
    /// <param name="index">Player's list index</param>
    public void ReadyPlayer(int index)
    {
        playerConfigs[index].isReady = true;
        if (playerConfigs.All(p => p.isReady == true))
        {
            LevelMenu.SetActive(true);

            //assigns Player 1 to the level select menu
            MultiplayerEventSystem P1Event = GameObject.Find("SetupPanel").GetComponent <MultiplayerEventSystem>();
            P1Event.playerRoot = LevelMenu;
            P1Event.SetSelectedGameObject(LevelMenu.GetComponentInChildren <Button>().gameObject);

            foreach (MultiplayerEventSystem player in GameObject.FindObjectsOfType <MultiplayerEventSystem>())
            {
                if (player.playerRoot == LevelMenu)
                {
                    continue;                       //skips Player 1
                }
                player.SetSelectedGameObject(null); //makes it so that other players can't disconnect during Level Selection
            }
        }
    }
Ejemplo n.º 7
0
 public void ToggleMenu()
 {
     menu.SetActive(!menu.activeSelf);
     eventSystem.SetSelectedGameObject(menu.activeSelf ? firstMenuItem.gameObject : null);
 }