Exemplo n.º 1
0
    /// <summary>
    /// 服务器广播创建房间的消息
    /// </summary>
    /// <param name="obj"></param>
    private void  OnServerReturnCreateRoom(byte[] obj)
    {
        GP_ROOM_CREATE proto = GP_ROOM_CREATE.decode(obj);

        UIViewManager.Instance.CloseWait();
        RoomGuPaiJiuProxy.Instance.InitRoom(proto);
        SceneMgr.Instance.LoadScene(SceneType.GuPaiJiu);
    }
Exemplo n.º 2
0
    }                                                       //目前运营商


    #region 初始化房间数据
    internal void InitRoom(GP_ROOM_CREATE proto)
    {
        CurrentRoom = new RoomEntity()
        {
            roomId         = proto.room.roomId,         //房间ID
            currentLoop    = proto.room.loop,           //局数
            maxLoop        = proto.room.maxLoop,        //总局数
            roomStatus     = proto.room.status,         //房间状态
            FirstDice      = proto.room.firstDice,      //第一个骰子
            SecondDice     = proto.room.secondDice,     //第二个骰子
            FirstGivePos   = proto.room.firstGivePos,   //首发牌座位号
            TotalPokerNum  = proto.room.totalPokerNum,  //房间牌的总数量
            RemainPokerNum = proto.room.remainPokerNum, //房间剩余牌的数量
            PanBase        = proto.room.panBase,        //锅底
            IsAddPanBase   = proto.room.isAddPanBase,   //是否加锅底
            dealSecond     = proto.room.dealTime,       //每局第几次
            fzName         = proto.room.ownerNickName,
            //PlayerID = 111,
            isGrabBankerNum = 0,//抢庄的人数
        };
        CurrentRoom.roomPokerList = new List <Poker>();
        for (int i = 0; i < proto.room.historyPokerListCount(); i++)
        {
            GP_POKER protoPoker = proto.room.getHistoryPokerList(i);
            CurrentRoom.roomPokerList.Add(new Poker()
            {
                Index = protoPoker.index, //索引
                Type  = protoPoker.type,  //花色
                Size  = protoPoker.size,  //大小
            });
        }
        CurrentRoom.Config.Clear();
        Debug.Log(proto.room.settingIdCount() + "                   Stting长度");
        for (int i = 0; i < proto.room.settingIdCount(); ++i)
        {
            cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(proto.room.getSettingId(i));
            if (settingEntity != null)
            {
                CurrentRoom.Config.Add(settingEntity);

                if (settingEntity.tags.Equals("isGuiZi"))
                {
                    CurrentRoom.enumGuiZi = (EnumGuiZi)settingEntity.value;
                }
                if (settingEntity.tags.Equals("isTianJiuWang"))
                {
                    CurrentRoom.enumTianJiuWang = (EnumTianJiuWang)settingEntity.value;
                }
                if (settingEntity.tags.Equals("isDiJiuWang"))
                {
                    CurrentRoom.enumDiJiuWang = (EnumDiJiuWang)settingEntity.value;
                }
                if (settingEntity.tags.Equals("banker"))
                {
                    CurrentRoom.roomMode = (RoomEntity.RoomMode)settingEntity.value;
                }
                if (settingEntity.tags.Equals("pourModel"))
                {
                    CurrentRoom.betModel = (RoomEntity.BetModel)settingEntity.value;
                    if (settingEntity.value == 1)
                    {
                        isBet = true;
                    }
                    else
                    {
                        isBet = false;
                    }
                }
                if (settingEntity.tags.Equals("limit"))
                {
                    CurrentRoom.scoreLimit = settingEntity.value;
                }
                if (settingEntity.tags.Equals("defaultScore"))
                {
                    CurrentRoom.guDScore = settingEntity.value;
                }
                if (settingEntity.tags.Equals("isBig"))
                {
                    CurrentRoom.roomPlay = (EnumPlay)settingEntity.value;
                }
            }
        }
        CurrentRoom.seatList = new List <SeatEntity>();
        for (int i = 0; i < proto.room.seatListCount(); i++)
        {
            GP_SEAT    op_seat = proto.room.getSeatList(i);
            SeatEntity seat    = new SeatEntity();
            seat.PlayerId    = op_seat.playerId;       //玩家ID
            seat.Nickname    = op_seat.nickname;       //玩家名字
            seat.Avatar      = op_seat.avatar;         //玩家头像
            seat.Gender      = op_seat.gender;         //玩家性别
            seat.Gold        = op_seat.gold;           //底分
            seat.Pos         = op_seat.pos;            //座位位置
            seat.seatStatus  = op_seat.status;         ////座位状态
            seat.IsBanker    = op_seat.isBanker;       //是否是庄家
            seat.isDismiss   = op_seat.isDismiss;      //是否同意解散房间
            seat.isWin       = op_seat.isWin;          //是否是赢家
            seat.eamings     = op_seat.earnings;       //本次收益
            seat.loopEamings = op_seat.loopEarnings;   //每局收益
            seat.IP          = op_seat.ipAddr;         //IP
            seat.Longitude   = op_seat.longitude;      //经度
            seat.Latitude    = op_seat.latitude;       //维度
            seat.IsFocus     = !op_seat.isAfk;         //是否在线
            seat.firstPour   = op_seat.getPourList(0); //一道
            seat.secondPour  = op_seat.getPourList(1); //二道
            seat.threePour   = op_seat.getPourList(2); //三道
            seat.pokerList   = new List <Poker>();
            for (int j = 0; j < op_seat.pokerListCount(); ++j)
            {
                GP_POKER protoPoker = op_seat.getPokerList(i);
                seat.pokerList.Add(new Poker()
                {
                    Index = protoPoker.index, //索引
                    Type  = protoPoker.type,  //花色
                    Size  = protoPoker.size,  //大小
                });
            }
            CurrentRoom.seatList.Add(seat);
        }
        CalculateSeatIndexOne();  //普通场计算座位 Index
    }