Esempio n. 1
0
 public void OnSpawn(KCPServer server, EndPoint remoteEndPoint, long connectTime)
 {
     this._server         = server;
     this._active         = true;
     this._remoteEndPoint = remoteEndPoint;
     this._activeTime     = connectTime;
 }
Esempio n. 2
0
 public void OnDespawn()
 {
     if (!this._active)
     {
         return;
     }
     this._active         = false;
     this.disconnectEvent = null;
     this._kcpProxy.Clear();
     this._server = null;
 }
Esempio n. 3
0
        public static void CreateServer(string name, PType type, int maxClient)
        {
            if (SERVERS.ContainsKey(name))
            {
                Logger.Warn($"Server [{name}] already exist");
                return;
            }
            INetServer server = null;

            switch (type)
            {
            case PType.Tcp:
                server = new TCPServer(maxClient);
                break;

            case PType.Kcp:
                server = new KCPServer(maxClient);
                break;
            }
            SERVERS[name] = server;
        }