// INTERNALS private void RefreshPlayers() { m_Players.Clear(); m_WifiPlayers.Clear(); InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule == null) { return; } for (int playerIndex = 0; playerIndex < inputModule.playersCount; ++playerIndex) { PlayerInput playerInput = inputModule.GetPlayerInput(playerIndex); m_Players.Add(playerInput); } if (m_UseWifi) { for (int playerIndex = 0; playerIndex < inputModule.wifiPlayersCount; ++playerIndex) { WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(playerIndex); m_WifiPlayers.Add(playerInput); } } }
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; } }
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; } }
void OnEnable() { // Update players list from InputModule. { m_Players.Clear(); InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule != null) { for (int playerIndex = 0; playerIndex < inputModule.playersCount; ++playerIndex) { PlayerInput playerInput = inputModule.GetPlayerInput(playerIndex); m_Players.Add(playerInput); } } } // Update wifi players list from InputModule. { m_WiFiPlayers.Clear(); InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule != null) { for (int playerIndex = 0; playerIndex < inputModule.wifiPlayersCount; ++playerIndex) { WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(playerIndex); m_WiFiPlayers.Add(playerInput); } } } // Clear slots. { for (int entryIndex = 0; entryIndex < m_Entries.Count; ++entryIndex) { tnUICreditsEntry entry = m_Entries[entryIndex]; entry.SetHighlighted(false); } } // Clear portrait. { if (m_Portrait != null) { m_Portrait.Clear(); } } // Find first available entry. GameObject firstEntry = null; { for (int entryIndex = 0; entryIndex < m_Entries.Count; ++entryIndex) { tnUICreditsEntry creditsEntry = m_Entries[entryIndex]; if (creditsEntry != null) { firstEntry = creditsEntry.gameObject; } } } // Update selection. { Select(firstEntry); } }