Beispiel #1
0
        //开始游戏
        public static void StartGame(this FiveStarRoom fiveStarRoom)
        {
            Actor_FiveStar_StartGame actorFiveStarStart = new Actor_FiveStar_StartGame();

            actorFiveStarStart.RoomConfigs = fiveStarRoom.RoomConfig.Configs;
            actorFiveStarStart.RoomId      = fiveStarRoom.RoomId;
            if (fiveStarRoom.RoomType == RoomType.Match)
            {
                actorFiveStarStart.RoomId = fiveStarRoom.MathRoomId;
            }

            foreach (var player in fiveStarRoom.FiveStarPlayerDic.Values)
            {
                //因为有些对象不能进行序列化 就必须重新复制一份
                actorFiveStarStart.PlayerInfos.Add(FiveStarPlayerFactory.CopySerialize(player));
            }
            foreach (var player in fiveStarRoom.FiveStarPlayerDic)
            {
                player.Value.StartGame(actorFiveStarStart);
            }
            //第一局随机出一个休息的玩家
            fiveStarRoom.NextRestSeatIndex = RandomTool.Random(1, fiveStarRoom.RoomConfig.RoomNumber); //不能为0 因为0要第一个摸牌
            fiveStarRoom.SmallStartGame();                                                             //小局开始游戏
            //用来发送消息的序列化对象 放入简易对象池 不能直接销毁 因为会改变一些东西
            foreach (var player in actorFiveStarStart.PlayerInfos)
            {
                FiveStarPlayerFactory.DisposeSerializePlayer(player);
            }
        }
Beispiel #2
0
 //玩家准备
 public static void PlayerReady(this FiveStarRoom fiveStarRoom)
 {
     for (int i = 0; i < fiveStarRoom.FiveStarPlayerDic.Count; i++)
     {
         if (!fiveStarRoom.FiveStarPlayerDic[i].ReadyState)
         {
             return;
         }
     }
     fiveStarRoom.SmallStartGame();//开始小局游戏
 }