protected override bool InternalGetProceedButton()
    {
        if (m_PlayerInput != null)
        {
            return(m_PlayerInput.GetButtonDown("Submit"));
        }

        return(false);
    }
Exemple #2
0
    private void CheckForPreviousControl(int i_PlayerIndex)
    {
        if (!IsValidIndex(i_PlayerIndex))
        {
            return;
        }

        bool cancelPressed = false;

        PlayerInput playerInput = m_Players[i_PlayerIndex];

        if (playerInput != null)
        {
            cancelPressed = playerInput.GetButtonDown(s_PlayerInput_Cancel);
        }
        else
        {
            WiFiPlayerInput wifiPlayerInput = m_WifiPlayers[i_PlayerIndex];
            if (wifiPlayerInput != null)
            {
                cancelPressed = wifiPlayerInput.GetButtonDown(s_WiFiPlayerInput_Cancel);
            }
        }

        if (cancelPressed)
        {
            PopControllingMap(i_PlayerIndex);
        }
    }
    public void Test()
    {
        if (m_PlayerInput == null)
        {
            return;
        }

        for (int index = 0; index < m_Buttons.Count; ++index)
        {
            string button = m_Buttons[index];
            if (button != "")
            {
                bool buttonPressed = m_PlayerInput.GetButtonDown(button);
                if (buttonPressed)
                {
                    Debug.Log("[" + m_PlayerName + "] " + button);
                }
            }
        }

        for (int index = 0; index < m_Axes.Count; ++index)
        {
            string axis = m_Axes[index];
            if (axis != "")
            {
                float axisValue = m_PlayerInput.GetAxis(axis);
                if (axisValue != 0f)
                {
                    Debug.Log("[" + m_PlayerName + "] " + axis + ": " + axisValue);
                }
            }
        }
    }
Exemple #4
0
    private void CheckForCancelation(int i_PlayerIndex)
    {
        if (!IsValidIndex(i_PlayerIndex))
        {
            return;
        }

        IndexList controlledPlayers = m_ControllingMap[i_PlayerIndex];

        int controlledPlayerIndex = controlledPlayers.GetLast();

        if (!IsValidIndex(controlledPlayerIndex))
        {
            return;
        }

        bool cancelPressed = false;

        PlayerInput playerInput = m_Players[i_PlayerIndex];

        if (playerInput != null)
        {
            cancelPressed = playerInput.GetButtonDown(s_PlayerInput_Cancel);
        }
        else
        {
            WiFiPlayerInput wifiPlayerInput = m_WifiPlayers[i_PlayerIndex];
            if (wifiPlayerInput != null)
            {
                cancelPressed = wifiPlayerInput.GetButtonDown(s_WiFiPlayerInput_Cancel);
            }
        }

        if (cancelPressed)
        {
            GameObject currentSelection = m_Selections[controlledPlayerIndex];
            if (currentSelection != null)
            {
                tnTeamFlag teamFlag = currentSelection.GetComponent <tnTeamFlag>();
                if (teamFlag != null)
                {
                    teamFlag.SetHighlighted(GetPlayerColor(controlledPlayerIndex));
                }

                // Raise event.

                if (m_OnDeselect != null)
                {
                    m_OnDeselect.Invoke();
                }

                m_Confirmations[controlledPlayerIndex] = false;
            }
        }
    }
    private void Game_Update()
    {
        // Check pause.

        if (!m_Paused)
        {
            if (!m_MatchJustUnpaused)
            {
                bool pausePressed = false;

                InputModule inputModule = UIEventSystem.inputModuleMain;
                if (inputModule != null)
                {
                    for (int index = 0; index < inputModule.playersCount; ++index)
                    {
                        PlayerInput playerInput = inputModule.GetPlayerInput(index);

                        if (playerInput == null)
                        {
                            continue;
                        }

                        pausePressed |= playerInput.GetButtonDown("Pause");
                    }

                    for (int index = 0; index < inputModule.wifiPlayersCount; ++index)
                    {
                        WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(index);

                        if (playerInput == null)
                        {
                            continue;
                        }

                        pausePressed |= playerInput.GetButtonDown("Pause");
                    }
                }

                if (pausePressed)
                {
                    if (m_MatchController != null)
                    {
                        bool canPause = m_MatchController.canPause;
                        if (canPause)
                        {
                            m_MatchController.Pause();
                        }
                    }
                }
            }

            m_MatchJustUnpaused = false;
        }
    }
Exemple #6
0
    private bool ProcessBackRequests()
    {
        if (m_BackInvoked)
        {
            return(true);
        }

        if (!m_BackRequested)
        {
            bool backRequest = false;

            for (int playerIndex = 0; playerIndex < s_MaxPlayers; ++playerIndex)
            {
                bool backPressed = false;

                PlayerInput playerInput = m_Players[playerIndex];
                if (playerInput != null)
                {
                    backPressed |= playerInput.GetButtonDown(s_PlayerInput_Cancel);
                }
                else
                {
                    WiFiPlayerInput wifiPlayerInput = m_WifiPlayers[playerIndex];
                    if (wifiPlayerInput != null)
                    {
                        backPressed |= wifiPlayerInput.GetButtonDown(s_WiFiPlayerInput_Cancel);
                    }
                }

                backRequest |= backPressed;
                backRequest &= !m_Confirmations[playerIndex];
            }

            if (backRequest)
            {
                m_BackRequested = true;
            }
        }

        if (m_BackRequested && !m_BackInvoked)
        {
            if (m_TriggerCancel != null && m_TriggerCancel.enabled)
            {
                m_TriggerCancel.Invoke();
            }

            m_BackInvoked = true;
        }

        return(m_BackRequested);
    }
    public void Frame(WiFiPlayerInput i_PlayerInput)
    {
        if (i_PlayerInput == null)
        {
            return;
        }

        bool move = false;

        move |= i_PlayerInput.GetNegativeButtonDown(s_WiFiPlayerInput_Vertical);
        move |= i_PlayerInput.GetPositiveButtonDown(s_WiFiPlayerInput_Vertical);

        bool submit = i_PlayerInput.GetButtonDown(s_WiFiPlayerInput_Submit);

        InternalUpdate(move, submit);
    }
        // BUSINESS LOGIC

        public void UpdateTrigger()
        {
            if (!m_CanSend)
            {
                return;
            }

            // Update players action.

            {
                for (int playerInputIndex = 0; playerInputIndex < m_Players.Count; ++playerInputIndex)
                {
                    PlayerInput playerInput = m_Players[playerInputIndex];
                    if (playerInput != null)
                    {
                        if (playerInput.GetButtonDown(m_Action))
                        {
                            m_OnEvent.Invoke();
                        }
                    }
                }
            }

            if (m_UseWifi)
            {
                // Update wifi players action.

                for (int playerInputIndex = 0; playerInputIndex < m_WifiPlayers.Count; ++playerInputIndex)
                {
                    WiFiPlayerInput playerInput = m_WifiPlayers[playerInputIndex];
                    if (playerInput != null)
                    {
                        if (playerInput.GetButtonDown(m_WifiAction))
                        {
                            m_OnEvent.Invoke();
                        }
                    }
                }
            }
        }
Exemple #9
0
    private void Game_Update()
    {
        if (PhotonNetwork.room == null)
        {
            if (!m_MatchAborted)
            {
                m_MatchAborted = true;

                if (m_MatchController != null)
                {
                    m_MatchController.MatchBecomeInvalid();
                }
                else
                {
                    OnMatchBecomeInvalid();
                }
            }

            return;
        }

        if (!m_Paused)
        {
            if (!m_MatchJustUnpaused)
            {
                bool pausePressed = false;

                InputModule inputModule = UIEventSystem.inputModuleMain;
                if (inputModule != null)
                {
                    for (int index = 0; index < inputModule.playersCount; ++index)
                    {
                        PlayerInput playerInput = inputModule.GetPlayerInput(index);

                        if (playerInput == null)
                        {
                            continue;
                        }

                        pausePressed |= playerInput.GetButtonDown("Pause");
                    }

                    for (int index = 0; index < inputModule.wifiPlayersCount; ++index)
                    {
                        WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(index);

                        if (playerInput == null)
                        {
                            continue;
                        }

                        pausePressed |= playerInput.GetButtonDown("Pause");
                    }
                }

                if (pausePressed)
                {
                    if (m_MatchController != null)
                    {
                        bool canPause = m_MatchController.canPause;
                        if (canPause)
                        {
                            m_MatchController.Pause();
                        }
                    }
                }
            }

            m_MatchJustUnpaused = false;
        }
    }