Пример #1
0
        public static BaseGame StartPVPGame(List <IGamePlayer> red, List <IGamePlayer> blue, int mapIndex, eRoomType roomType, eTeamType teamType, eGameType gameType, int timeType)
        {
            try
            {
                int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId);
                Map map   = MapMgr.CloneMap(index);

                if (map != null)
                {
                    PVPGame game = new PVPGame(m_gameId++, red, blue, 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);
            }
        }
Пример #2
0
        public static BaseGame StartPVPGame(int roomId, List<IGamePlayer> red, List<IGamePlayer> blue, int mapIndex, eRoomType roomType, eGameType gameType, int timeType)
        {
            try
            {
                int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId);
                Map map = MapMgr.CloneMap(index);

                if (map != null)
                {
                    PVPGame game = new PVPGame(m_gameId++, roomId, red, blue, map, roomType, gameType, timeType);
                    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;
            }

        }