Пример #1
0
        public void SetSeat(JY_SEAT prSeat)
        {
            if (prSeat.hasPlayerId())
            {
                PlayerId = prSeat.playerId;                      //ID
            }
            if (prSeat.hasNickname())
            {
                Nickname = prSeat.nickname;                      //昵称
            }
            if (prSeat.hasAvatar())
            {
                Avatar = prSeat.avatar;                     //头像
            }
            if (prSeat.hasGender())
            {
                Gender = prSeat.gender;                    //性别
            }
            if (prSeat.hasIsBanker())
            {
                IsBanker = prSeat.isBanker;                      //庄
            }
            //if (prSeat.hasIsWiner()) Winner = prSeat.isWiner;//是否是胜利者
            //if (prSeat.has()) IsOwner = prSeat.isOwner;//是否是房主
            if (prSeat.hasPos())
            {
                Pos = prSeat.pos;                 //位置(服务器)
            }
            if (prSeat.hasGold())
            {
                Gold = prSeat.gold;                  //金币
            }
            if (prSeat.hasPour())
            {
                Pour = prSeat.pour;                  //下注分
            }
            if (prSeat.hasStatus())
            {
                seatStatus = prSeat.status;                    //座位状态
            }
            if (prSeat.hasEarnings())
            {
                Earnings = prSeat.earnings;                      //本次收益
            }
            if (prSeat.hasLoopEarnings())
            {
                loopEarnings = prSeat.loopEarnings;                          //本局收益
            }
            //if (prSeat.hasLoopEarnings()) LoopEarnings = prSeat.loopEarnings;//-------------------------------------------本局收益
            //if (prSeat.hasTotalEarnings()) TotalEarnings = prSeat.totalEarnings;//总收益(已有筹码)
            if (prSeat.hasIsDismiss())
            {
                isDismiss = prSeat.isDismiss;                       //是否同意解散
            }
            //if (prSeat.has()) isOnLine = prSeat.;//是否在线
            if (prSeat.hasIsReady())
            {
                isReady = prSeat.isReady;                     //是否同意解散
            }
            if (prSeat.hasIsJoinGame())
            {
                isJoinGame = prSeat.isJoinGame;                        //是否参加过游戏
            }
            //具体手牌
            List <JY_POKER> prPokerList = prSeat.getPokerListList();

            if (prPokerList != null && prPokerList.Count > 0)
            {
                for (int j = 0; j < prPokerList.Count; j++)
                {
                    if (PokerList.Count <= j)
                    {
                        break;
                    }

                    if (prPokerList[j] != null && prPokerList[j].hasIndex() && prPokerList[j].index != 0)
                    {
                        //手牌是否有这张牌
                        if (PokerList[j] != null)
                        {
                            PokerList[j].SetPoker(prPokerList[j]);
                        }
                    }
                }
            }


            //已经出过的牌
            if (prSeat.hasHistoryPokerList())
            {
                List <JY_POKER> prTablePokerList = prSeat.getHistoryPokerListList();

                //int countGap = prTablePokerList.Count - TablePokerList.Count;
                //if (countGap > 0)
                //{
                //    for (int i = 0; i < countGap; i++)
                //    {
                //        TablePokerList.Add(new Poker());
                //    }

                //}
                //for (int j = 0; j < prTablePokerList.Count; j++)
                //{
                //    //打过的是否有这张牌
                //    if (TablePokerList[j] != null) TablePokerList[j].SetPoker(prTablePokerList[j]);
                //}

                if (prTablePokerList != null && prTablePokerList.Count > 0)
                {
                    for (int j = 0; j < prTablePokerList.Count; j++)
                    {
                        if (prTablePokerList[j] != null)
                        {
                            if (TablePokerList.Count < (j + 1))
                            {
                                AppDebug.Log(string.Format("添加已出过的牌:index{0} ,size{1},type{2}", prTablePokerList[j].index, prTablePokerList[j].size, prTablePokerList[j].type));
                                TablePokerList.Add(new Poker());
                            }

                            //打过的是否有这张牌
                            if (TablePokerList[j] != null)
                            {
                                TablePokerList[j].SetPoker(prTablePokerList[j]);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 初始化房间
        /// </summary>
        /// <param name="prRoom"></param>
        public void InitRoom(JY_ROOM prRoom)
        {
            //RoomMaJiangProxy.Instance

            CurrentRoom = new RoomEntity()
            {
                currentLoop = prRoom.loop,
                maxLoop     = prRoom.maxLoop,
                roomId      = prRoom.roomId,
                //matchId = prRoom.matchId,
                roomStatus = prRoom.status,
                baseScore  = prRoom.baseScore,
            };

            //房间配置
            CurrentRoom.Config.Clear();
            for (int i = 0; i < prRoom.settingIdCount(); ++i)
            {
                cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(prRoom.getSettingId(i));
                if (settingEntity != null)
                {
                    CurrentRoom.Config.Add(settingEntity);
                }
            }

            //RoomPaiJiuProxy
            //创建座位
            CurrentRoom.SeatList = new List <SeatEntity>();
            for (int i = 0; i < prRoom.seatListCount(); i++)
            {
                JY_SEAT jySeat = prRoom.getSeatList(i);

                SeatEntity seat = new SeatEntity();

                //手牌
                for (int j = 0; j < jySeat.pokerListCount(); j++)
                {
                    seat.PokerList.Add(new Poker());
                }

                seat.SetSeat(jySeat);

                CurrentRoom.SeatList.Add(seat);

                if (seat.IsBanker)
                {
                    BankerSeat = seat;
                }
            }


            //(时间戳)
            if (prRoom.hasUnixtime())
            {
                CurrentRoom.Unixtime = prRoom.unixtime;
            }

            CalculateSeatIndex();

            PeopleCounting();
        }