private void ReturnToRoomAfterGameEnd() { foreach (var player in PhotonNetwork.CurrentRoom.Players) { int playerColourIndex = PlayerManager.PlayerColourIndex(player.Value); if (playerColourIndex == -1) { continue; } int playerID = PlayerManager.PlayerID(player.Value); if (playerID == -1) { continue; } BITCombo button = _buttons[playerColourIndex]; button.Select( playerID, player.Value.ActorNumber ); if (player.Value == PhotonNetwork.LocalPlayer) { _selectedButton = button; } } }
/// <summary> /// Called when the local player's room ID changes, if the player has a selected /// colour button (technically they should), then the button is updated to match /// the players new ID. /// </summary> /// <param name="id">The ID assigned to the local player</param> private void OnChangePlayerNumberID(int id) { if (_selectedButton != null) { _selectedButton.Select(id, PhotonNetwork.LocalPlayer.ActorNumber); } }
private void SelectButton(int index) { BITCombo button = _buttons[index]; // Somebody else has selected it, cannot select it if (button.ActorID != -1) { return; } // Unselect the previously selected button if (_selectedButton != null) { _selectedButton.Unselect(); } _selectedButton = button; _selectedButton.Select(PlayerManager.PlayerID(), PhotonNetwork.LocalPlayer.ActorNumber); Messenger <Color, int> .Broadcast("OnChangePlayerColour", button.Button.targetGraphic.color, index); }