예제 #1
0
        public override async Task RunImpl()
        {
            await Task.Run(() =>
            {
                L2Server server = LoginServer.ServiceProvider.GetService <ServerThreadPool>().Servers.FirstOrDefault(srv => srv.Code == _code);

                if (server == null)
                {
                    Log.Error($"Code '{_code}' for server was not found. Closing");
                    _thread.Close(ServerLoginFail.ToPacket("Code Error"));
                    return;
                }

                server.Thread     = _thread;
                _thread.Id        = server.Id;
                _thread.Info      = _info;
                _thread.Wan       = _host;
                _thread.Port      = _port;
                _thread.Maxp      = _maxp;
                _thread.GmOnly    = _gmonly == 1;
                _thread.TestMode  = _test == 1;
                _thread.Connected = true;
                _thread.Send(ServerLoginOk.ToPacket());

                Log.Info($"Server #{server.Id} connected");
            });
        }
예제 #2
0
        public override async Task RunImpl()
        {
            L2Server server = LoginServer.ServiceProvider.GetService <ServerThreadPool>()
                              .Servers.FirstOrDefault(x => x.ServerKey == _serverKey);

            if (server == null)
            {
                Log.Error($"Server with id '{_serverKey}' was not found. Closing");
                _thread.Close(ServerLoginFail.ToPacket("ServerId Error"));
                return;
            }

            server.Thread      = _thread;
            _thread.ServerId   = server.ServerId;
            _thread.Info       = _info;
            _thread.Wan        = _host;
            _thread.Port       = _port;
            _thread.MaxPlayers = _maxPlayers;
            _thread.GmOnly     = _gmonly == 1;
            _thread.TestMode   = _test == 1;
            _thread.Connected  = true;
            _thread.Send(ServerLoginOk.ToPacket());

            Log.Info($"Server #{server.ServerId} connected");
        }
예제 #3
0
    private IEnumerator delaySend()
    {
        isSend = false;
        yield return(new WaitForSeconds(0.01f));       //延遲1秒後才發送

        st.Send("Hello~ My name is Server");
        isSend = true;
    }
예제 #4
0
    private IEnumerator delaySend()
    {
        isSend = false;
        // yield return new WaitForSeconds(1);//延遲1秒後才發送
        yield return(new WaitForSeconds(0.1F));//延遲1秒後才發送

        // st.Send("Hello~ My name is Server");

        // Ting
        string sendmes = JsonUtility.ToJson(PlayerParam.Server);

        // string sendmes = JsonUtility.ToJson(ss);
        st.Send(sendmes);

        PlayerParam.Server.Ball_Force_UpdateSt = false;
        PlayerParam.Server.Ball_Force_X        = 0;
        PlayerParam.Server.Ball_Force_Y        = 0;
        PlayerParam.Server.Ball_Velocity_X     = 0;
        PlayerParam.Server.Ball_Velocity_Y     = 0;


        isSend = true;
    }
예제 #5
0
        public override void RunImpl()
        {
            L2Server server = ServerThreadPool.Instance.Servers.FirstOrDefault(srv => srv.Code == _code);

            if (server == null)
            {
                Log.Error($"Code '{_code}' for server was not found. Closing");
                _thread.Close(ServerLoginFail.ToPacket("Code Error"));
                return;
            }

            server.Thread     = _thread;
            _thread.Id        = server.Id;
            _thread.Info      = _info;
            _thread.Wan       = _host;
            _thread.Port      = _port;
            _thread.Maxp      = _maxp;
            _thread.GmOnly    = _gmonly == 1;
            _thread.TestMode  = _test == 1;
            _thread.Connected = true;
            _thread.Send(ServerLoginOk.ToPacket());

            Log.Info($"AuthThread: Server #{server.Id} connected");
        }
예제 #6
0
 public override void RunImpl()
 {
     _thread.Send(LoginServPing.ToPacket());
 }
예제 #7
0
 public override async Task RunImpl()
 {
     await Task.Run(() => _thread.Send(LoginServPing.ToPacket()));
 }
예제 #8
0
 public override async Task RunImpl()
 {
     _thread.Send(LoginServPing.ToPacket(_randomKey));
 }
예제 #9
0
 public void Send(string message)
 {
     st.Send(message);
 }