示例#1
0
        protected override async ETTask Run(Session session, M2S_StartGame message)
        {
            S2M_StartGame response = new S2M_StartGame();
            GameRoom      gameRoom = await Game.Scene.GetComponent <GameRoomComponent>().StartGame(message);

            response.RoomId      = message.RoomId;
            response.RoomActorId = gameRoom.RoomId;
            session.Send(response);
        }
        protected override async void Run(Session session, M2S_StartGame message)
        {
            S2M_StartGame response = new S2M_StartGame();

            try
            {
                Log.Info("卡五星服收到开始游戏消息");
                if (message.RoomConfig.ToyGameId != ToyGameId.CardFiveStar)
                {
                    return;
                }
                FiveStarRoom fiveStarRoom = await Game.Scene.GetComponent <FiveStarRoomComponent>().StartGame(message);

                response.RoomId      = message.RoomId;
                response.RoomActorId = fiveStarRoom.Id;
                session.Send(response);
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
        protected override async void Run(Session session, M2S_StartGame message)
        {
            S2M_StartGame response = new S2M_StartGame();

            try
            {
                Log.Info("斗地主服收到开始游戏消息");
                if (message.RoomConfig.ToyGameId != ToyGameId.JoyLandlords)
                {
                    return;
                }
                JoyLdsRoom joyLdsRoom = await JoyLdsRoomFactory.Create(message);

                joyLdsRoom.StartGame();
                response.RoomActorId = joyLdsRoom.Id;
                session.Send(response);
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }