예제 #1
0
        public static BaseGame StartPVEGame(int roomId, List<IGamePlayer> players, int copyId, eRoomType roomType, eGameType gameType, int timeType, eHardLevel hardLevel, int levelLimits)
        {
            try
            {
                PveInfo info = null;

                if (copyId == 0)
                {
                    info = PveInfoMgr.GetPveInfoByType(roomType, levelLimits);
                }
                else
                {
                    info = PveInfoMgr.GetPveInfoById(copyId);
                }
                if (info != null)
                {
                    PVEGame game = new PVEGame(m_gameId++, roomId, info, players, null, roomType, gameType, timeType, hardLevel);
                    game.GameOverLog += new BaseGame.GameOverLogEventHandle(LogMgr.LogFightAdd);
                    lock (m_games)
                    {
                        m_games.Add(game);
                    }

                    game.Prepare();
                    return game;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception e)
            {
                log.Error("Create game error:", e);
                return null;
            }
        }
예제 #2
0
        public static BaseGame StartPVEGame(List<IGamePlayer> player, int mapIndex, eRoomType roomType, eTeamType teamType, eGameType gameType, int timeType)
        {
            try
            {
                int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId);
                index = 1072;
                Map map = MapMgr.CloneMap(index);

                if (map != null)
                {
                    PVEGame game = new PVEGame(m_gameId ++,player, map, roomType, teamType, gameType, timeType);

                    lock (m_games)
                    {
                        m_games.Add(game);
                    }

                    game.Prepare();
                    return game;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception e)
            {
                log.Error("Create game error:", e);
                return null;
            }
        }