Ejemplo n.º 1
0
    /// <summary>
    /// 断线重连
    /// </summary>
    public static IEnumerator G2C_Reconnect(DdzReconnectResp recontent)
    {
        //临时 true->正在打牌  false->正在准备阶段
        bool isFighting = recontent.stage != 0 && recontent.stage != 4;

        LandlordsModel.Instance.IsInFight = isFighting;
        OrderController.Instance.Clear();
        //房间信息
        if (recontent.yuePaiInfo != null)//房卡房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID       = recontent.yuePaiInfo.rno.ToString(),
                RoomType     = RoomType.RoomCard,
                Beishu       = recontent.yuePaiInfo.fs,
                LeastStore   = recontent.yuePaiInfo.ante,
                CostCard     = recontent.yuePaiInfo.ks,
                CurPlayCount = recontent.yuePaiInfo.currJs,
                MaxPlayCount = recontent.yuePaiInfo.js
            };
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = false;
        }
        else if (recontent.matchInfo != null)//比赛房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID = recontent.matchInfo.matcherid.ToString(),//比赛ID
                IsQdz  = recontent.matchInfo.isQdz
            };
            switch (recontent.matchInfo.type)
            {
            case 1:    // 比赛银币
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.SilverCoin;
                break;

            case 2:    //比赛金币
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.GoldBar;
                break;

            case 3:    //比赛积分

                break;

            default:
                break;
            }
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = true;
        }
        else//游戏币房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID     = recontent.roomId.ToString(),
                RoomType   = LandlordsRoomModel.GetYxbRoomTypeByID(recontent.roomId),
                LeastStore = int.Parse(LandlordsRoomModel.GetYxbRoomConfigById(recontent.roomId)["ante"].ToString())
            };
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = false;
        }


        //3个玩家信息
        if (LandlordsModel.Instance.RoomPlayerHands != null)
        {
            LandlordsModel.Instance.RoomPlayerHands.Clear();
        }
        bool isRoomCard = LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.RoomCard;

        for (int i = 0; i < recontent.ddzPlayerInfo.Count; i++)
        {
            DdzPlayerInfo playerInfo = recontent.ddzPlayerInfo[i];
            string        uid        = playerInfo.playerBaseInfo.userId.ToString();

            LandkirdsHandCardModel hand = LandlordsModel.Instance.CreateHandCardMode(uid, playerInfo.playerBaseInfo.gender == 0 ? Six.boy : Six.girl);
            hand.playerInfo.userNickname = playerInfo.playerBaseInfo.nickname;
            hand.playerInfo.icon         = playerInfo.playerBaseInfo.photo;
            if (LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.SilverCoin)
            {
                hand.playerInfo.money = playerInfo.playerBaseInfo.silver;
            }
            else if (LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.GoldBar)
            {
                hand.playerInfo.money = playerInfo.playerBaseInfo.gold;
            }
            hand.playerInfo.lv    = playerInfo.playerBaseInfo.level;
            hand.playerInfo.vip   = playerInfo.playerBaseInfo.vip;
            hand.playerInfo.win   = playerInfo.playerBaseInfo.won;
            hand.playerInfo.lose  = playerInfo.playerBaseInfo.lost;
            hand.playerInfo.ratio = (float)playerInfo.playerBaseInfo.rate;
            hand.playerInfo.pos   = playerInfo.playerBaseInfo.location;
            hand.playerInfo.exp   = playerInfo.playerBaseInfo.exp;
            //hand.playerInfo.isFriend = playerInfo.playerBaseInfo;
            hand.MatchScore = playerInfo.playerBaseInfo.currJiFen;
            if (i == 0 && isRoomCard)
            {
                hand.IsRoomer = true;
            }
            if (!hand.IsRoomer)
            {
                hand.IsZhunbei = playerInfo.playerBaseInfo.isPrepared;
            }

            hand.isTuoguan = playerInfo.tg == 1;
        }

        if (isFighting)
        {
            FightReconect(recontent);
        }
        else
        {
            NormalReconect();
        }
        yield return(new WaitForSecondsRealtime(2));

        UserInfoModel.userInfo.inDzz = false;
    }
Ejemplo n.º 2
0
    //public static EnterDdzRoomResp _resp;
    /// <summary>
    /// 有人进入房间应答
    /// </summary>
    /// <param name="resp"></param>
    public static void G2C_EnterRoom(EnterDdzRoomResp resp)
    {
        //_resp = resp;
        if (LandlordsModel.Instance.IsInFight)
        {
            return;
        }
        //房间信息
        if (resp.yuePaiInfo != null)//房卡房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID       = resp.yuePaiInfo.rno.ToString(),
                RoomType     = RoomType.RoomCard,
                Beishu       = resp.yuePaiInfo.fs,
                LeastStore   = resp.yuePaiInfo.ante,
                CostCard     = resp.yuePaiInfo.ks,
                CurPlayCount = resp.yuePaiInfo.currJs,
                MaxPlayCount = resp.yuePaiInfo.js
            };
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = false;
        }
        else if (resp.matchInfo != null)//比赛房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID = resp.matchInfo.matcherid.ToString(),//比赛ID
                IsQdz  = resp.matchInfo.isQdz
            };
            switch (resp.matchInfo.type)
            {
            case 1:    // 比赛银币
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.SilverCoin;
                break;

            case 2:    //比赛金币
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.GoldBar;
                break;

            case 3:    //比赛积分
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.Match;
                break;
            }
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = true;
        }
        else//游戏币房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID     = resp.roomId.ToString(),
                RoomType   = LandlordsRoomModel.GetYxbRoomTypeByID(resp.roomId),
                LeastStore = int.Parse(LandlordsRoomModel.GetYxbRoomConfigById(resp.roomId)["ante"].ToString())
            };
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = false;
        }
        bool isRoomCard = LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.RoomCard;

        //3个玩家信息
        if (LandlordsModel.Instance.RoomPlayerHands != null)
        {
            LandlordsModel.Instance.RoomPlayerHands.Clear();
        }
        for (int i = 0; i < resp.playerBaseInfo.Count; i++)
        {
            PlayerBaseInfo playerInfo = resp.playerBaseInfo[i]; Debug.LogWarning("有玩家进入:" + playerInfo.nickname);
            string         uid        = playerInfo.userId.ToString();

            LandkirdsHandCardModel hand = LandlordsModel.Instance.CreateHandCardMode(uid, playerInfo.gender == 0 ? Six.boy : Six.girl);
            hand.playerInfo.userNickname = playerInfo.nickname;
            hand.playerInfo.icon         = playerInfo.photo;
            if (LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.SilverCoin)
            {
                hand.playerInfo.money = playerInfo.silver;
            }
            else if (LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.GoldBar)
            {
                hand.playerInfo.money = playerInfo.gold;
            }
            hand.playerInfo.lv    = playerInfo.level;
            hand.playerInfo.vip   = playerInfo.vip;
            hand.playerInfo.win   = playerInfo.won;
            hand.playerInfo.lose  = playerInfo.lost;
            hand.playerInfo.ratio = (float)playerInfo.rate;
            hand.playerInfo.pos   = playerInfo.location;
            hand.playerInfo.exp   = playerInfo.exp;
            //hand.playerInfo.isFriend = playerInfo.isFriend;
            hand.MatchScore = playerInfo.currJiFen;
            if (i == 0 && isRoomCard)
            {
                hand.IsRoomer = true;
            }
            if (!hand.IsRoomer)
            {
                hand.IsZhunbei = playerInfo.isPrepared;
            }
        }
        if (resp.playerBaseInfo[resp.playerBaseInfo.Count - 1].userId == UserInfoModel.userInfo.userId)//如果当前进来的是自己
        {
            LandlordsPage page = LandlordsPage.Instance;
            if (page == null)
            {
                page = PageManager.Instance.OpenPage <LandlordsPage>();
            }
            if (!LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch && resp.playerBaseInfo[0].userId == UserInfoModel.userInfo.userId && LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.RoomCard)//如果自己是房主并且是房卡房
            {
                LandlordsModel.Instance.MyInfo.IsRoomer = true;
                NodeManager.OpenNode <InvateNode>().Inits(LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomID);
            }
            page.InitRoom();
        }
        else
        {
            LandlordsModel.Instance.RoomPlayerSort();
            LandlordsPage.Instance.playView.InitPlayerPrefab();
        }
        if (LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch)
        {
            BisaiInfoReq();
        }
    }