/// <summary> /// Load settings. /// </summary> public static void Load() { DebugEx.Verbose("Settings.Load()"); sInternalMode = (PlayerPrefs.GetString(KEY_INTERNAL_MODE, "False").ToLower() == "true"); DebugEx.Debug("Settings loaded:"); DebugEx.DebugFormat(" * sInternalMode = {0}", sInternalMode); }
/// <summary> /// Handler for event on disconnection. /// </summary> /// <param name="script">Script.</param> /// <param name="error">Error.</param> public override void OnDisconnectedFromServer(ClientScript script, byte error) { DebugEx.VerboseFormat("ClientScript.DisconnectedState.OnDisconnectedFromServer(script = {0}, error = {1}({2}))", script, (NetworkError)error, error); if (error == (byte)NetworkError.Ok) { DebugEx.Debug("Successfully disconnected from the server"); } else { DebugEx.ErrorFormat("Failed to disconnect from the server, error: {0}", error); } }
/// <summary> /// Starts the server. /// </summary> public static void Start() { DebugEx.Verbose("Server.Start()"); if (sHostId == -1) { sHostId = NetworkTransport.AddHost(sTopology, CommonConstants.SERVER_PORT); DebugEx.Debug("Server started"); } else { DebugEx.Error("Server already started"); } }
/// <summary> /// Stops the server. /// </summary> public static void Stop() { DebugEx.Verbose("Server.Stop()"); if (sHostId != -1) { NetworkTransport.RemoveHost(sHostId); sHostId = -1; DebugEx.Debug("Server stopped"); } else { DebugEx.Error("Server already stopped"); } }