public void Check_ReceiveMessageCallBackEvent(byte command, string data, Socket _socket)
 {
     if (CheckIsOnLinePlayerMessage(_socket))
     {
         UnityPlayerOnClient player = unityPlayerOnClientList.Find(u => u.Socket == _socket);
         WeaveServerReceiveOnLineUnityPlayerMessageCallBackEvent(command, data, player);
     }
     else
     {
         WeaveOnLine onLine = weaveOnline.Find(w => w.Socket == _socket);
         WeaveServerReceiveSocketMessageCallBackEvent(command, data, onLine);
     }
 }
        public UnityPlayerOnClient ConvertWeaveOnlineToUnityPlayerOnClient(WeaveOnLine wonline)
        {
            UnityPlayerOnClient uplayer = new UnityPlayerOnClient()
            {
                Obj    = wonline.Obj,
                Socket = wonline.Socket,
                Token  = wonline.Token,
                Name   = wonline.Name
            };



            return(uplayer);
        }
        public void AddUnityPlayerClient_CheckSameItem(UnityPlayerOnClient item, string itemName)
        {
            System.Threading.Thread.Sleep(500);
            lock (this)
            {
                if (unityPlayerOnClientList.Find(i => i.Name == itemName) != null)
                {
                    return;
                }

                else
                {
                    unityPlayerOnClientList.Add(item);
                }
            }
        }
        private void OnUnityPlayerLoginOK(string _u, Socket _socket)
        {
            WeaveOnLine onLineSocket = weaveOnline.Find(w => w.Socket == _socket);

            // throw new NotImplementedException();
            UnityPlayerOnClient gamer = new UnityPlayerOnClient()
            {
                UserName = _u,
                isLogin  = true,
                Name     = onLineSocket.Name,
                Obj      = onLineSocket.Obj,
                Socket   = _socket,
                Token    = onLineSocket.Token
            };

            WeaveServerGetUnityPlayerOnLineCallBackEvent(gamer);
        }
        public bool CheckIsOnLinePlayerMessage(Socket _socket)
        {
            WeaveOnLine onLineSocket = weaveOnline.Find(w => w.Socket == _socket);

            if (unityPlayerOnClientList.Count == 0)
            {
                return(false);
            }
            else
            {
                UnityPlayerOnClient player = unityPlayerOnClientList.Find(u => u.Name == onLineSocket.Name);
                if (player != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public void CallWeaveServerGetUnityPlayerOffLineCallBackEvent(Socket _soc)
        {
            UnityPlayerOnClient unitygm = unityPlayerOnClientList.Find(p => p.Socket == _soc);

            WeaveServerGetUnityPlayerOffLineCallBackEvent(unitygm);
        }