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); }
private void CheckProceed() { if (m_Gamepads == null || m_Phones == null || m_TriggerProceed == null) { return; } bool confirm = false; // Check gamepads for (int gamepadIndex = 0; gamepadIndex < m_Gamepads.Count; ++gamepadIndex) { tnUIGamepad gamepad = m_Gamepads[gamepadIndex]; if (gamepad != null) { if (gamepad.deviceState == DeviceState.Left || gamepad.deviceState == DeviceState.Right) { confirm |= gamepad.GetProceedButton(); } } } // Check phones for (int phoneIndex = 0; phoneIndex < m_Phones.Count; ++phoneIndex) { tnUIPhone phone = m_Phones[phoneIndex]; if (phone != null) { if (phone.deviceState == DeviceState.Left || phone.deviceState == DeviceState.Right) { confirm |= phone.GetProceedButton(); } } } if (confirm) { m_TriggerProceed.Invoke(); } }
private bool ProcessProceedRequests() { if (m_ProceedInvoked) { return(true); } if (!m_ProceedRequested) { bool allConfirmed = true; for (int playerIndex = 0; playerIndex < s_MaxPlayers; ++playerIndex) { allConfirmed &= m_Confirmations[playerIndex]; } if (allConfirmed) { m_ProceedRequested = true; } } if (m_ProceedRequested && !m_ProceedInvoked) { m_ProceedTimer += Time.deltaTime; if (m_ProceedTimer > s_ProceedDelay) { if (m_TriggerProceed != null && m_TriggerProceed.enabled) { m_TriggerProceed.Invoke(); } m_ProceedInvoked = true; } } return(m_ProceedRequested); }
private void CheckCancel() { if (m_Gamepads == null || m_Phones == null || m_TriggerCancel == null) { return; } bool cancel = false; // Check gamepads for (int gamepadIndex = 0; gamepadIndex < m_Gamepads.Count; ++gamepadIndex) { tnUIGamepad gamepad = m_Gamepads[gamepadIndex]; if (gamepad != null) { cancel |= gamepad.GetCancelButton(); } } // Check phones for (int phoneIndex = 0; phoneIndex < m_Phones.Count; ++phoneIndex) { tnUIPhone phone = m_Phones[phoneIndex]; if (phone != null) { cancel |= phone.GetCancelButton(); } } if (cancel) { m_TriggerCancel.Invoke(); } }