public override void OnStartHost() { base.OnStartHost(); SwitchPanel(LobbyPanel); ColorsInUse.Clear(); }
public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo) { base.OnMatchCreate(success, extendedInfo, matchInfo); CurrentMatchInfo = matchInfo; ColorsInUse.Clear(); }
//[Command] //public static void CmdClientReadyToggle(uint connectionID, bool setReady) //{ // //toggle ready state of a client // if (setReady) // NetworkServer.SetClientReady(NetworkServer.connections[connectionID]); // else // NetworkServer.SetClientNotReady(NetworkServer.connections[connectionID]); //} public Color FirstAvailablePlayerColor() { foreach (var color in Colors) { if (ColorsInUse.Contains(color)) { continue; } return(color); } return(Color.white); }
public void UpdateAvailableColors(LobbyPlayer player, Color color) { if (!ColorsInUse.Remove(player.PlayerColor) && player.PlayerColor != Color.white) { Debug.LogError("Tried to make a color available that was already available." + player.PlayerColor.GetName()); } if (ColorsInUse.Contains(color)) { Debug.LogError("Tried to make an unavailable color unavailable..." + color.GetName()); } else { ColorsInUse.Add(color); } }
//leave lobby and return to multiplayer screen public void LeaveLobby() { if (CurrentlyMatchmaking) { if (matchMaker != null) { matchMaker.DestroyMatch(CurrentMatchInfo.networkId, 0, OnDestroyMatch); } StopHost(); ColorsInUse.Clear(); } else if (NetworkServer.active) { StopHost(); } else { StopClient(); } SwitchPanel(MultiplayerPanel); }