public void Execute()
 {
     if (this.m_room.CanStart())
     {
         List <GamePlayer> players = this.m_room.GetPlayers();
         if (this.m_room.RoomType == eRoomType.Freedom)
         {
             List <IGamePlayer> red  = new List <IGamePlayer>();
             List <IGamePlayer> blue = new List <IGamePlayer>();
             foreach (GamePlayer p in players)
             {
                 if (p != null)
                 {
                     if (p.CurrentRoomTeam == 1)
                     {
                         red.Add(p);
                     }
                     else
                     {
                         blue.Add(p);
                     }
                 }
             }
             BaseGame game = GameMgr.StartPVPGame(this.m_room.RoomId, red, blue, this.m_room.MapId, this.m_room.RoomType, this.m_room.GameType, (int)this.m_room.TimeMode);
             this.StartGame(game);
         }
         else
         {
             if (this.m_room.RoomType == eRoomType.Exploration || this.m_room.RoomType == eRoomType.Boss || this.m_room.RoomType == eRoomType.Treasure || this.m_room.RoomType == eRoomType.Training || this.m_room.RoomType == eRoomType.FightLab || this.m_room.RoomType == eRoomType.FightNPC || this.m_room.RoomType == eRoomType.WorldBoss)
             {
                 List <IGamePlayer> matchPlayers = new List <IGamePlayer>();
                 foreach (GamePlayer p in players)
                 {
                     if (p != null)
                     {
                         matchPlayers.Add(p);
                     }
                 }
                 this.m_room.UpdatePveRoomTimeMode();
                 BaseGame game = GameMgr.StartPVEGame(this.m_room.RoomId, matchPlayers, this.m_room.MapId, this.m_room.RoomType, this.m_room.GameType, (int)this.m_room.TimeMode, this.m_room.HardLevel, this.m_room.LevelLimits);
                 this.StartGame(game);
             }
             else
             {
                 if (this.m_room.RoomType == eRoomType.Match)
                 {
                     this.m_room.UpdateAvgLevel();
                     BattleServer server = BattleMgr.AddRoom(this.m_room);
                     if (server != null)
                     {
                         this.m_room.BattleServer = server;
                         this.m_room.IsPlaying    = true;
                         this.m_room.SendStartPickUp();
                     }
                     else
                     {
                         this.m_room.SendCancelPickUp();
                     }
                 }
             }
         }
         RoomMgr.WaitingRoom.SendUpdateRoom(this.m_room);
     }
     else
     {
         this.m_room.SendPlayerState();
     }
 }
Exemple #2
0
        public void Execute()
        {
            if (m_room.CanStart())
            {
                List <GamePlayer> players = m_room.GetPlayers();
                if (m_room.RoomType == eRoomType.Freedom)
                {
                    List <IGamePlayer> red  = new List <IGamePlayer>();
                    List <IGamePlayer> blue = new List <IGamePlayer>();
                    foreach (GamePlayer p in players)
                    {
                        if (p != null)
                        {
                            if (p.CurrentRoomTeam == 1)
                            {
                                red.Add(p);
                            }
                            else
                            {
                                blue.Add(p);
                            }
                        }
                    }

                    BaseGame game = GameMgr.StartPVPGame(m_room.RoomId, red, blue, m_room.MapId, m_room.RoomType, m_room.GameType, m_room.TimeMode);
                    StartGame(game);
                }
                else if (m_room.RoomType == eRoomType.Exploration || m_room.RoomType == eRoomType.Boss || m_room.RoomType == eRoomType.Treasure)
                {
                    List <IGamePlayer> matchPlayers = new List <IGamePlayer>();
                    foreach (GamePlayer p in players)
                    {
                        if (p != null)
                        {
                            matchPlayers.Add(p);
                        }
                    }
                    //更新房间的时间类型
                    UpdatePveRoomTimeMode();
                    BaseGame game = GameMgr.StartPVEGame(m_room.RoomId, matchPlayers, m_room.MapId, m_room.RoomType, m_room.GameType, m_room.TimeMode, m_room.HardLevel, m_room.LevelLimits);
                    StartGame(game);
                }
                else if (m_room.RoomType == eRoomType.Match)
                {
                    m_room.UpdateAvgLevel();
                    // m_room.GameType = eGameType.Guild;

                    BattleServer server = BattleMgr.AddRoom(m_room);
                    if (server != null)
                    {
                        m_room.BattleServer = server;
                        m_room.IsPlaying    = true;
                        m_room.SendStartPickUp();
                    }
                    else
                    {
                        GSPacketIn pkg = m_room.Host.Out.SendMessage(eMessageType.ChatERROR, "没有可用的战场服务器!");
                        m_room.SendToAll(pkg, m_room.Host);
                        m_room.SendCancelPickUp();
                    }
                }

                RoomMgr.WaitingRoom.SendUpdateRoom(m_room);
            }
        }
 public void Execute()
 {
     if (this.m_room.CanStart())
     {
         List <GamePlayer> players = this.m_room.GetPlayers();
         if (this.m_room.RoomType == eRoomType.Freedom)
         {
             List <IGamePlayer> list  = new List <IGamePlayer>();
             List <IGamePlayer> list2 = new List <IGamePlayer>();
             foreach (GamePlayer current in players)
             {
                 if (current != null)
                 {
                     if (current.CurrentRoomTeam == 1)
                     {
                         list.Add(current);
                     }
                     else
                     {
                         list2.Add(current);
                     }
                 }
             }
             BaseGame game = GameMgr.StartPVPGame(this.m_room.RoomId, list, list2, this.m_room.MapId, this.m_room.RoomType, this.m_room.GameType, (int)this.m_room.TimeMode);
             this.StartGame(game);
         }
         else
         {
             if (this.m_room.RoomType == eRoomType.Dungeon || this.m_room.RoomType == eRoomType.Freshman || this.m_room.RoomType == eRoomType.Lanbyrinth || this.m_room.RoomType == eRoomType.ConsortiaBoss || this.m_room.RoomType == eRoomType.AcademyDungeon || this.m_room.RoomType == eRoomType.FightLib || this.m_room.RoomType == eRoomType.WordBoss)
             {
                 List <IGamePlayer> list3 = new List <IGamePlayer>();
                 foreach (GamePlayer current2 in players)
                 {
                     if (current2 != null)
                     {
                         list3.Add(current2);
                     }
                 }
                 this.UpdatePveRoomTimeMode();
                 BaseGame game2 = GameMgr.StartPVEGame(this.m_room.RoomId, list3, this.m_room.MapId, this.m_room.RoomType, this.m_room.GameType, (int)this.m_room.TimeMode, this.m_room.HardLevel, this.m_room.LevelLimits);
                 this.StartGame(game2);
             }
             else
             {
                 if (this.m_room.RoomType == eRoomType.Match)
                 {
                     this.m_room.UpdateAvgLevel();
                     BattleServer battleServer = BattleMgr.AddRoom(this.m_room);
                     if (battleServer != null)
                     {
                         this.m_room.BattleServer = battleServer;
                         this.m_room.IsPlaying    = true;
                         this.m_room.SendStartPickUp();
                     }
                     else
                     {
                         GSPacketIn pkg = this.m_room.Host.Out.SendMessage(eMessageType.ChatERROR, "Game đã bắt đầu!");
                         this.m_room.SendToAll(pkg, this.m_room.Host);
                         this.m_room.SendCancelPickUp();
                     }
                 }
             }
         }
         RoomMgr.WaitingRoom.SendUpdateRoom(this.m_room);
     }
 }