public void OnClientConnectionRefused(NFTCPEventParams eventParams)
        {
            Debug.Log("Client refused");
            client.net.mxListener.Log("Client refused");

            client = null;
        }
Exemplo n.º 2
0
        public void OnClientConnectionRefused(NFTCPEventParams eventParams)
        {
            Debug.Log("Client refused");
            client.net.mxListener.Log("Client refused");

            client = null;
        }
Exemplo n.º 3
0
        public void OnClientDisconnect(NFTCPEventParams eventParams)
        {
            if (client.IsConnected())
            {
                client.Disconnect();
            }
            client.net.mPlayerState = NFNet.PLAYER_STATE.E_DISCOUNT;

            Debug.Log("Client disconnected");
        }
        public void OnClientDisconnect(NFTCPEventParams eventParams)
        {
            if(client.IsConnected())
            {
                client.Disconnect();
            }
            client.net.mPlayerState = NFNet.PLAYER_STATE.E_DISCOUNT;

            Debug.Log("Client disconnected");
        }
Exemplo n.º 5
0
        public void OnDataReceived(NFTCPEventParams eventParams)
        {
            byte[] bytes      = eventParams.packet.bytes;
            int    bytesCount = eventParams.packet.bytesCount;

            client.net.mxListener.Log("OnDataReceived:" + mnPacketSize + "|" + bytesCount);

            if (mnPacketSize + bytesCount < ConstDefine.MAX_PACKET_LEN)
            {
                Array.Copy(bytes, 0, mPacket, mnPacketSize, bytesCount);
                mnPacketSize += (UInt32)bytesCount;

                OnDataReceived();
            }
        }
        public void OnDataReceived(NFTCPEventParams eventParams)
        {
            byte[] bytes = eventParams.packet.bytes;
            int bytesCount = eventParams.packet.bytesCount;

            client.net.mxListener.Log("OnDataReceived:" + mnPacketSize + "|" + bytesCount);

            if (mnPacketSize + bytesCount < ConstDefine.MAX_PACKET_LEN)
            {
                Array.Copy(bytes, 0, mPacket, mnPacketSize, bytesCount);
                mnPacketSize += (UInt32)bytesCount;

                OnDataReceived();
            }
        }
Exemplo n.º 7
0
        public void Update()
        {
            while (mxEvents.Count > 0)
            {
                lock (mxEvents)
                {
                    NFTCPEventType eventType = mxEvents.Dequeue();

                    NFTCPEventParams eventParams = new NFTCPEventParams();
                    eventParams.eventType = eventType;
                    eventParams.client    = this;
                    eventParams.socket    = mxClient;

                    if (eventType == NFTCPEventType.Connected)
                    {
                        binListener.OnClientConnect(eventParams);
                    }
                    else if (eventType == NFTCPEventType.Disconnected)
                    {
                        binListener.OnClientDisconnect(eventParams);

                        mxReader.Close();
                        mxWriter.Close();
                        mxClient.Close();
                    }
                    else if (eventType == NFTCPEventType.DataReceived)
                    {
                        lock (mxPackets)
                        {
                            eventParams.packet = mxPackets.Dequeue();

                            binListener.OnDataReceived(eventParams);
                        }
                    }
                    else if (eventType == NFTCPEventType.ConnectionRefused)
                    {
                    }
                }
            }
        }
Exemplo n.º 8
0
 public void OnClientConnect(NFTCPEventParams eventParams)
 {
     Debug.Log("Client connected");
     client.net.mPlayerState = NFNet.PLAYER_STATE.E_WAITING_PLAYER_LOGIN;
 }
 public void OnClientConnect(NFTCPEventParams eventParams)
 {
     Debug.Log("Client connected");
     client.net.mPlayerState = NFNet.PLAYER_STATE.E_WAITING_PLAYER_LOGIN;
 }
Exemplo n.º 10
0
        public void Update()
        {
            while (mxEvents.Count > 0)
            {
                lock (mxEvents)
                {
                    NFTCPEventType eventType = mxEvents.Dequeue();

                    NFTCPEventParams eventParams = new NFTCPEventParams();
                    eventParams.eventType = eventType;
                    eventParams.client = this;
                    eventParams.socket = mxClient;

                    if (eventType == NFTCPEventType.Connected)
                    {
                        binListener.OnClientConnect(eventParams);
                    }
                    else if (eventType == NFTCPEventType.Disconnected)
                    {
                        binListener.OnClientDisconnect(eventParams);

                        mxReader.Close();
                        mxWriter.Close();
                        mxClient.Close();

                    }
                    else if (eventType == NFTCPEventType.DataReceived)
                    {
                        lock (mxPackets)
                        {
                            eventParams.packet = mxPackets.Dequeue();

                            binListener.OnDataReceived(eventParams);
                        }
                    }
                    else if (eventType == NFTCPEventType.ConnectionRefused)
                    {

                    }
                }
            }
        }