Пример #1
0
        public void Refresh()
        {
            TowerFloorParam towerFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(GlobalVars.SelectedQuestID);

            if (towerFloor == null)
            {
                return;
            }
            QuestParam questParam = towerFloor.GetQuestParam();

            DataSource.Bind <QuestParam>(((Component)this).get_gameObject(), questParam);
            this.SetRecommendText((int)towerFloor.lv, (int)towerFloor.joblv);
            int             downloadAssetNum = ((FlowNode_DownloadTowerMapSets)((Component)this).GetComponentInParent <FlowNode_DownloadTowerMapSets>()).DownloadAssetNum;
            TowerFloorParam currentFloor     = MonoSingleton <GameManager> .Instance.TowerResuponse.GetCurrentFloor();

            if (currentFloor == null)
            {
                return;
            }
            if ((int)towerFloor.FloorIndex < (int)currentFloor.FloorIndex + downloadAssetNum)
            {
                if (questParam.state == QuestStates.Cleared)
                {
                    GameUtility.SetGameObjectActive(this.UnkownIcon, false);
                    GameUtility.SetGameObjectActive((Component)this.RewardText, true);
                    GameUtility.SetGameObjectActive(this.ClearIcon, true);
                    this.HideAllEnemyIcon();
                    this.SetRewards(MonoSingleton <GameManager> .Instance.FindTowerReward(towerFloor.reward_id));
                }
                else
                {
                    string path = AssetPath.LocalMap(towerFloor.map[0].mapSetName);
                    string src  = AssetManager.LoadTextData(path);
                    if (string.IsNullOrEmpty(src))
                    {
                        DebugUtility.LogError("配置ファイルがありません : QuestIname = " + towerFloor.iname + ",SetFilePath = " + path);
                        return;
                    }
                    JSON_MapUnit jsonObject = JSONParser.parseJSONObject <JSON_MapUnit>(src);
                    GameUtility.SetGameObjectActive(this.UnkownIcon, false);
                    GameUtility.SetGameObjectActive((Component)this.RewardText, true);
                    GameUtility.SetGameObjectActive(this.ClearIcon, false);
                    TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
                    this.HideAllEnemyIcon();
                    if (jsonObject.enemy != null)
                    {
                        TowerFloorParam towerFloorParam = (TowerFloorParam)null;
                        if (MonoSingleton <GameManager> .Instance.TowerResuponse != null)
                        {
                            towerFloorParam = MonoSingleton <GameManager> .Instance.TowerResuponse.GetCurrentFloor();
                        }
                        bool flag1 = towerResuponse.lot_enemies != null && towerResuponse.lot_enemies.Length > 0;
                        bool flag2 = towerFloor.iname == currentFloor.iname;
                        if (flag1 && flag2)
                        {
                            jsonObject.enemy = jsonObject.ReplacedRandEnemy(towerResuponse.lot_enemies, false);
                        }
                        List <TowerQuestInfo.EnemyIconData> enemyIconDataList1 = new List <TowerQuestInfo.EnemyIconData>();
                        for (int i = 0; i < jsonObject.enemy.Length; ++i)
                        {
                            bool flag3 = false;
                            if (jsonObject.enemy[i].IsRandSymbol)
                            {
                                flag3 = true;
                            }
                            if (flag1 && flag2)
                            {
                                flag3 = Array.Find <RandDeckResult>(towerResuponse.lot_enemies, (Predicate <RandDeckResult>)(lot => lot.set_id == i)) != null;
                            }
                            Unit unit = (Unit)null;
                            if (!jsonObject.enemy[i].IsRandSymbol)
                            {
                                NPCSetting npcSetting = new NPCSetting(jsonObject.enemy[i]);
                                unit = new Unit();
                                unit.Setup((UnitData)null, (UnitSetting)npcSetting, (Unit.DropItem)null, (Unit.DropItem)null);
                            }
                            enemyIconDataList1.Add(new TowerQuestInfo.EnemyIconData()
                            {
                                unit    = unit,
                                enemy   = jsonObject.enemy[i],
                                is_rand = flag3
                            });
                        }
                        List <TowerQuestInfo.EnemyIconData> enemyIconDataList2 = new List <TowerQuestInfo.EnemyIconData>();
                        for (int index = 0; index < enemyIconDataList1.Count; ++index)
                        {
                            if (!enemyIconDataList1[index].enemy.IsRandSymbol && !enemyIconDataList1[index].unit.IsGimmick)
                            {
                                enemyIconDataList2.Add(enemyIconDataList1[index]);
                            }
                        }
                        List <TowerQuestInfo.EnemyIconData> enemyIconDataList3 = new List <TowerQuestInfo.EnemyIconData>((IEnumerable <TowerQuestInfo.EnemyIconData>)enemyIconDataList2);
                        if (towerFloorParam != null && towerFloorParam.iname == GlobalVars.SelectedQuestID && MonoSingleton <GameManager> .Instance.TowerEnemyUnit != null)
                        {
                            for (int index = 0; index < enemyIconDataList3.Count; ++index)
                            {
                                if (enemyIconDataList3[index].unit != null)
                                {
                                    int num = (int)enemyIconDataList3[index].unit.MaximumStatus.param.hp - MonoSingleton <GameManager> .Instance.TowerEnemyUnit[index].hp;
                                    enemyIconDataList3[index].unit.Damage(num, false);
                                }
                            }
                        }
                        List <TowerQuestInfo.EnemyIconData> icon_datas         = new List <TowerQuestInfo.EnemyIconData>();
                        List <TowerQuestInfo.EnemyIconData> enemyIconDataList4 = new List <TowerQuestInfo.EnemyIconData>();
                        List <TowerQuestInfo.EnemyIconData> enemyIconDataList5 = new List <TowerQuestInfo.EnemyIconData>();
                        for (int index = 0; index < enemyIconDataList3.Count; ++index)
                        {
                            if (!enemyIconDataList3[index].is_rand)
                            {
                                enemyIconDataList4.Add(enemyIconDataList3[index]);
                            }
                        }
                        if (towerResuponse.lot_enemies == null || (int)towerFloor.FloorIndex > (int)currentFloor.FloorIndex)
                        {
                            if (jsonObject.deck != null && jsonObject.deck.Length > 0 && (jsonObject.rand_tag != null && jsonObject.rand_tag.Length > 0))
                            {
                                int num = 0;
                                for (int index = 0; index < jsonObject.rand_tag.Length; ++index)
                                {
                                    num += jsonObject.rand_tag[index].spawn;
                                }
                                for (int index = 0; index < num; ++index)
                                {
                                    TowerQuestInfo.EnemyIconData enemyIconData = new TowerQuestInfo.EnemyIconData();
                                    enemyIconDataList5.Add(enemyIconData);
                                }
                            }
                        }
                        else
                        {
                            for (int index = 0; index < enemyIconDataList3.Count; ++index)
                            {
                                if (enemyIconDataList3[index].is_rand)
                                {
                                    enemyIconDataList5.Add(enemyIconDataList3[index]);
                                }
                            }
                        }
                        icon_datas.AddRange((IEnumerable <TowerQuestInfo.EnemyIconData>)enemyIconDataList4);
                        icon_datas.AddRange((IEnumerable <TowerQuestInfo.EnemyIconData>)enemyIconDataList5);
                        this.SetIcon(icon_datas);
                    }
                    this.SetRewards(MonoSingleton <GameManager> .Instance.FindTowerReward(towerFloor.reward_id));
                }
            }
            else
            {
                GameUtility.SetGameObjectActive(this.UnkownIcon, true);
                GameUtility.SetGameObjectActive((Component)this.RewardText, true);
                GameUtility.SetGameObjectActive(this.ClearIcon, false);
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnkownIcon, (UnityEngine.Object)null))
                {
                    Text component = (Text)this.UnkownIcon.GetComponent <Text>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        component.set_text(LocalizedText.Get("sys.TOWER_UNKNOWN_TEXT", new object[1]
                        {
                            (object)((int)towerFloor.FloorIndex - downloadAssetNum + 1)
                        }));
                    }
                }
                this.HideAllEnemyIcon();
                this.SetRewards(MonoSingleton <GameManager> .Instance.FindTowerReward(towerFloor.reward_id));
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_BattleResetCost, (UnityEngine.Object)null))
            {
                this.m_BattleResetCost.set_text(MonoSingleton <GameManager> .Instance.FindTower(towerFloor.tower_id).floor_reset_coin.ToString());
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
            this.FloorID = GlobalVars.SelectedQuestID;
        }
Пример #2
0
        public bool Initialize(BattleCore core, MapParam param)
        {
            this.mBattle         = core;
            this.MapSceneName    = param.mapSceneName;
            this.BattleSceneName = param.battleSceneName;
            this.EventSceneName  = param.eventSceneName;
            this.BGMName         = param.bgmName;
            this.mWinMonitorCondition.Clear();
            this.mLoseMonitorCondition.Clear();
            if (string.IsNullOrEmpty(param.mapSceneName))
            {
                DebugUtility.LogError("not found mapdata.");
                return(false);
            }
            string path1 = AssetPath.LocalMap(param.mapSceneName);
            string src1  = AssetManager.LoadTextData(path1);

            if (src1 == null)
            {
                DebugUtility.LogError("Failed to load " + path1);
                return(false);
            }
            if (!this.Deserialize(JSONParser.parseJSONObject <JSON_Map>(src1)))
            {
                DebugUtility.LogError("Failed to load " + path1);
                return(false);
            }
            string path2 = AssetPath.LocalMap(param.mapSetName);
            string src2  = AssetManager.LoadTextData(path2);

            if (src2 == null)
            {
                DebugUtility.LogError("マップ配置情報\"" + path2 + "\"に存在しない");
                return(false);
            }
            JSON_MapUnit jsonObject = JSONParser.parseJSONObject <JSON_MapUnit>(src2);

            if (jsonObject == null)
            {
                DebugUtility.LogError("マップ配置情報\"" + path2 + "\"のパースに失敗");
                return(false);
            }
            if (jsonObject.enemy == null && jsonObject.arena == null)
            {
                DebugUtility.LogError("敵ユニットの配置情報がマップ配置情報\"" + path2 + "\"に存在しない");
                return(false);
            }
            if (jsonObject.party != null)
            {
                this.mPartyUnitSettings = new List <UnitSetting>(jsonObject.party.Length);
                for (int index = 0; index < jsonObject.party.Length; ++index)
                {
                    this.mPartyUnitSettings.Add(new UnitSetting(jsonObject.party[index]));
                }
            }
            if (jsonObject.party_subs != null && jsonObject.party_subs.Length != 0)
            {
                this.mPartyUnitSubSettings = new List <UnitSubSetting>(jsonObject.party_subs.Length);
                foreach (JSON_MapPartySubCT partySub in jsonObject.party_subs)
                {
                    this.mPartyUnitSubSettings.Add(new UnitSubSetting(partySub));
                }
            }
            if (jsonObject.tricks != null && jsonObject.tricks.Length != 0)
            {
                this.mTrickSettings = new List <TrickSetting>(jsonObject.tricks.Length);
                foreach (JSON_MapTrick trick in jsonObject.tricks)
                {
                    this.mTrickSettings.Add(new TrickSetting(trick));
                }
            }
            if (jsonObject.enemy != null)
            {
                jsonObject.enemy      = jsonObject.ReplacedRandEnemy(this.mRandDeckResult, true);
                this.mNPCUnitSettings = new List <NPCSetting>(jsonObject.enemy.Length);
                for (int index = 0; index < jsonObject.enemy.Length; ++index)
                {
                    this.mNPCUnitSettings.Add(new NPCSetting(jsonObject.enemy[index]));
                }
            }
            if (jsonObject.arena != null)
            {
                this.mArenaUnitSettings = new List <UnitSetting>(jsonObject.arena.Length);
                for (int index = 0; index < jsonObject.arena.Length; ++index)
                {
                    UnitSetting unitSetting = new UnitSetting();
                    unitSetting.uniqname          = (OString)jsonObject.arena[index].name;
                    unitSetting.ai                = (OString)jsonObject.arena[index].ai;
                    unitSetting.pos.x             = (OInt)jsonObject.arena[index].x;
                    unitSetting.pos.y             = (OInt)jsonObject.arena[index].y;
                    unitSetting.dir               = (OInt)jsonObject.arena[index].dir;
                    unitSetting.waitEntryClock    = (OInt)jsonObject.arena[index].wait_e;
                    unitSetting.waitMoveTurn      = (OInt)jsonObject.arena[index].wait_m;
                    unitSetting.waitExitTurn      = (OInt)jsonObject.arena[index].wait_exit;
                    unitSetting.startCtCalc       = (eMapUnitCtCalcType)jsonObject.arena[index].ct_calc;
                    unitSetting.startCtVal        = (OInt)jsonObject.arena[index].ct_val;
                    unitSetting.DisableFirceVoice = jsonObject.arena[index].fvoff != 0;
                    unitSetting.side              = (OInt)1;
                    unitSetting.ai_pos.x          = (OInt)jsonObject.arena[index].ai_x;
                    unitSetting.ai_pos.y          = (OInt)jsonObject.arena[index].ai_y;
                    unitSetting.ai_len            = (OInt)jsonObject.arena[index].ai_len;
                    unitSetting.parent            = (OString)jsonObject.arena[index].parent;
                    if (jsonObject.arena[index].trg != null)
                    {
                        unitSetting.trigger = new EventTrigger();
                        unitSetting.trigger.Deserialize(jsonObject.arena[index].trg);
                    }
                    this.mArenaUnitSettings.Add(unitSetting);
                }
            }
            if (jsonObject.w_cond != null)
            {
                jsonObject.w_cond.CopyTo(this.mWinMonitorCondition);
            }
            if (jsonObject.l_cond != null)
            {
                jsonObject.l_cond.CopyTo(this.mLoseMonitorCondition);
            }
            if (jsonObject.gs != null)
            {
                this.mGimmickEvents = new List <JSON_GimmickEvent>((IEnumerable <JSON_GimmickEvent>)jsonObject.gs);
            }
            return(true);
        }