Beispiel #1
0
    /// <summary>
    /// 登陆到游戏服务器
    /// </summary>
    private void LoginToGameServer()
    {
        GamePatternLoginRequest req = new GamePatternLoginRequest();

        req.token = PlayerModel.Inst.Token;
        NetProcess.SendRequest <GamePatternLoginRequest>(req, MJProtoMap.CMD_Login, (msg) =>
        {
            GamePatternLoginResponse data    = msg.Read <GamePatternLoginResponse>();
            GamePatternModel.Inst.mCurGameId = (eGameType)data.gameType;
            if (data.code == 1)
            {
#if GPS
                SixqinSDKManager.Inst.SendMsg(SixqinSDKManager.GET_LOCATION, 600000);
#endif
                if (string.IsNullOrEmpty(data.roomId))                 //不在游戏中
                {
                    if ((eGameType)data.gameType == eGameType.MaJiang) //如果是在麻将的回放中就不处理
                    {
                        if (BaseView.ContainsView <MJGameBackUI>())
                        {
                            return;
                        }
                    }
                    SendGetRoomList();
                }
                else//在游戏中
                {
                    switch ((eGameType)data.gameType)
                    {
                    case eGameType.MaJiang:
                        Global.Inst.GetController <MJGameController>().SendJoinRoom(data.roomId);
                        break;

                    case eGameType.NiuNiu:
                        Global.Inst.GetController <NNGameController>().SendJoinRoomReq(data.roomId);
                        break;

                    case eGameType.GoldFlower:
                        Global.Inst.GetController <XXGoldFlowerGameController>().SendJoinRoomReq(data.roomId);
                        break;

                    case eGameType.TenHalf:
                        Global.Inst.GetController <TenGameController>().SendJoinRoomReq(data.roomId);
                        break;
                    }
                }
            }
            else
            {
                Global.Inst.GetController <MainController>().BackToMain();
                GameUtils.ShowErrorTips(data.code);
            }
        });
    }
Beispiel #2
0
 void OnApplicationPause(bool b)
 {
     if (!b)//唤醒
     {
         SQDebug.Log("程序获得焦点");
         if (!NetProcess.IsCurExistConnected() && !BaseView.ContainsView <LoginView>())//当前有链接但是已断开,重连
         {
             SQDebug.Log("application focus");
             ShowNetTips();
         }
     }
 }