Ejemplo n.º 1
0
        private void Start()
        {
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            GlobalVars.PartyUploadFinished = false;
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitListItem, (UnityEngine.Object)null))
            {
                this.UnitListItem.SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureListItem, (UnityEngine.Object)null))
            {
                this.TreasureListItem.SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureListUnit, (UnityEngine.Object)null))
            {
                this.TreasureListUnit.SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureListArtifact, (UnityEngine.Object)null))
            {
                this.TreasureListArtifact.SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureListConceptCard, (UnityEngine.Object)null))
            {
                this.TreasureListConceptCard.SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Prefab_NewItemBadge, (UnityEngine.Object)null) && this.Prefab_NewItemBadge.get_gameObject().get_activeInHierarchy())
            {
                this.Prefab_NewItemBadge.SetActive(false);
            }
            SceneBattle instance = SceneBattle.Instance;

            GameUtility.DestroyGameObjects(this.mUnitListItems);
            GameUtility.DestroyGameObjects(this.mTreasureListItems);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance, (UnityEngine.Object)null) && instance.ResultData != null)
            {
                this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(instance.Battle.QuestID);

                DataSource.Bind <QuestParam>(((Component)this).get_gameObject(), this.mCurrentQuest);
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.RetryButton, (UnityEngine.Object)null))
                {
                    this.RetryButton.SetActive((long)new TimeSpan(TimeManager.ServerTime.Ticks).Days <= (long)new TimeSpan(player.LoginDate.Ticks).Days&& this.mCurrentQuest.type != QuestTypes.Tutorial && !this.mCurrentQuest.IsCharacterQuest());
                }
                if (this.mCurrentQuest.type == QuestTypes.Tutorial && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TeamUploadButton, (UnityEngine.Object)null))
                {
                    ((Selectable)this.TeamUploadButton).set_interactable(false);
                }
                this.mResultData = instance.ResultData;
                this.mQuestName  = this.mCurrentQuest.iname;
                if (instance.IsPlayingArenaQuest)
                {
                    this.mResultData.Record.playerexp = (OInt)GlobalVars.ResultArenaBattleResponse.got_pexp;
                    this.mResultData.Record.gold      = (OInt)GlobalVars.ResultArenaBattleResponse.got_gold;
                    this.mResultData.Record.unitexp   = (OInt)GlobalVars.ResultArenaBattleResponse.got_uexp;
                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoArenaResultWin))
                    {
                        this.GoArenaResultWin.SetActive(this.mResultData.Record.result == BattleCore.QuestResult.Win);
                    }
                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoArenaResultLose))
                    {
                        this.GoArenaResultLose.SetActive(this.mResultData.Record.result != BattleCore.QuestResult.Win);
                    }
                    if (instance.IsArenaRankupInfo())
                    {
                        MonoSingleton <GameManager> .Instance.Player.UpdateArenaRankTrophyStates(GlobalVars.ResultArenaBattleResponse.new_rank, GlobalVars.ResultArenaBattleResponse.new_rank);
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.UpdateArenaRankTrophyStates(GlobalVars.ResultArenaBattleResponse.new_rank, MonoSingleton <GameManager> .Instance.Player.ArenaRankBest);
                    }
                }
                bool isMultiTower = instance.Battle.IsMultiTower;
                bool isMultiPlay  = instance.Battle.IsMultiPlay;
                for (int index = 0; index < instance.Battle.Units.Count; ++index)
                {
                    Unit unit = instance.Battle.Units[index];
                    if ((isMultiTower || !isMultiPlay || unit.OwnerPlayerIndex == instance.Battle.MyPlayerIndex) && (player.FindUnitDataByUniqueID(unit.UnitData.UniqueID) != null || isMultiTower && unit.Side == EUnitSide.Player))
                    {
                        UnitData unitData = new UnitData();
                        unitData.Setup(unit.UnitData);
                        this.mUnits.Add(unitData);
                        this.mMultiTowerUnitsId.Add(unit.OwnerPlayerIndex);
                    }
                }
                if (instance.IsArenaRankupInfo())
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 40);
                }
            }
            DataSource.Bind <BattleCore.Record>(((Component)this).get_gameObject(), this.mResultData.Record);
            if (this.mResultData != null)
            {
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureListItem, (UnityEngine.Object)null))
                {
                    Transform parent = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TreasureList, (UnityEngine.Object)null) ? this.TreasureListItem.get_transform().get_parent() : this.TreasureList.get_transform();
                    List <QuestResult.DropItemData> items = new List <QuestResult.DropItemData>();
                    for (int index1 = 0; index1 < this.mResultData.Record.items.Count; ++index1)
                    {
                        bool flag = false;
                        for (int index2 = 0; index2 < items.Count; ++index2)
                        {
                            if (items[index2].mIsSecret == this.mResultData.Record.items[index1].mIsSecret)
                            {
                                if (items[index2].IsItem)
                                {
                                    if (items[index2].itemParam == this.mResultData.Record.items[index1].itemParam)
                                    {
                                        items[index2].Gain(1);
                                        flag = true;
                                        break;
                                    }
                                }
                                else if (items[index2].IsConceptCard && items[index2].conceptCardParam == this.mResultData.Record.items[index1].conceptCardParam)
                                {
                                    items[index2].Gain(1);
                                    flag = true;
                                    break;
                                }
                            }
                        }
                        if (!flag)
                        {
                            QuestResult.DropItemData dropItemData = new QuestResult.DropItemData();
                            if (this.mResultData.Record.items[index1].IsItem)
                            {
                                dropItemData.SetupDropItemData(EBattleRewardType.Item, 0L, this.mResultData.Record.items[index1].itemParam.iname, 1);
                                if (this.mResultData.Record.items[index1].itemParam.type != EItemType.Unit)
                                {
                                    ItemData itemDataByItemParam = player.FindItemDataByItemParam(this.mResultData.Record.items[index1].itemParam);
                                    dropItemData.IsNew = !player.ItemEntryExists(this.mResultData.Record.items[index1].itemParam.iname) || (itemDataByItemParam == null || itemDataByItemParam.IsNew);
                                }
                                else
                                {
                                    string iid = this.mResultData.Record.items[index1].itemParam.iname;
                                    if (player.Units.Find((Predicate <UnitData>)(p => p.UnitParam.iname == iid)) == null)
                                    {
                                        dropItemData.IsNew = true;
                                    }
                                }
                            }
                            else if (this.mResultData.Record.items[index1].IsConceptCard)
                            {
                                dropItemData.SetupDropItemData(EBattleRewardType.ConceptCard, 0L, this.mResultData.Record.items[index1].conceptCardParam.iname, 1);
                            }
                            dropItemData.mIsSecret = this.mResultData.Record.items[index1].mIsSecret;
                            items.Add(dropItemData);
                        }
                    }
                    if (this.mCurrentQuest != null && this.mCurrentQuest.IsVersus)
                    {
                        VersusCoinParam coinParam = MonoSingleton <GameManager> .Instance.GetVersusCoinParam(this.mCurrentQuest.iname);

                        if (coinParam != null)
                        {
                            QuestResult.DropItemData dropItemData1 = items.Find((Predicate <QuestResult.DropItemData>)(x => x.Param.iname == coinParam.coin_iname));
                            if (dropItemData1 != null)
                            {
                                dropItemData1.Gain((int)this.mResultData.Record.pvpcoin);
                            }
                            else if ((int)this.mResultData.Record.pvpcoin > 0)
                            {
                                QuestResult.DropItemData dropItemData2 = new QuestResult.DropItemData();
                                dropItemData2.Setup(0L, coinParam.coin_iname, (int)this.mResultData.Record.pvpcoin);
                                dropItemData2.mIsSecret = false;
                                dropItemData2.IsNew     = !player.ItemEntryExists(coinParam.coin_iname);
                                items.Add(dropItemData2);
                            }
                        }
                    }
                    this.CreateItemObject(items, parent);
                    this.CreateArtifactObjects(parent);
                    this.CreateGoldObjects(parent);
                }
                this.ApplyQuestCampaignParams(instance.Battle.QuestCampaignIds);
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitListItem, (UnityEngine.Object)null))
                {
                    if (instance.Battle.IsMultiTower)
                    {
                        this.AddExpPlayerMultiTower();
                    }
                    else
                    {
                        this.AddExpPlayer();
                    }
                }
                GlobalVars.PlayerExpOld.Set(this.mResultData.StartExp);
                GlobalVars.PlayerExpNew.Set(this.mResultData.StartExp + (int)this.mResultData.Record.playerexp);
                GlobalVars.PlayerLevelChanged.Set(player.Lv != PlayerData.CalcLevelFromExp(this.mResultData.StartExp));
                this.RefreshQuestMissionReward();
                if (!string.IsNullOrEmpty(this.Star_ClearTrigger))
                {
                    for (int index = 0; index < this.mObjectiveStars.Count; ++index)
                    {
                        if ((this.mCurrentQuest.clear_missions & 1 << index) != 0)
                        {
                            GameUtility.SetAnimatorTrigger(this.mObjectiveStars[index], this.Star_ClearTrigger);
                        }
                    }
                }
                player.OnGoldChange((int)this.mResultData.Record.gold);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.StarKakuninButton, (UnityEngine.Object)null))
            {
                // ISSUE: method pointer
                ((UnityEvent)this.StarKakuninButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OnStarKakuninButtonClick)));
                this.mContinueStarAnimation = false;
            }
            GlobalVars.CreateAutoMultiTower = false;
            GlobalVars.InvtationSameUser    = false;
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ResultSkipButton, (UnityEngine.Object)null))
            {
                return;
            }
            ((Component)this.ResultSkipButton).get_gameObject().SetActive(false);
        }
Ejemplo n.º 2
0
        private void Start()
        {
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            if (Object.op_Inequality((Object)this.UnitListItem, (Object)null))
            {
                this.UnitListItem.SetActive(false);
            }
            if (Object.op_Inequality((Object)this.TreasureListItem, (Object)null))
            {
                this.TreasureListItem.SetActive(false);
            }
            if (Object.op_Inequality((Object)this.Prefab_NewItemBadge, (Object)null) && this.Prefab_NewItemBadge.get_gameObject().get_activeInHierarchy())
            {
                this.Prefab_NewItemBadge.SetActive(false);
            }
            SceneBattle instance = SceneBattle.Instance;

            GameUtility.DestroyGameObjects(this.mUnitListItems);
            GameUtility.DestroyGameObjects(this.mTreasureListItems);
            if (Object.op_Inequality((Object)instance, (Object)null) && instance.ResultData != null)
            {
                this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(instance.Battle.QuestID);

                DataSource.Bind <QuestParam>(((Component)this).get_gameObject(), this.mCurrentQuest);
                if (Object.op_Inequality((Object)this.RetryButton, (Object)null))
                {
                    this.RetryButton.SetActive((long)new TimeSpan(TimeManager.ServerTime.Ticks).Days <= (long)new TimeSpan(player.LoginDate.Ticks).Days&& this.mCurrentQuest.type != QuestTypes.Tutorial && !this.mCurrentQuest.IsCharacterQuest());
                    if (this.mCurrentQuest.GetChallangeCount() >= this.mCurrentQuest.GetChallangeLimit() && this.mCurrentQuest.GetChallangeLimit() > 0)
                    {
                        ((Selectable)this.RetryButton.GetComponent <Button>()).set_interactable(false);
                    }
                }
                this.mResultData = instance.ResultData;
                this.mQuestName  = this.mCurrentQuest.iname;
                if (instance.IsPlayingArenaQuest)
                {
                    this.mResultData.Record.playerexp = (OInt)GlobalVars.ResultArenaBattleResponse.got_pexp;
                    this.mResultData.Record.gold      = (OInt)GlobalVars.ResultArenaBattleResponse.got_gold;
                    this.mResultData.Record.unitexp   = (OInt)GlobalVars.ResultArenaBattleResponse.got_uexp;
                    if (Object.op_Implicit((Object)this.GoArenaResultWin))
                    {
                        this.GoArenaResultWin.SetActive(this.mResultData.Record.result == BattleCore.QuestResult.Win);
                    }
                    if (Object.op_Implicit((Object)this.GoArenaResultLose))
                    {
                        this.GoArenaResultLose.SetActive(this.mResultData.Record.result != BattleCore.QuestResult.Win);
                    }
                }
                for (int index = 0; index < instance.Battle.Units.Count; ++index)
                {
                    Unit unit = instance.Battle.Units[index];
                    if ((!instance.Battle.IsMultiPlay || unit.OwnerPlayerIndex == instance.Battle.MyPlayerIndex) && player.FindUnitDataByUniqueID(unit.UnitData.UniqueID) != null)
                    {
                        UnitData unitData = new UnitData();
                        unitData.Setup(unit.UnitData);
                        this.mUnits.Add(unitData);
                    }
                }
                if (!string.IsNullOrEmpty(this.Star_ClearTrigger))
                {
                    for (int index = 0; index < this.ObjectiveStars.Length; ++index)
                    {
                        if (((int)this.mCurrentQuest.clear_missions & 1 << index) != 0)
                        {
                            GameUtility.SetAnimatorTrigger(this.ObjectiveStars[index], this.Star_ClearTrigger);
                        }
                    }
                }
                if (instance.IsArenaRankupInfo())
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 40);
                }
            }
            DataSource.Bind <BattleCore.Record>(((Component)this).get_gameObject(), this.mResultData.Record);
            if (this.mResultData != null)
            {
                if (Object.op_Inequality((Object)this.TreasureListItem, (Object)null))
                {
                    Transform       parent = !Object.op_Inequality((Object)this.TreasureList, (Object)null) ? this.TreasureListItem.get_transform().get_parent() : this.TreasureList.get_transform();
                    List <ItemData> items  = new List <ItemData>();
                    for (int index1 = 0; index1 < this.mResultData.Record.items.Count; ++index1)
                    {
                        bool flag = false;
                        for (int index2 = 0; index2 < items.Count; ++index2)
                        {
                            if (items[index2].Param == this.mResultData.Record.items[index1])
                            {
                                items[index2].Gain(1);
                                flag = true;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            ItemData itemDataByItemParam = player.FindItemDataByItemParam(this.mResultData.Record.items[index1]);
                            ItemData itemData            = new ItemData();
                            itemData.Setup(0L, this.mResultData.Record.items[index1].iname, 1);
                            if (this.mResultData.Record.items[index1].type != EItemType.Unit)
                            {
                                itemData.IsNew = !player.ItemEntryExists(this.mResultData.Record.items[index1].iname) || (itemDataByItemParam == null || itemDataByItemParam.IsNew);
                            }
                            else
                            {
                                // ISSUE: object of a compiler-generated type is created
                                // ISSUE: reference to a compiler-generated method
                                itemData.IsNew = this.mResultData.GetUnits.Params.FindIndex(new Predicate <UnitGetParam.Set>(new QuestResult.\u003CStart\u003Ec__AnonStorey268()
                                {
                                    iid = this.mResultData.Record.items[index1].iname
                                }.\u003C\u003Em__2CB)) != -1;
                            }
                            items.Add(itemData);
                        }
                    }
                    this.CreateItemObject(items, parent);
                }
                this.ApplyQuestCampaignParams(instance.Battle.QuestCampaignIds);
                if (Object.op_Inequality((Object)this.UnitListItem, (Object)null))
                {
                    this.AddExpPlayer();
                }
                GlobalVars.PlayerExpOld.Set(this.mResultData.StartExp);
                GlobalVars.PlayerExpNew.Set(this.mResultData.StartExp + (int)this.mResultData.Record.playerexp);
                GlobalVars.PlayerLevelChanged.Set(player.Lv != PlayerData.CalcLevelFromExp(this.mResultData.StartExp));
                if ((int)this.mResultData.Record.gold > 0)
                {
                    AnalyticsManager.TrackCurrencyObtain(AnalyticsManager.CurrencyType.Zeni, AnalyticsManager.CurrencySubType.FREE, (long)(int)this.mResultData.Record.gold, "Quests", (Dictionary <string, object>)null);
                }
            }
            if (!Object.op_Inequality((Object)this.StarKakuninButton, (Object)null))
            {
                return;
            }
            // ISSUE: method pointer
            ((UnityEvent)this.StarKakuninButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OnStarKakuninButtonClick)));
            this.mContinueStarAnimation = false;
        }