public static void UpdateZeusData() { if (!BoltNetwork.isServer) throw new System.Exception("Attempted to update zeus data on a client!"); ServerInfoToken token = new ServerInfoToken(); token.IsDedicatedServer = IsDedicated; token.GameMode = GameManager.instance.gameMode.GameModeName; token.MapName = "TEMP_NULL"; token.MaxPlayerCount = (byte)GameManager.instance.gameMode.MaxPlayers; token.PlayerCount = (byte)GameManager.instance.Lobby.PlayerCount; token.MOTD = MOTD; token.PasswordRequired = !string.IsNullOrEmpty(Password); token.ServerName = ServerName; GameManager.GameState state = GameManager.instance.CurrentGameState; token.HideInServerList = state == GameManager.GameState.LOBBY || state == GameManager.GameState.POST_GAME; BoltNetwork.SetHostInfo(ServerName, token); }
public static void UpdateZeusData() { if (!BoltNetwork.isServer) { throw new System.Exception("Attempted to update zeus data on a client!"); } ServerInfoToken token = new ServerInfoToken(); token.IsDedicatedServer = IsDedicated; token.GameMode = GameManager.instance.gameMode.GameModeName; token.MapName = "TEMP_NULL"; token.MaxPlayerCount = (byte)GameManager.instance.gameMode.MaxPlayers; token.PlayerCount = (byte)GameManager.instance.Lobby.PlayerCount; token.MOTD = MOTD; token.PasswordRequired = !string.IsNullOrEmpty(Password); token.ServerName = ServerName; GameManager.GameState state = GameManager.instance.CurrentGameState; token.HideInServerList = state == GameManager.GameState.LOBBY || state == GameManager.GameState.POST_GAME; BoltNetwork.SetHostInfo(ServerName, token); }
// Use this for initialization void Start() { if (session == null) { return; } token = (ServerInfoToken)session.GetProtocolToken(); button.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { if (token.PasswordRequired) { passwordPanel.Pop(session); } else { BoltNetwork.Connect(session, new ConnectionRequestData(GameManager.instance.CurrentUserName)); } })); serverNameText.text = token.ServerName; motdText.text = token.MOTD; string pct = token.PlayerCount + " Of " + token.MaxPlayerCount; if (token.PlayerCount >= token.MaxPlayerCount) { pct = "<color=red>" + pct + "</color>"; } playerCountText.text = pct; mapText.text = token.MapName; modeText.text = token.GameMode; dedicatedText.text = ""; if (token.IsDedicatedServer) { dedicatedText.text += "[Dedicated]"; } if (token.PasswordRequired) { dedicatedText.text += "[Password]"; } }
// Use this for initialization void Start() { if (session == null) return; token = (ServerInfoToken)session.GetProtocolToken(); button.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { if (token.PasswordRequired) { passwordPanel.Pop(session); } else { BoltNetwork.Connect(session, new ConnectionRequestData(GameManager.instance.CurrentUserName)); } })); serverNameText.text = token.ServerName; motdText.text = token.MOTD; string pct = token.PlayerCount + " Of " + token.MaxPlayerCount; if (token.PlayerCount >= token.MaxPlayerCount) pct = "<color=red>" + pct + "</color>"; playerCountText.text = pct; mapText.text = token.MapName; modeText.text = token.GameMode; dedicatedText.text = ""; if (token.IsDedicatedServer) dedicatedText.text += "[Dedicated]"; if (token.PasswordRequired) dedicatedText.text += "[Password]"; }