private void SetupLogger()
 {
     //Telepathy.Logger.Log = Logger.Log;
     Telepathy.Logger.Log        = msg => Logger.Log("[Telepathy] " + msg);
     Telepathy.Logger.LogWarning = msg => Logger.Warn("[Telepathy] " + msg);
     Telepathy.Logger.LogError   = msg => Logger.Error("[Telepathy] " + msg);
 }
 private void Awake()
 {
     if (ClientNetManagerUnity.Instance == null)
     {
         Logger.Error("Cannot awaken a ClientBehaviour before the ClientNetManager! Try changing your script execution order.");
     }
     ClientNetManagerUnity.Instance.ListenForPackets(OnReceivePacket);
 }
 /// <summary>
 /// Stop the server & disconnect all clients
 /// </summary>
 public bool StopServer()
 {
     if (_server == null)
     {
         Logger.Error("Cannot stop the server as it was never started!");
         return(false);
     }
     return(_server.Stop());
 }
Exemple #4
0
        public bool DisconnectClient()
        {
            if (_client == null)
            {
                Logger.Error("Cannot disconnect the client before initialization!");
                return(false);
            }

            return(_client.Disconnect());
        }
        bool IServerTransportLayer.Start(int port)
        {
            if (_server == null)
            {
                Logger.Warn("Server transport was never initialized and thus can't be started.");
                return(false);
            }

            return(_server.Start(port));
        }
        bool IClientTransportLayer.Connect(string address, int port)
        {
            if (_client == null)
            {
                Logger.Warn("Client transport was never initialized and thus can't connect.");
                return(false);
            }

            _client.Connect(address, port);
            return(_client.Connected || _client.Connecting);
        }
Exemple #7
0
        private void Awake()
        {
            Instance = this;

            Logger.SetLogMethod(Debug.Log);
            Logger.SetWarnMethod(Debug.LogWarning);
            Logger.SetErrorMethod(Debug.LogError);

            if (startOnAwake)
            {
                ConnectClient(serverAddress);
            }
        }
        private void Awake()
        {
            Instance = this;

            Logger.SetLogMethod(Debug.Log);
            Logger.SetWarnMethod(Debug.LogWarning);
            Logger.SetErrorMethod(Debug.LogError);

            if (startOnAwake)
            {
                StartServer();
            }
        }