Esempio n. 1
0
 public static void Logout(UserSocketState sock)
 {
     if (sock.Map != null && sock.PlayerContext != null)
     {
         sock.Map.QuitMap(sock.PlayerContext);
         ForgetiveServer.Close(sock, "客户端无响应");
         sock.Close();
     }
 }
Esempio n. 2
0
 public static void JoinMap(UserSocketState player, string mapName)
 {
     for (int i = 0; i < Maps.Count; i++)
     {
         if (Maps[i].MapName == mapName)
         {
             player.Map = Maps[i];
             Maps[i].JoinMap(player);
         }
     }
 }
Esempio n. 3
0
        public static ServerResult LogDevice(string machine)
        {
            ServerResult ret = new ServerResult(false, "");
            string       key = key_device.GetFirstXWithY(machine);

            if (key == null)
            {
                ret.IsSuccess = false;
                ret.Note      = "nomac";
            }
            else if (key_banned.GetFirstYWithX(key) == "{notbanned}")
            {
                for (int i = 0; i < ForgetiveServer.Users.Count; i++)
                {
                    UserSocketState sock = ForgetiveServer.Users[i];
                    if (sock == null)
                    {
                        ForgetiveServer.Users.RemoveAt(i);
                        i--;
                        continue;
                    }
                    if (sock.UsedKey == key)
                    {
                        ForgetiveServer.Close(sock, null, false);
                        ForgetiveServer.Users.RemoveAt(i);
                        i--;
                        continue;
                    }
                }
                ret.IsSuccess  = true;
                ret.InternalEx = key;
                ret.Note       = ForgetiveServer.Base64Encode(key_nick.GetFirstYWithX(key));
                Logger.WriteLine("设备ID:{0}已登陆密匙:{1}", machine, key);
            }
            else
            {
                ret.IsSuccess = false;
                ret.Note      = "banned";
            }
            return(ret);
        }