Пример #1
0
        /// <summary>
        /// 开局
        /// </summary>
        /// <param name="proto"></param>
        public void Begin(JY_ROOM_GAMESTART proto)
        {
            Debug.Log("开局------------proto.baseScore;------------------------" + proto.baseScore);
            CurrentRoom.roomStatus = ROOM_STATUS.GAME;
            if (proto.hasBaseScore())
            {
                CurrentRoom.baseScore = proto.baseScore;
            }
            if (proto.hasLoop())
            {
                CurrentRoom.currentLoop = proto.loop;
            }
            List <JY_SEAT> seatList = proto.getSeatListList();

            for (int i = 0; i < seatList.Count; i++)
            {
                if (seatList[i] != null && seatList[i].playerId > 0)
                {
                    SeatEntity seat = GetSeatByPlayerId(seatList[i].playerId);
                    seat.SetSeat(seatList[i]);
                    Debug.Log("开局------------seat.gold;------------------------" + seat.Gold);
                }
            }

            SendRoomInfoChangeNotify();
        }
Пример #2
0
        /// <summary>
        /// 发牌
        /// </summary>
        /// <param name="proto"></param>
        public void SendPoker(JY_ROOM_BEGIN proto)
        {
            if (proto.hasSeat() && proto.seat.hasPos())
            {
                SeatEntity seat = GetSeatBySeatId(proto.seat.pos);
                for (int i = 0; i < proto.seat.pokerListCount(); i++)
                {
                    seat.PokerList.Add(new Poker());
                }

                seat.SetSeat(proto.seat);
                SendSeatInfoChangeNotify(seat);



                //Debug.Log("proto.hasUnixtime() && seat.PokerList.Count==2" + (proto.hasUnixtime() && seat.PokerList.Count == 2));
                SetCountDown((proto.hasUnixtime() && seat.PokerList.Count == 2) ? proto.unixtime:0);
            }
        }
Пример #3
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();
        }