Пример #1
1
        public BaseGame(int id, int roomId, Map map, eRoomType roomType, eGameType gameType, int timeType)
            : base(id, roomType, gameType, timeType)
        {
            m_roomId = roomId;
            m_players = new Dictionary<int, Player>();
            m_turnQueue = new List<TurnedLiving>();
            m_livings = new List<Living>();

            m_random = new Random();

            m_map = map;
            m_actions = new ArrayList();
            PhysicalId = 0;
            BossWarField = "";

            m_tempBox = new List<Box>();
            m_tempPoints = new List<Point>();

            if (roomType == eRoomType.Dungeon)
            {
                Cards = new int[21];
            }
            else
            {
                Cards = new int[8];
            }

            m_gameState = eGameState.Inited;
        }
Пример #2
0
        public PVEGame(int id, int roomId, PveInfo info, List<IGamePlayer> players, Map map, eRoomType roomType, eGameType gameType, int timeType, eHardLevel hardLevel)
            : base(id, roomId, map, roomType, gameType, timeType)
        {
            PlayersXY = new List<Point>();

            foreach (IGamePlayer player in players)
            {
                Player fp = new Player(player, PhysicalId++, this, 1);
                //fp.Reset();
                fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1;
                AddPlayer(player, fp);
            }

            m_info = info;
            BeginPlayersCount = players.Count;
            TotalKillCount = 0;
            TotalNpcGrade = 0;
            TotalNpcExperience = 0;
            TotalHurt = 0;

            m_IsBossType = "";

            WantTryAgain = 0;
            SessionId = 0;
            m_gameOverResources = new List<string>();
            Misssions = new Dictionary<int, MissionInfo>();
            m_mapHistoryIds = new List<int>();
            m_hardLevel = hardLevel;

            string script = GetScript(info, hardLevel);

            m_gameAI = ScriptMgr.CreateInstance(script) as APVEGameControl;
            if (m_gameAI == null)
            {
                log.ErrorFormat("Can't create game ai :{0}", script);
                m_gameAI = SimplePVEGameControl.Simple;
            }
            m_gameAI.Game = this;
            m_gameAI.OnCreated();

            m_missionAI = SimpleMissionControl.Simple;
            beginTime = DateTime.Now;
            m_bossCardCount = 0;
        }
Пример #3
0
        public PVPGame(int id, int roomId, List<IGamePlayer> red, List<IGamePlayer> blue, Map map, eRoomType roomType, eGameType gameType, int timeType)
            : base(id, roomId, map, roomType, gameType, timeType)
        {
            m_redTeam = new List<Player>();
            m_blueTeam = new List<Player>();

            StringBuilder sbTeampA = new StringBuilder();
            m_redAvgLevel = 0;
            foreach (IGamePlayer player in red)
            {
                Player fp = new Player(player, PhysicalId++, this, 1);
                sbTeampA.Append(player.PlayerCharacter.ID).Append(",");
                fp.Reset();
                fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1;

                AddPlayer(player, fp);

                m_redTeam.Add(fp);
                m_redAvgLevel += player.PlayerCharacter.Grade;
            }
            m_redAvgLevel = m_redAvgLevel / m_redTeam.Count;
            teamAStr = sbTeampA.ToString();

            StringBuilder sbTeampB = new StringBuilder();
            m_blueAvgLevel = 0;
            foreach (IGamePlayer player in blue)
            {
                Player fp = new Player(player, PhysicalId++, this, 2);
                sbTeampB.Append(player.PlayerCharacter.ID).Append(",");
                fp.Reset();
                fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1;

                AddPlayer(player, fp);

                m_blueTeam.Add(fp);
                m_blueAvgLevel += player.PlayerCharacter.Grade;
            }
            m_blueAvgLevel = m_blueAvgLevel / blue.Count;
            teamBStr = sbTeampB.ToString();

            BeginPlayerCount = m_redTeam.Count + m_blueTeam.Count;
            beginTime = DateTime.Now;
        }
Пример #4
0
 public bool SetMap(int mapId)
 {
     if (GameState == eGameState.Playing)
         return false;
     Map map = MapMgr.CloneMap(mapId);
     if (map != null)
     {
         m_map = map;
         return true;
     }
     return false;
 }
Пример #5
0
 public override void SetMap(Map map)
 {
     base.SetMap(map);
     UpdateAGW();
 }
Пример #6
0
 public BattleGame(int id, List<IGamePlayer> red, ProxyRoom roomRed, List<IGamePlayer> blue, ProxyRoom roomBlue, Map map, eRoomType roomType, eGameType gameType, int timeType)
     : base(id, roomBlue.RoomId, red, blue, map, roomType, gameType, timeType)
 {
     m_roomRed = roomRed;
     m_roomBlue = roomBlue;
 }
Пример #7
0
 public virtual void SetMap(Map map)
 {
     m_map = map;
 }