예제 #1
0
        private List <Unit> LoadRankMatchParty()
        {
            PlayerData  player   = MonoSingleton <GameManager> .Instance.Player;
            PartyData   party    = player.Partys[10];
            List <Unit> unitList = new List <Unit>();

            for (int index1 = 0; index1 < party.MAX_UNIT; ++index1)
            {
                long unitUniqueId = party.GetUnitUniqueID(index1);
                if (unitUniqueId != 0L)
                {
                    UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                    DownloadUtility.DownloadUnit(unitDataByUniqueId.UnitParam, (JobData[])null);
                    Unit unit   = new Unit();
                    int  index2 = player.GetVersusPlacement(PlayerPrefsUtility.RANKMATCH_ID_KEY + (object)index1);
                    if (index2 < 0 || index2 >= this.CurrentMap.PartyUnitSettings.Count)
                    {
                        index2 = 0;
                    }
                    unit.Setup(unitDataByUniqueId, this.CurrentMap.PartyUnitSettings[index2], (Unit.DropItem)null, (Unit.DropItem)null);
                    unitList.Add(unit);
                }
            }
            return(unitList);
        }
예제 #2
0
        private void SetEnemy(MultiTowerFloorParam param)
        {
            int index1 = 0;

            if (param.map == null)
            {
                return;
            }
            string src = AssetManager.LoadTextData(AssetPath.LocalMap(param.map[0].mapSetName));

            if (src == null)
            {
                return;
            }
            JSON_MapUnit jsonObject = JSONParser.parseJSONObject <JSON_MapUnit>(src);

            if (jsonObject == null || !Object.op_Inequality((Object)this.EnemyTemplate, (Object)null))
            {
                return;
            }
            for (int index2 = 0; index2 < jsonObject.enemy.Length; ++index2)
            {
                NPCSetting npcSetting = new NPCSetting(jsonObject.enemy[index2]);
                Unit       data       = new Unit();
                if (data != null && data.Setup((UnitData)null, (UnitSetting)npcSetting, (Unit.DropItem)null, (Unit.DropItem)null) && !data.IsGimmick)
                {
                    GameObject root;
                    if (index1 + 1 > this.mEnemyObject.Count)
                    {
                        root = (GameObject)Object.Instantiate <GameObject>((M0)this.EnemyTemplate);
                        if (!Object.op_Equality((Object)root, (Object)null))
                        {
                            this.mEnemyObject.Add(root);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        root = this.mEnemyObject[index1];
                    }
                    DataSource.Bind <Unit>(root, data);
                    GameParameter.UpdateAll(root);
                    if (Object.op_Inequality((Object)this.EnemyRoot, (Object)null))
                    {
                        root.get_transform().SetParent(this.EnemyRoot.get_transform(), false);
                    }
                    root.SetActive(true);
                    ++index1;
                }
            }
            for (int index2 = index1; index2 < this.mEnemyObject.Count; ++index2)
            {
                this.mEnemyObject[index2].SetActive(false);
            }
            this.EnemyTemplate.SetActive(false);
        }
예제 #3
0
        private void SetEnemies(JSON_MapEnemyUnit[] json)
        {
            for (int index = 0; index < this.UnknownEnemyList.Count; ++index)
            {
                ((Component)this.UnknownEnemyList[index]).get_gameObject().SetActive(false);
            }
            List <JSON_MapEnemyUnit> list            = ((IEnumerable <JSON_MapEnemyUnit>)json).ToList <JSON_MapEnemyUnit>();
            TowerResuponse           towerResuponse  = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerFloorParam          towerFloorParam = (TowerFloorParam)null;

            if (towerResuponse != null)
            {
                towerFloorParam = towerResuponse.GetCurrentFloor();
            }
            this.EnemyUnits.Clear();
            int index1 = 0;

            for (int index2 = 0; index2 < list.Count; ++index2)
            {
                NPCSetting npcSetting = new NPCSetting(list[index2]);
                Unit       data       = new Unit();
                data.Setup((UnitData)null, (UnitSetting)npcSetting, (Unit.DropItem)null, (Unit.DropItem)null);
                if (!data.IsGimmick)
                {
                    TowerEnemyListItem towerEnemyListItem;
                    if (this.EnemyList.Count <= index1)
                    {
                        towerEnemyListItem = (TowerEnemyListItem)((GameObject)Object.Instantiate <GameObject>((M0)this.EnemyTemplate)).GetComponent <TowerEnemyListItem>();
                        ((Component)towerEnemyListItem).get_transform().SetParent(this.EnemiesRoot.get_transform(), false);
                        this.EnemyList.Add(towerEnemyListItem);
                    }
                    else
                    {
                        towerEnemyListItem = this.EnemyList[index1];
                    }
                    if (towerFloorParam != null && towerFloorParam.iname == GlobalVars.SelectedQuestID && MonoSingleton <GameManager> .Instance.TowerEnemyUnit != null)
                    {
                        TowerResuponse.EnemyUnit enemyUnit = MonoSingleton <GameManager> .Instance.TowerEnemyUnit[index2];
                        data.Damage((int)data.MaximumStatus.param.hp - enemyUnit.hp, false);
                    }
                    DataSource.Bind <Unit>(((Component)towerEnemyListItem).get_gameObject(), data);
                    this.EnemyUnits.Add(data);
                    ++index1;
                }
            }
            for (int index2 = 0; index2 < this.EnemyList.Count; ++index2)
            {
                bool flag = index2 < list.Count && index2 < 10;
                ((Component)this.EnemyList[index2]).get_gameObject().SetActive(flag);
                this.EnemyList[index2].UpdateValue();
            }
        }
예제 #4
0
        private void SetEnemies(JSON_MapEnemyUnit[] json)
        {
            for (int index = 0; index < this.UnknownEnemyList.Count; ++index)
            {
                ((Component)this.UnknownEnemyList[index]).get_gameObject().SetActive(false);
            }
            List <JSON_MapEnemyUnit> list = ((IEnumerable <JSON_MapEnemyUnit>)json).Where <JSON_MapEnemyUnit>((Func <JSON_MapEnemyUnit, bool>)(enemy =>
            {
                if (enemy.elem != 0)
                {
                    return(enemy.side == 1);
                }
                return(false);
            })).ToList <JSON_MapEnemyUnit>();
            TowerResuponse  towerResuponse  = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerFloorParam towerFloorParam = (TowerFloorParam)null;

            if (towerResuponse != null)
            {
                towerFloorParam = towerResuponse.GetCurrentFloor();
            }
            this.EnemyUnits.Clear();
            for (int index = 0; index < list.Count; ++index)
            {
                TowerEnemyListItem towerEnemyListItem;
                if (this.EnemyList.Count <= index)
                {
                    towerEnemyListItem = (TowerEnemyListItem)((GameObject)Object.Instantiate <GameObject>((M0)this.EnemyTemplate)).GetComponent <TowerEnemyListItem>();
                    ((Component)towerEnemyListItem).get_transform().SetParent(this.EnemiesRoot.get_transform(), false);
                    this.EnemyList.Add(towerEnemyListItem);
                }
                else
                {
                    towerEnemyListItem = this.EnemyList[index];
                }
                NPCSetting npcSetting = new NPCSetting(list[index]);
                Unit       data       = new Unit();
                data.Setup((UnitData)null, (UnitSetting)npcSetting, (Unit.DropItem)null, (Unit.DropItem)null);
                DataSource.Bind <Unit>(((Component)towerEnemyListItem).get_gameObject(), data);
                this.EnemyUnits.Add(data);
            }
            if (towerFloorParam != null && towerFloorParam.iname == GlobalVars.SelectedQuestID)
            {
                MonoSingleton <GameManager> .Instance.TowerResuponse.CalcEnemyDamage(this.EnemyUnits);
            }
            for (int index = 0; index < this.EnemyList.Count; ++index)
            {
                bool flag = index < list.Count && index < 10;
                ((Component)this.EnemyList[index]).get_gameObject().SetActive(flag);
                this.EnemyList[index].UpdateValue();
            }
        }
예제 #5
0
        private List <Unit> LoadMultiTower()
        {
            List <MyPhoton.MyPlayer> roomPlayerList = PunMonoSingleton <MyPhoton> .Instance.GetRoomPlayerList();

            List <Unit> unitList = new List <Unit>();

            if (this.m_Players == null)
            {
                this.m_Players = new List <MyPhoton.MyPlayer>((IEnumerable <MyPhoton.MyPlayer>)roomPlayerList);
            }
            for (int index1 = 0; index1 < roomPlayerList.Count; ++index1)
            {
                JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index1].json);
                if (photonPlayerParam != null)
                {
                    for (int index2 = 0; index2 < photonPlayerParam.units.Length; ++index2)
                    {
                        if (photonPlayerParam.units[index2] != null && photonPlayerParam.units[index2].sub == 0)
                        {
                            int      index3   = photonPlayerParam.units[index2].place >= 0 ? photonPlayerParam.units[index2].place : index2;
                            UnitData unitdata = new UnitData();
                            if (unitdata != null)
                            {
                                unitdata.Deserialize(photonPlayerParam.units[index2].unitJson);
                                DownloadUtility.DownloadUnit(unitdata.UnitParam, (JobData[])null);
                                Unit unit = new Unit();
                                if (unit != null && unit.Setup(unitdata, this.CurrentMap.PartyUnitSettings[index3], (Unit.DropItem)null, (Unit.DropItem)null))
                                {
                                    unit.OwnerPlayerIndex = photonPlayerParam.playerIndex;
                                    unitList.Add(unit);
                                }
                            }
                        }
                    }
                }
            }
            int count = this.CurrentMap.NPCUnitSettings.Count;
            List <NPCSetting> npcUnitSettings = this.CurrentMap.NPCUnitSettings;

            for (int index = 0; index < count; ++index)
            {
                DownloadUtility.DownloadUnit(npcUnitSettings[index]);
                Unit unit = new Unit();
                if (unit.Setup((UnitData)null, (UnitSetting)npcUnitSettings[index], (Unit.DropItem)null, (Unit.DropItem)null))
                {
                    unitList.Add(unit);
                }
            }
            return(unitList);
        }
예제 #6
0
        private List <Unit> LoadVersusDraftParty()
        {
            List <Unit> unitList = new List <Unit>();

            for (int index1 = 0; index1 < VersusDraftList.VersusDraftPartyUnits.Count; ++index1)
            {
                UnitData versusDraftPartyUnit = VersusDraftList.VersusDraftPartyUnits[index1];
                DownloadUtility.DownloadUnit(versusDraftPartyUnit.UnitParam, (JobData[])null);
                int index2 = index1;
                if (index2 >= this.CurrentMap.PartyUnitSettings.Count)
                {
                    index2 = 0;
                }
                Unit unit = new Unit();
                unit.Setup(versusDraftPartyUnit, this.CurrentMap.PartyUnitSettings[index2], (Unit.DropItem)null, (Unit.DropItem)null);
                unitList.Add(unit);
            }
            return(unitList);
        }
예제 #7
0
        private List <Unit> LoadVersusParty()
        {
            PlayerData  player   = MonoSingleton <GameManager> .Instance.Player;
            PartyData   party    = player.Partys[7];
            List <Unit> unitList = new List <Unit>();

            for (int index = 0; index < party.MAX_UNIT; ++index)
            {
                long unitUniqueId = party.GetUnitUniqueID(index);
                if (unitUniqueId != 0L)
                {
                    UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                    DownloadUtility.DownloadUnit(unitDataByUniqueId.UnitParam, (JobData[])null);
                    Unit unit            = new Unit();
                    int  versusPlacement = player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index);
                    unit.Setup(unitDataByUniqueId, this.CurrentMap.PartyUnitSettings[versusPlacement], (Unit.DropItem)null, (Unit.DropItem)null);
                    unitList.Add(unit);
                }
            }
            return(unitList);
        }
예제 #8
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;
        }