コード例 #1
0
        public void Init(SCBattlePveStartMsg battleStartMsg)
        {
            
            var service = BattleTemplateModelLocator.Instance;
            var battleSourceCreator = new BattleSourceTemplateCreater(service);
            var battleSource = battleSourceCreator.createPVESource(battleStartMsg);
            battleSource.Uuid = battleStartMsg.Uuid;

            // level manager setup, including levels and monsters controll.
            LevelManager = new LevelManager
            {
                MonsterList = battleSource.getSideFighters(BattleSideEnum.SIDEB_RIGHT),
                MonsterGroupList = battleSource.MonsterGroup
            };
            if (LevelManager.MonsterList == null)
            {
                Debug.Log("MonsterList == null");
            }
            if (LevelManager.MonsterGroupList == null)
            {
                Debug.Log("MonsterGroupList == null");
            }

            // Important, will do level manager input data validation.
            LevelManager.Validate();

            if (PersistenceHandler.Instance.Mode == PersistenceHandler.PersistenceMode.ReStartBattleWithPersistence)
            {
                LevelManager.RestorePersistent(PersistenceHandler.Instance.PersistentInfor);
            }
            LevelManager.InitLevel();

            BattleType = battleStartMsg.BattleType;
            RaidID = battleStartMsg.RaidID;
            Uuid = battleStartMsg.Uuid;
            Source = battleSource;

            var factory = battleSource.BattleType.Factory;
            MainBattle = factory.createBattle(Source, templateModel);
            MainBattle.start();

            // hero setup.
            HeroList = battleSource.getSideFighters(BattleSideEnum.SIDE_LEFT);
        }
コード例 #2
0
        public void CreateRaidMonsterTemplateInfo(int stageId, BattleSource source)
        {
            RaidStageTemplate _stageTemp = MissionModelLocator.Instance.GetRaidStagrByTemplateId(stageId);
            if (_stageTemp == null)
            {
                //TODO: loggers.error
                return;
            }
            int _monsterGropId = _stageTemp.MonsterGroupId;
            RaidMonsterGroupTemplate _monsterGropTemp =
                MissionModelLocator.Instance.GetRaidMonsterGroupTemplateId(_monsterGropId);
            if (_monsterGropTemp == null)
            {
                //TODO: loggers.error
                return;
            }

            List<MonsterGroup> _allMonster = _monsterGropTemp.MonsterGroup;

            List<int> _allMonsterIdList = new List<int>();
            List<int> _monsterGroupList = new List<int>();

            foreach (MonsterGroup _monsterGroup in _allMonster)
            {
                List<int> _groupList = getSingleMonsterGroupIdList(_monsterGroup);
                if (_groupList.Count == 0)
                {
                    break;
                }
                _allMonsterIdList.AddRange(_groupList);
                _monsterGroupList.Add(_groupList.Count);
            }
        }