Exemple #1
0
        protected override void Run(WebPlayer webpy, JObject message)
        {
            var get_RankStar_Res = new  Get_RankStar_Res();

            get_RankStar_Res.IRank = (int)GameMainEntry.Instance.LeaderboardModule.GetRankStar_Index(webpy.Id);
            get_RankStar_Res.Ls_Leaderboard_User = GameMainEntry.Instance.LeaderboardModule.Leaderboard_Stars;
            var bys = Msg_Json.Create_Msg_Json(NetOpCode.Get_RankStar_Res, get_RankStar_Res);

            webpy.SendAsync(bys);
        }
Exemple #2
0
        protected override void Run(IWebSocketSession session, JObject message)
        {
            var bys = Msg_Json.Create_Msg_Json(NetOpCode.Ping_Msg, message);

            session.Context.WebSocket.Send(bys);

            var py = GameMainEntry.Instance.PlayerModule.Session_Pys.GetValueByKey(session.ID);

            if (py != null)
            {
                py.LastActiveTime = DateTime.Now;
            }
        }
Exemple #3
0
        protected override void Run(IWebSocketSession session, JObject message)
        {
            var login_req = message.ToObject <Login_Req>();
            var py        = GameMainEntry.Instance.PlayerModule.GetPlayer(login_req.Id);

            if (py == null)
            {
                py = GameMainEntry.Instance.PlayerModule.CreatePlayer(login_req.Id);
            }
            Log.Debug($"Py{py.Id}:登录成功");
            GameMainEntry.Instance.PlayerModule.SetSession_Py(py, session);
            py.SendAsync(Msg_Json.Create_Msg_Json(NetOpCode.Login_Res, new Login_Res {
                Res = 1
            }));
        }
Exemple #4
0
 protected override void Run(IWebSocketSession session, JObject message)
 {
     Task.Factory.StartNew(() =>
     {
         var login_req  = message.ToObject <WeChat_Login_Req>();
         var str_requst = WeChatHelper.GetLogin(login_req.Code);
         Log.Debug("Requst:" + str_requst);
         var res   = HttpHelper.CreateHttp(str_requst);
         var jsres = JObject.Parse(res);
         //jsres[""]
         //Log.Debug("res:"+res);
         WeChat_Login_Res weChat_Login_Res = new WeChat_Login_Res();
         weChat_Login_Res.Id = jsres["openid"].Value <string>();
         var bys             = Msg_Json.Create_Msg_Json(NetOpCode.WeChat_Login_Res, weChat_Login_Res);
         session.Context.WebSocket.Send(bys);
     });
 }
Exemple #5
0
        protected virtual void SendReLogin(IWebSocketSession session)
        {
            var bys = Msg_Json.Create_Msg_Json <NeedLogin_Msg>(NetOpCode.NeedLogin_Msg, new NeedLogin_Msg());

            session.Context.WebSocket.Send(bys);
        }
        protected override void Run(WebPlayer webpy, JObject message)
        {
            var bys = Msg_Json.Create_Msg_Json(NetOpCode.Get_UserData_Res, webpy.User_Data);

            webpy.SendAsync(bys);
        }