Example #1
0
        private static void OnGameConnect(Session session, PacketReader packet)
        {
            session.IsClient = true;
            string tag  = packet.ReadUnicode(20);
            string pwd  = Password.GetPwd(tag);
            string name = Password.OnlyName(tag);

            session.Name = name;
            if (!Login(name, pwd))
            {
                session.LobbyError("Login fail");
                return;
            }
            session.CreateToken(session.Name, Password.GetPwd(tag));
            session.Server.SendToken(session.Name, session.Token);
            if (session.ip != null)
            {
                lock (session.Server.GameCliens)
                {
                    if (!session.Server.GameCliens.ContainsKey(session.ip))
                    {
                        session.Server.GameCliens.Add(session.ip, session);
                    }
                }
            }
        }
Example #2
0
        private static void On302(Session session, PacketReader packet)
        {
            session.LobbyError("This is the chat room port");
            DuelServer srv = session.Server.GetMinServer();

            session.SendMessage("It's chat ports and say a Word, and all chats。");
            session.SendMessage("Your short passwords are:" + session.Token + " (User name:" + session.Name + "$" + session.Token + ")");
            if (srv != null && srv.Port > 0)
            {
                session.SendMessage("Recommended game port:" + srv.Port);
            }
            List <int> ports = session.Server.GetAllPorts();
            string     msg   = "All the game port:";

            foreach (int p in ports)
            {
                msg += p + ",";
            }
            session.SendMessage(msg);
            //  session.Close();
        }
Example #3
0
		private static void On302(Session session, PacketReader packet)
		{
			session.LobbyError("这是聊天室端口");
			DuelServer srv = session.Server.GetMinServer();
			session.SendMessage("这是聊天端口,随便说一句话即可和所有人聊天。");
			session.SendMessage("你的短密码是:"+session.Token+" (用户名:"+session.Name+"$"+session.Token+")");
			if (srv != null && srv.Port > 0)
			{
				session.SendMessage("推荐对战端口:" + srv.Port);
			}
			List<int> ports = session.Server.GetAllPorts();
			string msg = "所有对战端口:";
			foreach (int p in ports)
			{
				msg += p + ",";
			}
			session.SendMessage(msg);
			//  session.Close();
		}
Example #4
0
		private static void OnGameConnect(Session session, PacketReader packet)
		{
			session.IsClient = true;
			string tag = packet.ReadUnicode(20);
			string pwd = Password.GetPwd(tag);
			string name= Password.OnlyName(tag);
			session.Name =name;
			if(!Login(name, pwd)){
				session.LobbyError("Login fail");
				return;
			}
			session.CreateToken(session.Name, Password.GetPwd(tag));
			session.Server.SendToken(session.Name, session.Token);
			if (session.ip != null)
			{
				lock (session.Server.GameCliens)
				{
					if (!session.Server.GameCliens.ContainsKey(session.ip))
					{
						session.Server.GameCliens.Add(session.ip, session);
					}
				}
			}
		}