Ejemplo n.º 1
0
        public static Room CreateFriendRoom(G2M_CreateFriendRoom message)
        {
            try
            {
                FriendRoomInfo friendRoomInfo = message.FriendRoomInfo;
                Room           room           = ComponentFactory.Create <Room>();
                room.AddComponent <DeskComponent>();
                room.AddComponent <OrderControllerComponent>();
                room.IsFriendRoom = true;

                GameControllerComponent controllerComponent = room.AddComponent <GameControllerComponent>();
                RoomConfig roomConfig = new RoomConfig();
                roomConfig.FriendRoomId        = RandomHelper.RandomNumber(100000, 1000000);
                roomConfig.JuCount             = friendRoomInfo.Ju;
                roomConfig.Multiples           = friendRoomInfo.Hua;
                roomConfig.MinThreshold        = 500;
                roomConfig.IsPublic            = friendRoomInfo.IsPublic == 1;
                roomConfig.MasterUserId        = message.UserId;
                roomConfig.Id                  = 3;
                roomConfig.Name                = "好友房";
                roomConfig.KeyCount            = friendRoomInfo.KeyCount;
                controllerComponent.RoomConfig = roomConfig;
                controllerComponent.RoomName   = RoomName.Friend;

                return(room);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            return(null);
        }
Ejemplo n.º 2
0
        private async void OnEnterRoom(int i)
        {
            try
            {
                UINetLoadingComponent.showNetLoading();

                RoomConfig roomConfig = ConfigHelp.Get <RoomConfig>(i);
                if (PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum < roomConfig.MinThreshold)
                {
                    ToastScript.createToast("金币不足:" + roomConfig.MinThreshold);
                    UINetLoadingComponent.closeNetLoading();
                    return;
                }
                G2C_EnterRoom enterRoom = (G2C_EnterRoom)await Game.Scene.GetComponent <SessionComponent>().Session.Call(new C2G_EnterRoom()
                {
                    RoomType = i
                });

                PlayerInfoComponent.Instance.RoomType = i;
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 3
0
        protected override async void Run(Session session, MH2MP_CreateRoom message, Action <MP2MH_CreateRoom> reply)
        {
            MP2MH_CreateRoom response = new MP2MH_CreateRoom();

            try
            {
                //创建房间 todo需要加入房间牛牛逻辑
                Room room = ComponentFactory.Create <Room>();
                room.AddComponent <DeckComponent>();
                room.AddComponent <DeskCardsCacheComponent>();
                room.AddComponent <OrderControllerComponent>();
                RoomConfig roomConfig = Game.Scene.GetComponent <ConfigComponent>().Get <RoomConfig>(1);
                room.AddComponent <GameControllerComponent, RoomConfig>(roomConfig);
                await room.AddComponent <ActorComponent>().AddLocation();

                Game.Scene.GetComponent <RoomComponent>().Add(room);

                Log.Info($"创建房间{room.Id}");

                response.RoomID = room.Id;

                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
 public static void Awake(this GameControllerComponent self, RoomConfig config)
 {
     self.Config            = config;
     self.BasePointPerMatch = config.GameScore;
     self.Multiples         = 1;
     self.MinThreshold      = 100;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取斗地主房间配置 不满足要求不能进入房间
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        public static RoomConfig GetLandlordsConfig(RoomLevel level)
        {
            RoomConfig config = new RoomConfig();

            switch (level)
            {
            case RoomLevel.Lv100:
                config.BasePointPerMatch = 100;
                config.Multiples         = 1;
                config.MinThreshold      = 100 * 10;
                break;
            }

            return(config);
        }
        protected override async void Run(Session session, C2G_StartMatch_Req message, Action <G2C_StartMatch_Ack> reply)
        {
            G2C_StartMatch_Ack response = new G2C_StartMatch_Ack();

            try
            {
                //验证Session
                if (!GateHelper.SignSession(session))
                {
                    response.Error = ErrorCode.ERR_SignError;
                    reply(response);
                    return;
                }

                User user = session.GetComponent <SessionUserComponent>().User;

                //验证玩家是否符合进入房间要求,默认为100底分局
                RoomConfig roomConfig = RoomHelper.GetConfig(RoomLevel.Lv100);
                UserInfo   userInfo   = await Game.Scene.GetComponent <DBProxyComponent>().Query <UserInfo>(user.UserID, false);

                if (userInfo.Money < roomConfig.MinThreshold)
                {
                    response.Error = ErrorCode.ERR_UserMoneyLessError;
                    reply(response);
                    return;
                }

                //这里先发送响应,让客户端收到后切换房间界面,否则可能会出现重连消息在切换到房间界面之前发送导致重连异常
                reply(response);

                //向匹配服务器发送匹配请求
                StartConfigComponent config          = Game.Scene.GetComponent <StartConfigComponent>();
                IPEndPoint           matchIPEndPoint = config.MatchConfig.GetComponent <InnerConfig>().IPEndPoint;
                Session matchSession = Game.Scene.GetComponent <NetInnerComponent>().Get(matchIPEndPoint);
                M2G_PlayerEnterMatch_Ack m2G_PlayerEnterMatch_Ack = await matchSession.Call(new G2M_PlayerEnterMatch_Req()
                {
                    PlayerID  = user.InstanceId,
                    UserID    = user.UserID,
                    SessionID = session.InstanceId,
                }) as M2G_PlayerEnterMatch_Ack;

                user.IsMatching = true;
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
        protected override async void Run(Session session, C2G_StartMatch_Landlords_Req message, Action <G2C_StartMatch_Landlords_Back> reply)
        {
            G2C_StartMatch_Landlords_Back response = new G2C_StartMatch_Landlords_Back();

            try
            {
                Log.Debug("玩家开始匹配");
                //验证Session
                if (!GateHelper.SignSession(session))
                {
                    response.Error = ErrorCode.ERR_SignError;
                    reply(response);
                    return;
                }

                User user = session.GetComponent <SessionUserComponent>().User;

                //验证玩家是否符合进入房间要求,默认为100底分局
                RoomConfig roomConfig = GateHelper.GetLandlordsConfig(RoomLevel.Lv100);
                UserInfo   userInfo   = await Game.Scene.GetComponent <DBProxyComponent>().Query <UserInfo>(user.UserID);

                if (userInfo.Money < roomConfig.MinThreshold)
                {
                    response.Error = ErrorCode.ERR_UserMoneyLessError;
                    reply(response);
                    return;
                }

                reply(response);

                //获取斗地主专用Map服务器的Session
                //通知Map服务器创建新的Gamer
                Session LandlordsSession = GateHelper.GetLandlordsSession();
                LandlordsSession.Send(new G2M_EnterMatch_Landords()
                {
                    UserID          = user.UserID,
                    ActorIDofUser   = user.InstanceId,
                    ActorIDofClient = user.SelfGateSessionID
                });
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
Ejemplo n.º 8
0
        protected override async ETTask Run(Session session, C2G_StartMatch_Req request, G2C_StartMatch_Back response, Action reply)
        {
            try
            {
                Log.Debug("玩家开始匹配");
                //验证Session
                if (!GateHelper.SignSession(session))
                {
                    response.Error = ErrorCode.ERR_SignError;
                    reply();
                    return;
                }
                //获取Gate服务器上绑定的User对象
                User user = session.GetComponent <SessionUserComponent>().User;
                //验证玩家是否符合进入房间要求,默认为100底分局
                RoomConfig roomConfig = GateHelper.GetLandlordsConfig(RoomLevel.Lv100);
                //获取User对象的UserInfo(用户信息)数据
                UserInfo userInfo = await Game.Scene.GetComponent <DBProxyComponent>().Query <UserInfo>(user.UserID);

                //判断此对象的金币是否符合准备要求
                if (userInfo.Douzi < roomConfig.MinThreshold)
                {
                    response.Error = ErrorCode.ERR_UserMoneyLessError;
                    reply();
                    return;
                }
                reply();

                //获取斗地主Map服务器的Session
                //通知Map服务器创建地图上的Gamer,发送请求匹配通知
                Session mapSession = GateHelper.GetMapSession();
                mapSession.Send(new EnterMatchs_G2M()
                {
                    UserID   = user.UserID,
                    GActorID = user.InstanceId,
                    CActorID = user.GateSessionID
                });

                await ETTask.CompletedTask;
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
Ejemplo n.º 9
0
        private async void OnJoinRoom()
        {
            try
            {
                if (string.IsNullOrEmpty(InputField_RoomId.text))
                {
                    return;
                }

                G2C_JoinRoom g2c_JoinRoom = await SessionComponent.Instance.Session.Call(new C2G_JoinRoom()
                {
                    RoomId = Convert.ToInt64(this.InputField_RoomId.text),
                })
                                            as G2C_JoinRoom;

                Log.Debug($"加入房间:{g2c_JoinRoom.Error},{g2c_JoinRoom.Message}");

                //添加房间配置
                RoomConfig config = new RoomConfig();
                config.GameCount  = g2c_JoinRoom.Room.GameCount;
                config.GamePlayer = g2c_JoinRoom.Room.PlayerCount;
                config.RoomId     = g2c_JoinRoom.RoomId;
                config.GameScore  = g2c_JoinRoom.Room.GameScore;

                GameTools.GetUser().ChairId = g2c_JoinRoom.ChairID;
                Log.Debug($"自己的座位号:{g2c_JoinRoom.ChairID}");
                RoomComponent roomComponent = Game.Scene.GetComponent <RoomComponent>();

                if (roomComponent == null)
                {
                    Game.Scene.AddComponent <RoomComponent, RoomConfig>(config);
                }
                else
                {
                    roomComponent.SetRoomConfig(config);
                }
                Game.Scene.GetComponent <UIComponent>().CreateOrShow(UIType.UIRoom);
                this.Close();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 10
0
        public static async ETVoid InitWorldMapRoom(this RoomComponent self)
        {
            // 获取所有世界地图map数据列表
            // 这样可以在另一个循环,异步的创建所有的世界地图房间,完成怪物,世界boss,Npc,世界任务,场景中产物的刷新。
            // foreach(MapInfo map in mapInfos){
            //     self.worldMapQueue.Enqueue(map.id);
            // }

            // 这里暂时只初始化 黎明镇的地图房间
            RoomConfig config   = GateHelper.GetMapConfig(1001);
            Room       daybreak = ComponentFactory.Create <Room, RoomConfig>(config);

            await daybreak.AddComponent <MailBoxComponent>().AddLocation();

            self.mapRooms.Add(daybreak.roomId, daybreak);

            // 本地图刷新
            // await daybreak.RefreshMap().Coroutine();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 创建房间
        /// </summary>
        private async void OnCreateRoom()
        {
            try
            {
                RoomInfo ToServerinfo = new RoomInfo();
                ToServerinfo.GameCount   = 10;
                ToServerinfo.GameScore   = 20;
                ToServerinfo.PlayerCount = 2;
                G2C_CreateRoom RoomInfo = await SessionComponent.Instance.Session.Call(new C2G_CreateRoom()
                {
                    Room = ToServerinfo
                }) as G2C_CreateRoom;

                Log.Debug($"RoomInfo={RoomInfo.Room.GameCount},{RoomInfo.Room.GameScore},{RoomInfo.Room.PlayerCount}");

                //添加房间配置
                RoomConfig config = new RoomConfig();
                config.GameCount  = RoomInfo.Room.GameCount;
                config.GamePlayer = RoomInfo.Room.PlayerCount;
                config.RoomId     = RoomInfo.RoomId;
                config.GameScore  = RoomInfo.Room.GameScore;

                GameTools.GetUser().ChairId = RoomInfo.ChairID;
                RoomComponent roomComponent = Game.Scene.GetComponent <RoomComponent>();

                if (roomComponent == null)
                {
                    Game.Scene.AddComponent <RoomComponent, RoomConfig>(config);
                }
                else
                {
                    roomComponent.SetRoomConfig(config);
                }


                Game.Scene.GetComponent <UIComponent>().CreateOrShow(UIType.UIRoom);
                this.Close();
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取Map 配置信息
        /// </summary>
        /// <returns></returns>
        public static RoomConfig GetMapConfig(long roomId)
        {
            RoomConfig config = new RoomConfig();

            // 查询数据库 此区域地图配置信息,这里暂时没实现,用写死的数据
            config.roomNmae       = "黎明镇";
            config.roomId         = roomId;
            config.BaseLevel      = 5;
            config.MinLevel       = 1;
            config.MaxLevel       = 10;
            config.removable      = false;
            config.reloadMapScene = 1001;
            config.Multiples      = 1;
            config.maps           = new long[3] {
                2001, 2002, 2003
            };
            config.minNumber = 0; //0为不限最大人数
            config.maxNumber = 0; //0为不限最少人数
            return(config);
        }
Ejemplo n.º 13
0
        public static async Task <Room> Create(byte PlayerCount, byte GameCount, int GameScore, Session client)
        {
            Room       room   = ComponentFactory.Create <Room, byte>(PlayerCount);
            RoomConfig config = new RoomConfig
            {
                PlayerCount = PlayerCount,
                GameCount   = GameCount,
                GameScore   = GameScore
            };

            room.roomConfig = config;
            await room.AddComponent <MailBoxComponent>().AddLocation();

            room.AddComponent <GameControllerComponent, RoomConfig>(config);
            Game.Scene.GetComponent <RoomComponent>().Add(room);
            client.GetUser().RoomID = room.RoomId;
            room.AddComponent <DeckComponent>();
            Log.Info($"创建房间{room.Id}");
            return(room);
        }
        public static async Task GamerReady(Gamer gamer, Actor_GamerReady message)
        {
            try
            {
                Log.Info($"收到玩家{gamer.UserID}准备");
                RoomComponent roomComponent = Game.Scene.GetComponent <RoomComponent>();
                Room          room          = roomComponent.Get(gamer.RoomID);

                if (room == null || gamer == null || gamer.IsReady || room.State == RoomState.Game)
                {
                    return;
                }

                gamer.IsReady = true;
                //消息广播给其他人
                room?.Broadcast(new Actor_GamerReady()
                {
                    Uid = gamer.UserID
                });

                Gamer[] gamers = room.GetAll();
                //房间内有4名玩家且全部准备则开始游戏
                if (room.Count == 4 && gamers.Where(g => g.IsReady).Count() == 4)
                {
                    room.State = RoomState.Game;
                    room.CurrentJuCount++;
                    room.IsGameOver = false;
                    room.RoomDispose();

                    #region 好友房扣钥匙

                    if (room.IsFriendRoom && room.CurrentJuCount == 1)
                    {
                        RoomConfig roomConfig = room.GetComponent <GameControllerComponent>().RoomConfig;
                        await DBCommonUtil.DeleteFriendKey(roomConfig.MasterUserId, roomConfig.KeyCount, "好友房房主扣除钥匙");
                    }
                    #endregion
                    //设置比下胡
                    if (room.LastBiXiaHu)
                    {
                        room.IsBiXiaHu = true;
                    }
                    else
                    {
                        room.IsBiXiaHu = false;
                    }
                    room.LastBiXiaHu = false;


                    if (roomComponent.gameRooms.TryGetValue(room.Id, out var itemRoom))
                    {
                        roomComponent.gameRooms.Remove(room.Id);
                    }

                    roomComponent.gameRooms.Add(room.Id, room);
                    roomComponent.idleRooms.Remove(room.Id);
                    //添加用户
                    room.UserIds.Clear();
                    //初始玩家开始状态
                    foreach (var _gamer in gamers)
                    {
                        room.UserIds.Add(_gamer.UserID);

                        if (_gamer.GetComponent <HandCardsComponent>() == null)
                        {
                            _gamer.AddComponent <HandCardsComponent>();
                        }

                        _gamer.IsReady = false;
                    }

                    Log.Info($"{room.Id}房间开始,玩家:{JsonHelper.ToJson(room.UserIds)}");


                    GameControllerComponent  gameController  = room.GetComponent <GameControllerComponent>();
                    OrderControllerComponent orderController = room.GetComponent <OrderControllerComponent>();
                    DeskComponent            deskComponent   = room.GetComponent <DeskComponent>();

                    Gamer bankerGamer = null;
                    HandCardsComponent bankerHandCards = null;
                    if (room.IsLianZhuang)
                    {
                        if (room.huPaiUid != 0 && room.huPaiUid == room.BankerGamer?.UserID)
                        {
                            bankerGamer              = room.Get(room.huPaiUid);
                            bankerHandCards          = bankerGamer.GetComponent <HandCardsComponent>();
                            bankerHandCards.IsBanker = true;
                            room.BankerGamer         = bankerGamer;
                            //连庄
                            room.LastBiXiaHu = true;
                        }
                        else
                        {
                            int gamerSeat = room.GetGamerSeat(room.BankerGamer.UserID);
                            int currentSeat;
                            if (gamerSeat == 3)
                            {
                                currentSeat = 0;
                            }
                            else
                            {
                                currentSeat = ++gamerSeat;
                            }

                            bankerGamer              = room.gamers[currentSeat];
                            bankerHandCards          = bankerGamer.GetComponent <HandCardsComponent>();
                            bankerHandCards.IsBanker = true;
                            room.BankerGamer         = bankerGamer;
                        }
                    }
                    else
                    {
                        if (room.IsFriendRoom)
                        {
                            GameControllerComponent controllerComponent = room.GetComponent <GameControllerComponent>();
                            long masterUserId = controllerComponent.RoomConfig.MasterUserId;
                            bankerGamer = room.Get(masterUserId);
                        }
                        else
                        {
                            //随机庄家
                            int number = RandomHelper.RandomNumber(0, 12);
                            int i      = number % 4;
                            bankerGamer = room.gamers[i];
                        }
                        bankerHandCards          = bankerGamer.GetComponent <HandCardsComponent>();
                        bankerHandCards.IsBanker = true;
                        room.BankerGamer         = bankerGamer;
                    }

                    //发牌
                    gameController.DealCards();
                    orderController.Start(bankerGamer.UserID);

                    //去除花牌
                    foreach (var _gamer in gamers)
                    {
                        HandCardsComponent handCardsComponent = _gamer.GetComponent <HandCardsComponent>();
                        List <MahjongInfo> handCards          = handCardsComponent.GetAll();

                        for (int j = handCards.Count - 1; j >= 0; j--)
                        {
                            MahjongInfo mahjongInfo = handCards[j];

                            if (mahjongInfo.m_weight >= Consts.MahjongWeight.Hua_HongZhong)
                            {
                                handCards.RemoveAt(j);
                                mahjongInfo.weight = (byte)mahjongInfo.m_weight;
                                handCardsComponent.FaceCards.Add(mahjongInfo);
                                handCardsComponent.FaceGangCards.Add(mahjongInfo);
                            }
                        }

                        //加牌
                        int handCardsCount = handCards.Count;
                        for (int j = 0; j < 13 - handCardsCount; j++)
                        {
                            GetCardNotFace(deskComponent, handCardsComponent);
                        }
                    }

                    //庄家多发一张牌
                    GetCardNotFace(deskComponent, bankerHandCards);

//	                List<MahjongInfo> infos = bankerHandCards.GetAll();
//	                bankerHandCards.library = new List<MahjongInfo>(list);

                    //给客户端传送数据
                    Actor_StartGame actorStartGame = new Actor_StartGame();
                    foreach (var itemGame in gamers)
                    {
                        GamerData          gamerData          = new GamerData();
                        HandCardsComponent handCardsComponent = itemGame.GetComponent <HandCardsComponent>();

                        List <MahjongInfo> mahjongInfos = handCardsComponent.library;
                        foreach (var mahjongInfo in mahjongInfos)
                        {
                            mahjongInfo.weight = (byte)mahjongInfo.m_weight;
                        }

                        gamerData.UserID    = itemGame.UserID;
                        gamerData.handCards = mahjongInfos;
                        gamerData.faceCards = handCardsComponent.FaceCards;
                        if (handCardsComponent.IsBanker)
                        {
                            gamerData.IsBanker = true;
                        }

                        gamerData.SeatIndex     = room.seats[itemGame.UserID];
                        gamerData.OnlineSeconds = await DBCommonUtil.GetRestOnlineSeconds(itemGame.UserID);

                        actorStartGame.GamerDatas.Add(gamerData);
                    }

                    actorStartGame.restCount = deskComponent.RestLibrary.Count;
                    GameControllerComponent gameControllerComponent = room.GetComponent <GameControllerComponent>();

                    if (room.IsFriendRoom)
                    {
                        actorStartGame.RoomType       = 3;
                        actorStartGame.CurrentJuCount = room.CurrentJuCount;
                    }
                    else
                    {
                        actorStartGame.RoomType = (int)gameControllerComponent.RoomConfig.Id;
                    }
                    //发送消息
                    room.Broadcast(actorStartGame);
//	                Log.Debug("发送开始:" + JsonHelper.ToJson(actorStartGame));

                    //排序
                    var startTime = DateTime.Now;
                    foreach (var _gamer in gamers)
                    {
                        HandCardsComponent handCardsComponent = _gamer.GetComponent <HandCardsComponent>();
                        //排序
                        handCardsComponent.Sort();
                        handCardsComponent.GrabCard = handCardsComponent.GetAll()[handCardsComponent.GetAll().Count - 1];
                        //设置玩家在线开始时间
                        _gamer.StartTime = startTime;
                        //await DBCommonUtil.RecordGamerTime(startTime, true, _gamer.UserID);
                    }

                    foreach (var _gamer in room.GetAll())
                    {
                        HandCardsComponent handCardsComponent = _gamer.GetComponent <HandCardsComponent>();

                        List <MahjongInfo> cards = handCardsComponent.GetAll();

                        if (handCardsComponent.IsBanker)
                        {
                            if (Logic_NJMJ.getInstance().isHuPai(cards))
                            {
                                //ToDo 胡牌
                                Actor_GamerCanOperation canOperation = new Actor_GamerCanOperation();
                                canOperation.Uid           = _gamer.UserID;
                                _gamer.IsCanHu             = true;
                                canOperation.OperationType = 2;
                                room.GamerBroadcast(_gamer, canOperation);
                                _gamer.isGangFaWanPai = true;
                            }
                        }
                        else
                        {
                            //检查听牌
                            List <MahjongInfo> checkTingPaiList = Logic_NJMJ.getInstance().checkTingPaiList(cards);
                            if (checkTingPaiList.Count > 0)
                            {
                                Log.Info($"{_gamer.UserID}听牌:");
                                _gamer.isFaWanPaiTingPai = true;
                            }
                        }
                    }

                    //等客户端掷骰子
                    //是否超时
                    await Game.Scene.GetComponent <TimerComponent>().WaitAsync(10 * 1000);

                    room.StartTime();
                    //扣服务费
                    if (!room.IsFriendRoom)
                    {
                        //不要动画
                        GameHelp.CostServiceCharge(room, false);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }

            await Task.CompletedTask;
        }
Ejemplo n.º 15
0
        protected override async void Run(Session session, G2M_GetRoomInfo message, Action <M2G_GetRoomInfo> reply)
        {
            M2G_GetRoomInfo response = new M2G_GetRoomInfo();

            try
            {
                RoomComponent roomComponent = Game.Scene.GetComponent <RoomComponent>();
                int           newRoomCount  = 0;
                int           jingRoomCount = 0;

                foreach (var gameRoom in roomComponent.gameRooms.Values)
                {
                    GameControllerComponent gameControllerComponent = gameRoom.GetComponent <GameControllerComponent>();
                    if (gameControllerComponent == null)
                    {
                        continue;
                    }
                    RoomConfig roomConfig = gameControllerComponent.RoomConfig;
                    if (roomConfig.Id == 1)
                    {
                        newRoomCount++;
                    }
                    else if (roomConfig.Id == 2)
                    {
                        jingRoomCount++;
                    }
                }

                int newGamerCount  = 0;
                int jingGamerCount = 0;
                foreach (var gameRoom in roomComponent.idleRooms.Values)
                {
                    GameControllerComponent gameControllerComponent = gameRoom.GetComponent <GameControllerComponent>();
                    if (gameControllerComponent == null)
                    {
                        continue;
                    }
                    RoomConfig roomConfig = gameControllerComponent.RoomConfig;
                    if (roomConfig.Id == 1)
                    {
                        newGamerCount += gameRoom.seats.Count;
                    }
                    else if (roomConfig.Id == 2)
                    {
                        jingGamerCount += gameRoom.seats.Count;
                    }
                }

                response.JingRoomCount = jingRoomCount * 4;
                response.NewRoomCount  = newRoomCount * 4;
                response.JingTotalPlayerInGameCount = jingRoomCount * 4 + jingGamerCount;
                response.NewTotalPlayerInGameCount  = newRoomCount * 4 + newGamerCount;

                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }

            await Task.CompletedTask;
        }
Ejemplo n.º 16
0
 public void SetRoomConfig(RoomConfig config)
 {
     room = config;
 }
Ejemplo n.º 17
0
 public void Awake(RoomConfig roomInfo)
 {
     room = roomInfo;
 }