private void Refresh()
        {
            UnitData data1 = (UnitData)null;

            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)UnitEnhanceV3.Instance))
            {
                data1 = UnitEnhanceV3.Instance.CurrentUnit;
            }
            if (data1 == null)
            {
                data1 = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);
            }
            if (data1 == null && AbilityDetailWindow.BindUnit != null)
            {
                data1 = AbilityDetailWindow.BindUnit;
            }
            if (data1 == null && AbilityDetailWindow.BindAbility == null)
            {
                DebugUtility.LogError("Not found bind unit data.");
            }
            else
            {
                if (AbilityDetailWindow.BindAbility != null)
                {
                    DataSource.Bind <AbilityParam>(((Component)this).get_gameObject(), AbilityDetailWindow.BindAbility);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SkillTemplate, (UnityEngine.Object)null))
                    {
                        List <AbilityDetailWindow.ViewContentParam> viewContentParams = new List <AbilityDetailWindow.ViewContentParam>();
                        if (AbilityDetailWindow.BindAbility.skills != null)
                        {
                            for (int index = 0; index < AbilityDetailWindow.BindAbility.skills.Length; ++index)
                            {
                                SkillParam skillParam = MonoSingleton <GameManager> .Instance.GetSkillParam(AbilityDetailWindow.BindAbility.skills[index].iname);

                                AbilityDetailWindow.AddSkillParam(viewContentParams, skillParam, (SkillDeriveParam)null);
                            }
                        }
                        for (int index = 0; index < viewContentParams.Count; ++index)
                        {
                            GameObject      gameObject          = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.SkillTemplate);
                            SkillDeriveList componentInChildren = (SkillDeriveList)gameObject.GetComponentInChildren <SkillDeriveList>();
                            componentInChildren.Setup(viewContentParams[index].m_SkillParam, viewContentParams[index].m_SkillDeriveParams);
                            gameObject.get_transform().SetParent(this.SkillLayoutParent, false);
                            gameObject.SetActive(true);
                            this.m_SkillDeriveList.Add(componentInChildren);
                        }
                    }
                }
                else
                {
                    AbilityData  data2        = data1.GetAbilityData((long)GlobalVars.SelectedAbilityUniqueID);
                    AbilityParam abilityParam = MonoSingleton <GameManager> .Instance.GetAbilityParam((string)GlobalVars.SelectedAbilityID);

                    QuestClearUnlockUnitDataParam[]      unlockedSkills          = data1.UnlockedSkills;
                    List <QuestClearUnlockUnitDataParam> unlockUnitDataParamList = new List <QuestClearUnlockUnitDataParam>();
                    QuestClearUnlockUnitDataParam[]      allUnlockUnitDatas      = MonoSingleton <GameManager> .Instance.MasterParam.GetAllUnlockUnitDatas();

                    if (allUnlockUnitDatas != null)
                    {
                        for (int index = 0; index < allUnlockUnitDatas.Length; ++index)
                        {
                            QuestClearUnlockUnitDataParam param = allUnlockUnitDatas[index];
                            if (param.type == QuestClearUnlockUnitDataParam.EUnlockTypes.Skill && param.uid == data1.UnitID && param.parent_id == abilityParam.iname && (unlockedSkills == null || Array.FindIndex <QuestClearUnlockUnitDataParam>(unlockedSkills, (Predicate <QuestClearUnlockUnitDataParam>)(p => p.iname == param.iname)) == -1))
                            {
                                unlockUnitDataParamList.Add(param);
                            }
                        }
                    }
                    if (data2 != null && data2.Param != null && data2.IsDeriveBaseAbility)
                    {
                        data2 = data2.DerivedAbility;
                    }
                    RarityParam rarityParam = MonoSingleton <GameManager> .Instance.GetRarityParam((int)data1.UnitParam.raremax);

                    int num = Math.Min((int)rarityParam.UnitLvCap + (int)rarityParam.UnitAwakeLvCap, abilityParam.GetRankCap());
                    DataSource.Bind <UnitData>(((Component)this).get_gameObject(), data1);
                    DataSource.Bind <AbilityData>(((Component)this).get_gameObject(), data2);
                    AbilityParam data3 = abilityParam;
                    if (AbilityDetailWindow.IsEnableSkillChange)
                    {
                        string key = data1.SearchAbilityReplacementSkill(abilityParam.iname);
                        if (!string.IsNullOrEmpty(key))
                        {
                            data3 = MonoSingleton <GameManager> .Instance.GetAbilityParam(key);
                        }
                    }
                    DataSource.Bind <AbilityParam>(((Component)this).get_gameObject(), data3);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SkillTemplate, (UnityEngine.Object)null))
                    {
                        List <AbilityDetailWindow.ViewContentParam> viewContentParams = new List <AbilityDetailWindow.ViewContentParam>();
                        if (data2 != null && data2.LearningSkills != null)
                        {
                            for (int index1 = 0; index1 < data2.LearningSkills.Length; ++index1)
                            {
                                if (data2.LearningSkills[index1].locklv <= num)
                                {
                                    string str1 = data2.LearningSkills[index1].iname;
                                    if (unlockedSkills != null)
                                    {
                                        for (int index2 = 0; index2 < unlockedSkills.Length; ++index2)
                                        {
                                            if (unlockedSkills[index2].old_id == str1)
                                            {
                                                str1 = unlockedSkills[index2].new_id;
                                                break;
                                            }
                                        }
                                    }
                                    if (AbilityDetailWindow.IsEnableSkillChange)
                                    {
                                        string str2 = data1.SearchReplacementSkill(str1);
                                        if (!string.IsNullOrEmpty(str2))
                                        {
                                            str1 = str2;
                                        }
                                    }
                                    SkillData[] deriveSkills = data2.FindDeriveSkills(str1);
                                    if (deriveSkills.Length > 0)
                                    {
                                        foreach (SkillData skillData in deriveSkills)
                                        {
                                            AbilityDetailWindow.AddSkillParam(viewContentParams, skillData.SkillParam, skillData.DeriveParam);
                                        }
                                    }
                                    else
                                    {
                                        AbilityDetailWindow.AddSkillParam(viewContentParams, MonoSingleton <GameManager> .Instance.GetSkillParam(str1), (SkillDeriveParam)null);
                                    }
                                }
                            }
                            if (unlockedSkills != null)
                            {
                                for (int index = 0; index < unlockedSkills.Length; ++index)
                                {
                                    if (unlockedSkills[index].add && unlockedSkills[index].parent_id == data2.AbilityID)
                                    {
                                        AbilityDetailWindow.AddSkillParam(viewContentParams, MonoSingleton <GameManager> .Instance.GetSkillParam(unlockedSkills[index].new_id), (SkillDeriveParam)null);
                                    }
                                }
                            }
                        }
                        else
                        {
                            for (int index = 0; index < abilityParam.skills.Length; ++index)
                            {
                                if (abilityParam.skills[index].locklv <= num)
                                {
                                    AbilityDetailWindow.AddSkillParam(viewContentParams, MonoSingleton <GameManager> .Instance.GetSkillParam(abilityParam.skills[index].iname), (SkillDeriveParam)null);
                                }
                            }
                        }
                        if (data1.MasterAbility != null && data1.CollaboAbility != null)
                        {
                            AbilityData abilityData = data1.MasterAbility;
                            if (data1.MasterAbility.IsDeriveBaseAbility)
                            {
                                abilityData = data1.MasterAbility.DerivedAbility;
                            }
                            if (abilityData == data2)
                            {
                                using (List <SkillData> .Enumerator enumerator = data1.CollaboAbility.Skills.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        SkillData current = enumerator.Current;
                                        AbilityDetailWindow.AddSkillParam(viewContentParams, current.SkillParam, (SkillDeriveParam)null);
                                    }
                                }
                            }
                        }
                        for (int index = 0; index < viewContentParams.Count; ++index)
                        {
                            GameObject      gameObject          = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.SkillTemplate);
                            SkillDeriveList componentInChildren = (SkillDeriveList)gameObject.GetComponentInChildren <SkillDeriveList>();
                            componentInChildren.Setup(viewContentParams[index].m_SkillParam, viewContentParams[index].m_SkillDeriveParams);
                            gameObject.get_transform().SetParent(this.SkillLayoutParent, false);
                            gameObject.SetActive(true);
                            this.m_SkillDeriveList.Add(componentInChildren);
                        }
                        for (int index = 0; index < unlockUnitDataParamList.Count; ++index)
                        {
                            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.SkillLockedTemplate);
                            DataSource.Bind <SkillParam>(gameObject, MonoSingleton <GameManager> .Instance.GetSkillParam(unlockUnitDataParamList[index].new_id));
                            DataSource.Bind <QuestClearUnlockUnitDataParam>(gameObject, unlockUnitDataParamList[index]);
                            gameObject.get_transform().SetParent(this.SkillLayoutParent, false);
                            gameObject.SetActive(true);
                        }
                        for (int index = 0; index < viewContentParams.Count; ++index)
                        {
                            if (viewContentParams[index].m_SkillDeriveParams != null && viewContentParams[index].m_SkillDeriveParams.Count >= 1)
                            {
                                this.m_ShowBaseToggle.set_interactable(true);
                                break;
                            }
                        }
                    }
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
            }
        }
 public void SetCardSkill(ConceptCardSkillDatailData data)
 {
     this.SwitchObject(true, this.mCardSkillObject, this.mCardAbilityObject);
     this.SwitchObject(data.type == ConceptCardDetailAbility.ShowType.Skill, this.mCardSkillNameObject, this.mCardAbilityNameObject);
     if (data.skill_data == null)
     {
         this.SetText(this.mCardAbilityDescription, string.Empty);
     }
     else
     {
         DataSource.Bind <AbilityData>(((Component)this).get_gameObject(), data.effect == null || data.effect.Ability == null ? (AbilityData)null : data.effect.Ability);
         DataSource.Bind <SkillData>(((Component)this).get_gameObject(), data.skill_data);
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append(data.skill_data.SkillParam.expr);
         this.SetText(this.mCardAbilityDescription, stringBuilder.ToString());
         if (Object.op_Inequality((Object)this.mCardSkillStatusList, (Object)null))
         {
             ((Component)this.mCardSkillStatusList).get_gameObject().SetActive(false);
         }
         if (data.skill_data.Condition == ESkillCondition.CardSkill && Object.op_Inequality((Object)this.mCardSkillStatusList, (Object)null) && data.skill_data != null)
         {
             ((Component)this.mCardSkillStatusList).get_gameObject().SetActive(true);
             BaseStatus status       = new BaseStatus();
             BaseStatus scale_status = new BaseStatus();
             BaseStatus baseStatus1  = new BaseStatus();
             BaseStatus baseStatus2  = new BaseStatus();
             SkillData.GetPassiveBuffStatus(data.skill_data, (BuffEffect[])null, EElement.None, ref status, ref scale_status);
             if (data.effect != null && data.effect.AddCardSkillBuffEffectAwake != null)
             {
                 BaseStatus total_add   = new BaseStatus();
                 BaseStatus total_scale = new BaseStatus();
                 data.effect.AddCardSkillBuffEffectAwake.GetBaseStatus(ref total_add, ref total_scale);
                 baseStatus1.Add(total_add);
                 baseStatus2.Add(total_scale);
             }
             if (data.effect != null && data.effect.AddCardSkillBuffEffectLvMax != null)
             {
                 BaseStatus total_add   = new BaseStatus();
                 BaseStatus total_scale = new BaseStatus();
                 data.effect.AddCardSkillBuffEffectLvMax.GetBaseStatus(ref total_add, ref total_scale);
                 baseStatus1.Add(total_add);
                 baseStatus2.Add(total_scale);
             }
             if (ConceptCardDescription.EnhanceInfo == null)
             {
                 this.mCardSkillStatusList.SetValues_TotalAndBonus(status, scale_status, status, scale_status, baseStatus1, baseStatus2, baseStatus1, baseStatus2);
             }
             else
             {
                 int        lvCap         = (int)ConceptCardDescription.EnhanceInfo.Target.LvCap;
                 int        predictLv     = ConceptCardDescription.EnhanceInfo.predictLv;
                 int        predictAwake  = ConceptCardDescription.EnhanceInfo.predictAwake;
                 int        awakeCountCap = ConceptCardDescription.EnhanceInfo.Target.AwakeCountCap;
                 BaseStatus add           = new BaseStatus();
                 BaseStatus scale         = new BaseStatus();
                 ConceptCardParam.GetSkillAllStatus(data.skill_data.SkillID, lvCap, predictLv, ref add, ref scale);
                 BaseStatus total_add1   = new BaseStatus();
                 BaseStatus total_scale1 = new BaseStatus();
                 data.effect.GetAddCardSkillBuffStatusAwake(predictAwake, awakeCountCap, ref total_add1, ref total_scale1);
                 BaseStatus total_add2   = new BaseStatus();
                 BaseStatus total_scale2 = new BaseStatus();
                 data.effect.GetAddCardSkillBuffStatusLvMax(predictLv, lvCap, predictAwake, ref total_add2, ref total_scale2);
                 BaseStatus modBonusAdd = new BaseStatus();
                 BaseStatus modBonusMul = new BaseStatus();
                 modBonusAdd.Add(total_add1);
                 modBonusAdd.Add(total_add2);
                 modBonusMul.Add(total_scale1);
                 modBonusMul.Add(total_scale2);
                 this.mCardSkillStatusList.SetValues_TotalAndBonus(status, scale_status, add, scale, baseStatus1, baseStatus2, modBonusAdd, modBonusMul);
             }
         }
         if (Object.op_Inequality((Object)this.mLock, (Object)null))
         {
             this.mLock.SetActive(data.type == ConceptCardDetailAbility.ShowType.LockSkill);
         }
         this.mShowData = data;
         GameParameter.UpdateAll(((Component)this).get_gameObject());
     }
 }
Example #3
0
        public void UpdateLearningsSkill(bool locked)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            AbilityData.\u003CUpdateLearningsSkill\u003Ec__AnonStorey27F skillCAnonStorey27F = new AbilityData.\u003CUpdateLearningsSkill\u003Ec__AnonStorey27F();
            if (this.mSkills == null)
            {
                return;
            }
            AbilityParam abilityParam = this.Param;

            this.mSkills.Clear();
            if (abilityParam == null || abilityParam.skills.Length == 0)
            {
                return;
            }
            // ISSUE: reference to a compiler-generated field
            skillCAnonStorey27F.unlocks = (QuestClearUnlockUnitDataParam[])null;
            if (this.Owner != null)
            {
                // ISSUE: reference to a compiler-generated field
                skillCAnonStorey27F.unlocks = this.Owner.UnlockedSkills;
            }
            for (int index1 = 0; index1 < abilityParam.skills.Length; ++index1)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                AbilityData.\u003CUpdateLearningsSkill\u003Ec__AnonStorey27E skillCAnonStorey27E = new AbilityData.\u003CUpdateLearningsSkill\u003Ec__AnonStorey27E();
                if (!locked || (int)this.mRank >= abilityParam.skills[index1].locklv)
                {
                    SkillData skillData = new SkillData();
                    // ISSUE: reference to a compiler-generated field
                    skillCAnonStorey27E.skillId = abilityParam.skills[index1].iname;
                    // ISSUE: reference to a compiler-generated field
                    if (skillCAnonStorey27F.unlocks != null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated method
                        int index2 = Array.FindIndex <QuestClearUnlockUnitDataParam>(skillCAnonStorey27F.unlocks, new Predicate <QuestClearUnlockUnitDataParam>(skillCAnonStorey27E.\u003C\u003Em__22D));
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated field
                        if (index2 != -1 && !skillCAnonStorey27F.unlocks[index2].add && skillCAnonStorey27F.unlocks[index2].parent_id == this.AbilityID)
                        {
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated field
                            skillCAnonStorey27E.skillId = skillCAnonStorey27F.unlocks[index2].new_id;
                        }
                    }
                    // ISSUE: reference to a compiler-generated field
                    skillData.Setup(skillCAnonStorey27E.skillId, (int)this.mRank, (int)this.mRankCap, (MasterParam)null);
                    this.mSkills.Add(skillData);
                }
            }
            // ISSUE: reference to a compiler-generated field
            if (skillCAnonStorey27F.unlocks == null)
            {
                return;
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            AbilityData.\u003CUpdateLearningsSkill\u003Ec__AnonStorey280 skillCAnonStorey280 = new AbilityData.\u003CUpdateLearningsSkill\u003Ec__AnonStorey280();
            // ISSUE: reference to a compiler-generated field
            skillCAnonStorey280.\u003C\u003Ef__ref\u0024639 = skillCAnonStorey27F;
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            for (skillCAnonStorey280.i = 0; skillCAnonStorey280.i < skillCAnonStorey27F.unlocks.Length; ++skillCAnonStorey280.i)
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated method
                if (skillCAnonStorey27F.unlocks[skillCAnonStorey280.i].add && !(skillCAnonStorey27F.unlocks[skillCAnonStorey280.i].parent_id != this.AbilityID) && this.mSkills.Find(new Predicate <SkillData>(skillCAnonStorey280.\u003C\u003Em__22E)) == null)
                {
                    SkillData skillData = new SkillData();
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    skillData.Setup(skillCAnonStorey27F.unlocks[skillCAnonStorey280.i].new_id, (int)this.mRank, (int)this.mRankCap, (MasterParam)null);
                    this.mSkills.Add(skillData);
                }
            }
        }
        private void Start()
        {
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.RangeTemplate, (UnityEngine.Object)null))
            {
                this.RangeTemplate.SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SpaceTemplate, (UnityEngine.Object)null))
            {
                this.SpaceTemplate.SetActive(false);
            }
            UnitData unitDataByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);

            if (unitDataByUniqueId == null)
            {
                DebugUtility.Log("Not Selected Unit!!");
            }
            else
            {
                JobData jobData             = unitDataByUniqueId.CurrentJob;
                long    selectedJobUniqueId = (long)GlobalVars.SelectedJobUniqueID;
                for (int index = 0; index < unitDataByUniqueId.Jobs.Length; ++index)
                {
                    if (unitDataByUniqueId.Jobs[index].UniqueID == selectedJobUniqueId)
                    {
                        jobData = unitDataByUniqueId.Jobs[index];
                        break;
                    }
                }
                SkillData       attackSkill    = jobData.GetAttackSkill();
                int             attackRangeMax = unitDataByUniqueId.GetAttackRangeMax(attackSkill);
                int             attackRangeMin = unitDataByUniqueId.GetAttackRangeMin(attackSkill);
                ESelectType     selectRange    = attackSkill.SkillParam.select_range;
                GridLayoutGroup component1     = (GridLayoutGroup)((Component)this.Parent).GetComponent <GridLayoutGroup>();
                if (UnityEngine.Object.op_Equality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    DebugUtility.Log("Parent is not attachment GridLayoutGroup");
                }
                else
                {
                    component1.set_constraintCount(Mathf.Max(attackRangeMax * 2 + 1, UnitAttackRangeWindow.RANGE_BLOCK_MAX));
                    if (component1.get_constraintCount() > UnitAttackRangeWindow.RANGE_BLOCK_MAX + 1)
                    {
                        component1.set_cellSize(new Vector2((float)this.BlockSize, (float)this.BlockSize));
                        component1.set_spacing(new Vector2(5f, 5f));
                    }
                    int           num1        = component1.get_constraintCount() / 2;
                    List <string> stringList1 = new List <string>();
                    List <string> stringList2;
                    switch (selectRange)
                    {
                    case ESelectType.Diamond:
                        stringList2 = this.GetDiamondRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Square:
                        stringList2 = this.GetSquareRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Laser:
                        stringList2 = this.GetLaserRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.All:
                        stringList2 = this.GetAllRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Bishop:
                        stringList2 = this.GetBishopRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Horse:
                        stringList2 = this.GetHorseRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;

                    default:
                        stringList2 = this.GetCrossRange(new Vector2((float)num1, (float)num1), attackRangeMin, attackRangeMax);
                        break;
                    }
                    for (int index1 = 0; index1 < component1.get_constraintCount(); ++index1)
                    {
                        for (int index2 = 0; index2 < component1.get_constraintCount(); ++index2)
                        {
                            string     str         = index2.ToString() + "," + index1.ToString();
                            GameObject gameObject1 = this.SpaceTemplate;
                            if (stringList2.IndexOf(str) != -1 || index2 == num1 && index1 == num1)
                            {
                                gameObject1 = this.RangeTemplate;
                            }
                            GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)gameObject1);
                            gameObject2.get_transform().SetParent(this.Parent, false);
                            ((UnityEngine.Object)gameObject2).set_name("Grid" + index2.ToString() + "-" + index1.ToString());
                            gameObject2.SetActive(true);
                            if (!UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject1, (UnityEngine.Object) this.SpaceTemplate))
                            {
                                Image component2 = (Image)gameObject2.GetComponent <Image>();
                                if (index2 == num1 && index1 == num1)
                                {
                                    ((Graphic)component2).set_color(Color32.op_Implicit(new Color32((byte)0, byte.MaxValue, byte.MaxValue, byte.MaxValue)));
                                }
                                else
                                {
                                    ((Graphic)component2).set_color(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue)));
                                }
                            }
                        }
                    }
                    int    num2 = attackRangeMin + 1;
                    string str1 = LocalizedText.Get("sys.TEXT_RANGE_DEFAULT", (object)num2.ToString(), (object)attackRangeMax.ToString());
                    if (num2 == attackRangeMax)
                    {
                        str1 = LocalizedText.Get("sys.TEXT_RANGE_MINMAX_EQUAL", new object[1]
                        {
                            (object)attackRangeMax
                        });
                    }
                    if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.RangeMinMax, (UnityEngine.Object)null))
                    {
                        return;
                    }
                    this.RangeMinMax.set_text(str1);
                }
            }
        }
Example #5
0
        private static BattleSuspend.Data makeSaveData()
        {
            SceneBattle instance = SceneBattle.Instance;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                return((BattleSuspend.Data)null);
            }
            BattleCore battle = instance.Battle;

            if (battle == null)
            {
                return((BattleSuspend.Data)null);
            }
            BattleSuspend.Data        data = new BattleSuspend.Data();
            BattleSuspend.Data.Header hdr  = data.hdr;
            hdr.apv = Application.get_version();
            hdr.arv = AssetManager.AssetRevision;
            hdr.qid = battle.QuestID;
            hdr.bid = battle.BtlID;
            hdr.cat = GameUtility.Config_AutoMode_Treasure.Value;
            hdr.cad = GameUtility.Config_AutoMode_DisableSkill.Value;
            data.uil.Clear();
            using (List <Unit> .Enumerator enumerator1 = battle.AllUnits.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    Unit current1 = enumerator1.Current;
                    if (current1 != null)
                    {
                        BattleSuspend.Data.UnitInfo unitInfo = new BattleSuspend.Data.UnitInfo();
                        unitInfo.nam = current1.UnitName;
                        unitInfo.nhp = (int)current1.CurrentStatus.param.hp;
                        unitInfo.chp = current1.UnitChangedHp;
                        unitInfo.gem = current1.Gems;
                        unitInfo.ugx = current1.x;
                        unitInfo.ugy = current1.y;
                        unitInfo.dir = (int)current1.Direction;
                        unitInfo.ufg = current1.UnitFlag;
                        unitInfo.isb = current1.IsSub;
                        unitInfo.crt = (int)current1.ChargeTime;
                        unitInfo.tgi = BattleSuspend.GetIdxFromAllUnits(battle, current1.Target);
                        unitInfo.rti = BattleSuspend.GetIdxFromAllUnits(battle, current1.RageTarget);
                        unitInfo.cti = -1;
                        if (current1.CastSkill != null)
                        {
                            unitInfo.csi = current1.CastSkill.SkillParam.iname;
                            unitInfo.ctm = (int)current1.CastTime;
                            unitInfo.cid = (int)current1.CastIndex;
                            if (current1.CastSkillGridMap != null)
                            {
                                unitInfo.cgw = current1.CastSkillGridMap.w;
                                unitInfo.cgh = current1.CastSkillGridMap.h;
                                if (current1.CastSkillGridMap.data != null)
                                {
                                    unitInfo.cgm = new int[current1.CastSkillGridMap.data.Length];
                                    for (int index = 0; index < current1.CastSkillGridMap.data.Length; ++index)
                                    {
                                        unitInfo.cgm[index] = !current1.CastSkillGridMap.data[index] ? 0 : 1;
                                    }
                                }
                            }
                            unitInfo.ctx = current1.GridTarget == null ? -1 : current1.GridTarget.x;
                            unitInfo.cty = current1.GridTarget == null ? -1 : current1.GridTarget.y;
                            unitInfo.cti = BattleSuspend.GetIdxFromAllUnits(battle, current1.UnitTarget);
                        }
                        unitInfo.dct = current1.DeathCount;
                        unitInfo.ajw = current1.AutoJewel;
                        unitInfo.wtt = current1.WaitClock;
                        unitInfo.mvt = current1.WaitMoveTurn;
                        unitInfo.acc = current1.ActionCount;
                        unitInfo.tuc = current1.TurnCount;
                        unitInfo.trc = current1.EventTrigger == null ? 0 : current1.EventTrigger.Count;
                        unitInfo.klc = current1.KillCount;
                        if (current1.EntryTriggers != null)
                        {
                            unitInfo.etr = new int[current1.EntryTriggers.Count];
                            for (int index = 0; index < current1.EntryTriggers.Count; ++index)
                            {
                                unitInfo.etr[index] = !current1.EntryTriggers[index].on ? 0 : 1;
                            }
                        }
                        unitInfo.aid = (int)current1.AIActionIndex;
                        unitInfo.atu = (int)current1.AIActionTurnCount;
                        unitInfo.apt = (int)current1.AIPatrolIndex;
                        unitInfo.boi = current1.CreateBreakObjId;
                        unitInfo.boc = current1.CreateBreakObjClock;
                        unitInfo.tid = current1.TeamId;
                        unitInfo.fst = (int)current1.FriendStates;
                        unitInfo.acl.Clear();
                        for (int index1 = 0; index1 < current1.AbilityChangeLists.Count; ++index1)
                        {
                            Unit.AbilityChange abilityChangeList = current1.AbilityChangeLists[index1];
                            if (abilityChangeList != null && abilityChangeList.mDataLists.Count != 0)
                            {
                                BattleSuspend.Data.UnitInfo.AbilChg abilChg = new BattleSuspend.Data.UnitInfo.AbilChg();
                                for (int index2 = 0; index2 < abilityChangeList.mDataLists.Count; ++index2)
                                {
                                    Unit.AbilityChange.Data mDataList = abilityChangeList.mDataLists[index2];
                                    abilChg.acd.Add(new BattleSuspend.Data.UnitInfo.AbilChg.Data()
                                    {
                                        fid = mDataList.mFromAp.iname,
                                        tid = mDataList.mToAp.iname,
                                        tur = mDataList.mTurn,
                                        irs = !mDataList.mIsReset ? 0 : 1,
                                        exp = mDataList.mExp,
                                        iif = !mDataList.mIsInfinite ? 0 : 1
                                    });
                                }
                                unitInfo.acl.Add(abilChg);
                            }
                        }
                        unitInfo.aal.Clear();
                        for (int index = 0; index < current1.AddedAbilitys.Count; ++index)
                        {
                            AbilityData addedAbility = current1.AddedAbilitys[index];
                            if (addedAbility != null)
                            {
                                unitInfo.aal.Add(new BattleSuspend.Data.UnitInfo.AddedAbil()
                                {
                                    aid = addedAbility.AbilityID,
                                    exp = addedAbility.Exp
                                });
                            }
                        }
                        unitInfo.sul.Clear();
                        using (Dictionary <SkillData, OInt> .Enumerator enumerator2 = current1.GetSkillUseCount().GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                KeyValuePair <SkillData, OInt> current2 = enumerator2.Current;
                                unitInfo.sul.Add(new BattleSuspend.Data.UnitInfo.SkillUse()
                                {
                                    sid = current2.Key.SkillParam.iname,
                                    ctr = (int)current2.Value
                                });
                            }
                        }
                        unitInfo.bfl.Clear();
                        using (List <BuffAttachment> .Enumerator enumerator2 = current1.BuffAttachments.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                BuffAttachment current2 = enumerator2.Current;
                                if ((!(bool)current2.IsPassive || current2.Param != null && (bool)current2.Param.mIsUpBuff || current2.skill != null && !current2.skill.IsSubActuate()) && current2.CheckTiming != EffectCheckTimings.Moment)
                                {
                                    BattleSuspend.Data.UnitInfo.Buff buff = new BattleSuspend.Data.UnitInfo.Buff();
                                    buff.sid = current2.skill == null ? (string)null : current2.skill.SkillParam.iname;
                                    buff.stg = (int)current2.skilltarget;
                                    buff.tur = (int)current2.turn;
                                    buff.uni = BattleSuspend.GetIdxFromAllUnits(battle, current2.user);
                                    buff.cui = BattleSuspend.GetIdxFromAllUnits(battle, current2.CheckTarget);
                                    buff.tim = (int)current2.CheckTiming;
                                    buff.ipa = (bool)current2.IsPassive;
                                    buff.ucd = (int)current2.UseCondition;
                                    buff.btp = (int)current2.BuffType;
                                    buff.vtp = !current2.IsNegativeValueIsBuff ? 0 : 1;
                                    buff.ctp = (int)current2.CalcType;
                                    buff.lid = current2.LinkageID;
                                    buff.ubc = (int)current2.UpBuffCount;
                                    buff.atl.Clear();
                                    if (current2.AagTargetLists != null)
                                    {
                                        for (int index = 0; index < current2.AagTargetLists.Count; ++index)
                                        {
                                            int idxFromAllUnits = BattleSuspend.GetIdxFromAllUnits(battle, current2.AagTargetLists[index]);
                                            if (idxFromAllUnits >= 0)
                                            {
                                                buff.atl.Add(idxFromAllUnits);
                                            }
                                        }
                                    }
                                    unitInfo.bfl.Add(buff);
                                }
                            }
                        }
                        unitInfo.cdl.Clear();
                        using (List <CondAttachment> .Enumerator enumerator2 = current1.CondAttachments.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                CondAttachment current2 = enumerator2.Current;
                                if (!(bool)current2.IsPassive || current2.skill != null && !current2.skill.IsSubActuate())
                                {
                                    unitInfo.cdl.Add(new BattleSuspend.Data.UnitInfo.Cond()
                                    {
                                        sid = current2.skill == null ? (string)null : current2.skill.SkillParam.iname,
                                        stg = (int)current2.skilltarget,
                                        cid = current2.CondId,
                                        tur = (int)current2.turn,
                                        uni = BattleSuspend.GetIdxFromAllUnits(battle, current2.user),
                                        cui = BattleSuspend.GetIdxFromAllUnits(battle, current2.CheckTarget),
                                        tim = (int)current2.CheckTiming,
                                        ipa = (bool)current2.IsPassive,
                                        ucd = (int)current2.UseCondition,
                                        cdt = (int)current2.CondType,
                                        cnd = (int)current2.Condition,
                                        icu = current2.IsCurse,
                                        lid = current2.LinkageID
                                    });
                                }
                            }
                        }
                        unitInfo.shl.Clear();
                        using (List <Unit.UnitShield> .Enumerator enumerator2 = current1.Shields.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                Unit.UnitShield current2 = enumerator2.Current;
                                unitInfo.shl.Add(new BattleSuspend.Data.UnitInfo.Shield()
                                {
                                    inm = current2.skill_param.iname,
                                    nhp = (int)current2.hp,
                                    mhp = (int)current2.hpMax,
                                    ntu = (int)current2.turn,
                                    mtu = (int)current2.turnMax,
                                    drt = (int)current2.damage_rate,
                                    dvl = (int)current2.damage_value
                                });
                            }
                        }
                        unitInfo.hpi.Clear();
                        using (List <SkillData> .Enumerator enumerator2 = current1.JudgeHpLists.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                SkillData current2 = enumerator2.Current;
                                unitInfo.hpi.Add(current2.SkillID);
                            }
                        }
                        unitInfo.mhl.Clear();
                        using (List <Unit.UnitMhmDamage> .Enumerator enumerator2 = current1.MhmDamageLists.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                Unit.UnitMhmDamage current2 = enumerator2.Current;
                                unitInfo.mhl.Add(new BattleSuspend.Data.UnitInfo.MhmDmg()
                                {
                                    typ = (int)current2.mType,
                                    dmg = (int)current2.mDamage
                                });
                            }
                        }
                        data.uil.Add(unitInfo);
                    }
                }
            }
            data.itl.Clear();
            using (Dictionary <OString, OInt> .Enumerator enumerator = battle.GetQuestRecord().used_items.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <OString, OInt> current = enumerator.Current;
                    data.itl.Add(new BattleSuspend.Data.UsedItem()
                    {
                        iti = (string)current.Key,
                        num = (int)current.Value
                    });
                }
            }
            data.trl.Clear();
            using (List <TrickData> .Enumerator enumerator = TrickData.GetEffectAll().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TrickData current = enumerator.Current;
                    data.trl.Add(new BattleSuspend.Data.TrickInfo()
                    {
                        tid = current.TrickParam.Iname,
                        val = (bool)current.Valid,
                        cun = BattleSuspend.GetIdxFromAllUnits(battle, current.CreateUnit),
                        rnk = (int)current.Rank,
                        rcp = (int)current.RankCap,
                        grx = (int)current.GridX,
                        gry = (int)current.GridY,
                        rac = (int)current.RestActionCount,
                        ccl = (int)current.CreateClock,
                        tag = current.Tag
                    });
                }
            }
            data.sel.Clear();
            using (Dictionary <string, BattleCore.SkillExecLog> .KeyCollection.Enumerator enumerator = battle.SkillExecLogs.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.Current;
                    data.sel.Add(new BattleSuspend.Data.SkillExecLogInfo()
                    {
                        inm  = current,
                        ucnt = battle.SkillExecLogs[current].use_count,
                        kcnt = battle.SkillExecLogs[current].kill_count
                    });
                }
            }
            BattleSuspend.Data.Variables var = data.var;
            var.wtc = battle.WinTriggerCount;
            var.ltc = battle.LoseTriggerCount;
            var.act = battle.ActionCount;
            var.kls = battle.Killstreak;
            var.mks = battle.MaxKillstreak;
            var.thl = battle.TotalHeal;
            var.tdt = battle.TotalDamagesTaken;
            var.tdm = battle.TotalDamages;
            var.nui = battle.NumUsedItems;
            var.nus = battle.NumUsedSkills;
            var.ctm = battle.ClockTime;
            var.ctt = battle.ClockTimeTotal;
            var.coc = battle.ContinueCount;
            var.fns = battle.FinisherIname;
            var.glc = instance.GoldCount;
            var.trc = instance.TreasureCount;
            var.rsd = battle.Seed;
            uint[] seed = battle.Rand.GetSeed();
            if (seed != null)
            {
                var.ris = new uint[seed.Length];
                seed.CopyTo((Array)var.ris, 0);
            }
            var.gsl.Clear();
            using (List <GimmickEvent> .Enumerator enumerator = battle.GimmickEventList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    GimmickEvent current = enumerator.Current;
                    var.gsl.Add(new BattleSuspend.Data.Variables.GimmickEvent()
                    {
                        ctr = current.count,
                        cmp = !current.IsCompleted ? 0 : 1
                    });
                }
            }
            var.ssl.Clear();
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance.EventScript, (UnityEngine.Object)null) && instance.EventScript.mSequences != null)
            {
                foreach (EventScript.ScriptSequence mSequence in instance.EventScript.mSequences)
                {
                    var.ssl.Add(new BattleSuspend.Data.Variables.ScriptEvent()
                    {
                        trg = mSequence.Triggered
                    });
                }
            }
            var.tkk     = battle.TargetKillstreak.Keys.ToArray <string>();
            var.tkv     = battle.TargetKillstreak.Values.ToArray <int>();
            var.mtk     = battle.MaxTargetKillstreak.Keys.ToArray <string>();
            var.mtv     = battle.MaxTargetKillstreak.Values.ToArray <int>();
            var.pbm     = battle.PlayByManually;
            var.uam     = battle.IsUseAutoPlayMode;
            var.wti.wid = (string)null;
            WeatherData currentWeatherData = WeatherData.CurrentWeatherData;

            if (currentWeatherData != null)
            {
                var.wti.wid = currentWeatherData.WeatherParam.Iname;
                var.wti.mun = BattleSuspend.GetIdxFromAllUnits(battle, currentWeatherData.ModifyUnit);
                var.wti.rnk = (int)currentWeatherData.Rank;
                var.wti.rcp = (int)currentWeatherData.RankCap;
                var.wti.ccl = (int)currentWeatherData.ChangeClock;
            }
            var.ctd  = battle.CurrentTeamId;
            var.mtd  = battle.MaxTeamId;
            var.pbd  = instance.EventPlayBgmID;
            data.ivl = true;
            return(data);
        }
Example #6
0
        public void Refresh(Unit unit)
        {
            if (this.mBc == null || unit == null)
            {
                return;
            }
            DataSource component1 = (DataSource)((Component)this).get_gameObject().GetComponent <DataSource>();

            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)component1))
            {
                component1.Clear();
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoLeaderSkill))
            {
                DataSource component2 = (DataSource)this.GoLeaderSkill.GetComponent <DataSource>();
                if (UnityEngine.Object.op_Implicit((UnityEngine.Object)component2))
                {
                    component2.Clear();
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoLeader2Skill))
            {
                DataSource component2 = (DataSource)this.GoLeader2Skill.GetComponent <DataSource>();
                if (UnityEngine.Object.op_Implicit((UnityEngine.Object)component2))
                {
                    component2.Clear();
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoFriendSkill))
            {
                DataSource component2 = (DataSource)this.GoFriendSkill.GetComponent <DataSource>();
                if (UnityEngine.Object.op_Implicit((UnityEngine.Object)component2))
                {
                    component2.Clear();
                }
            }
            DataSource.Bind <Unit>(((Component)this).get_gameObject(), unit);
            BaseStatus status        = unit.UnitData.Status;
            BaseStatus currentStatus = unit.CurrentStatus;
            BaseStatus maximumStatus = unit.MaximumStatus;
            SkillData  data1         = (SkillData)null;
            SkillData  data2         = (SkillData)null;
            SkillData  data3         = (SkillData)null;

            if (!this.mBc.IsMultiTower)
            {
                if (unit.Side == EUnitSide.Player)
                {
                    if (this.mBc.Leader != null)
                    {
                        data1 = this.mBc.Leader.LeaderSkill;
                    }
                    if (this.mBc.Friend != null && this.mBc.IsFriendStatus)
                    {
                        data3 = this.mBc.Friend.LeaderSkill;
                    }
                }
                if (this.mBc.IsMultiVersus && unit.Side == EUnitSide.Enemy && this.mBc.EnemyLeader != null)
                {
                    data1 = this.mBc.EnemyLeader.LeaderSkill;
                }
            }
            else
            {
                List <Unit> unitList = new List <Unit>();
                if (unit.Side == EUnitSide.Player)
                {
                    unitList = this.mBc.Player;
                }
                else if (unit.Side == EUnitSide.Enemy)
                {
                    unitList = this.mBc.Enemys;
                }
                int index1 = unitList.FindIndex((Predicate <Unit>)(data => data.OwnerPlayerIndex == 1));
                if (index1 >= 0)
                {
                    data1 = unitList[index1].LeaderSkill;
                }
                int index2 = unitList.FindIndex((Predicate <Unit>)(data => data.OwnerPlayerIndex == 2));
                if (index2 >= 0)
                {
                    data2 = unitList[index2].LeaderSkill;
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoLeaderSkill) && data1 != null)
            {
                DataSource.Bind <SkillData>(this.GoLeaderSkill, data1);
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoLeader2Skill) && data2 != null)
            {
                DataSource.Bind <SkillData>(this.GoLeader2Skill, data2);
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoFriendSkill) && data3 != null)
            {
                DataSource.Bind <SkillData>(this.GoFriendSkill, data3);
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoStatusParent) && UnityEngine.Object.op_Implicit((UnityEngine.Object) this.StatusBaseItem))
            {
                ((Component)this.StatusBaseItem).get_gameObject().SetActive(false);
                BattleUnitDetail.DestroyChildGameObjects(this.GoStatusParent, new List <GameObject>((IEnumerable <GameObject>) new GameObject[1]
                {
                    ((Component)this.StatusBaseItem).get_gameObject()
                }));
                for (int index = 0; index < 13; ++index)
                {
                    BattleUnitDetailStatus unitDetailStatus = (BattleUnitDetailStatus)UnityEngine.Object.Instantiate <BattleUnitDetailStatus>((M0)this.StatusBaseItem);
                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object)unitDetailStatus))
                    {
                        ((Component)unitDetailStatus).get_transform().SetParent(this.GoStatusParent.get_transform());
                        ((Component)unitDetailStatus).get_transform().set_localScale(Vector3.get_one());
                        int val = 0;
                        int add = 0;
                        switch (index)
                        {
                        case 0:
                            val = (int)maximumStatus.param.hp;
                            add = (int)maximumStatus.param.hp - (int)status.param.hp;
                            break;

                        case 1:
                            val = (int)maximumStatus.param.mp;
                            add = (int)maximumStatus.param.mp - (int)status.param.mp;
                            break;

                        case 2:
                            val = (int)currentStatus.param.atk;
                            add = (int)currentStatus.param.atk - (int)status.param.atk;
                            break;

                        case 3:
                            val = (int)currentStatus.param.def;
                            add = (int)currentStatus.param.def - (int)status.param.def;
                            break;

                        case 4:
                            val = (int)currentStatus.param.mag;
                            add = (int)currentStatus.param.mag - (int)status.param.mag;
                            break;

                        case 5:
                            val = (int)currentStatus.param.mnd;
                            add = (int)currentStatus.param.mnd - (int)status.param.mnd;
                            break;

                        case 6:
                            val = (int)currentStatus.param.dex;
                            add = (int)currentStatus.param.dex - (int)status.param.dex;
                            break;

                        case 7:
                            val = (int)currentStatus.param.spd;
                            add = (int)currentStatus.param.spd - (int)status.param.spd;
                            break;

                        case 8:
                            val = (int)currentStatus.param.cri;
                            add = (int)currentStatus.param.cri - (int)status.param.cri;
                            break;

                        case 9:
                            val = (int)currentStatus.param.luk;
                            add = (int)currentStatus.param.luk - (int)status.param.luk;
                            break;

                        case 10:
                            val = unit.GetCombination();
                            add = 0;
                            break;

                        case 11:
                            val = (int)currentStatus.param.mov;
                            add = (int)currentStatus.param.mov - (int)status.param.mov;
                            break;

                        case 12:
                            val = (int)currentStatus.param.jmp;
                            add = (int)currentStatus.param.jmp - (int)status.param.jmp;
                            break;
                        }
                        unitDetailStatus.SetStatus((BattleUnitDetailStatus.eBudStat)index, val, add);
                        ((Component)unitDetailStatus).get_gameObject().SetActive(true);
                    }
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoElementParent) && UnityEngine.Object.op_Implicit((UnityEngine.Object) this.ElementBaseItem))
            {
                ((Component)this.ElementBaseItem).get_gameObject().SetActive(false);
                BattleUnitDetail.DestroyChildGameObjects(this.GoElementParent, new List <GameObject>((IEnumerable <GameObject>) new GameObject[1]
                {
                    ((Component)this.ElementBaseItem).get_gameObject()
                }));
                int length = Enum.GetNames(typeof(EElement)).Length;
                for (int index = 1; index < length; ++index)
                {
                    BattleUnitDetailElement unitDetailElement = (BattleUnitDetailElement)UnityEngine.Object.Instantiate <BattleUnitDetailElement>((M0)this.ElementBaseItem);
                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object)unitDetailElement))
                    {
                        ((Component)unitDetailElement).get_transform().SetParent(this.GoElementParent.get_transform());
                        ((Component)unitDetailElement).get_transform().set_localScale(Vector3.get_one());
                        int per = 0;
                        switch (index)
                        {
                        case 1:
                            per = (int)currentStatus.element_resist.fire;
                            break;

                        case 2:
                            per = (int)currentStatus.element_resist.water;
                            break;

                        case 3:
                            per = (int)currentStatus.element_resist.wind;
                            break;

                        case 4:
                            per = (int)currentStatus.element_resist.thunder;
                            break;

                        case 5:
                            per = (int)currentStatus.element_resist.shine;
                            break;

                        case 6:
                            per = (int)currentStatus.element_resist.dark;
                            break;
                        }
                        BattleUnitDetail.eBudFluct fluct = BattleUnitDetail.ExchgBudFluct(per, BattleUnitDetail.eFluctChk.ELEMENT);
                        unitDetailElement.SetElement((EElement)index, fluct);
                        ((Component)unitDetailElement).get_gameObject().SetActive(true);
                    }
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoTagParent) && UnityEngine.Object.op_Implicit((UnityEngine.Object) this.TagBaseItem) && UnityEngine.Object.op_Implicit((UnityEngine.Object) this.TagBaseWideItem))
            {
                ((Component)this.TagBaseItem).get_gameObject().SetActive(false);
                ((Component)this.TagBaseWideItem).get_gameObject().SetActive(false);
                BattleUnitDetail.DestroyChildGameObjects(this.GoTagParent, new List <GameObject>((IEnumerable <GameObject>) new GameObject[2]
                {
                    ((Component)this.TagBaseItem).get_gameObject(),
                    ((Component)this.TagBaseWideItem).get_gameObject()
                }));
                int      num  = 0;
                string[] tags = unit.GetTags();
                if (tags != null)
                {
                    foreach (string tag in tags)
                    {
                        BattleUnitDetailTag battleUnitDetailTag;
                        if (tag.Length <= 2)
                        {
                            if (num + 1 <= 8)
                            {
                                battleUnitDetailTag = (BattleUnitDetailTag)UnityEngine.Object.Instantiate <BattleUnitDetailTag>((M0)this.TagBaseItem);
                                ++num;
                            }
                            else
                            {
                                break;
                            }
                        }
                        else if (num + 2 <= 8)
                        {
                            battleUnitDetailTag = (BattleUnitDetailTag)UnityEngine.Object.Instantiate <BattleUnitDetailTag>((M0)this.TagBaseWideItem);
                            num += 2;
                        }
                        else
                        {
                            break;
                        }
                        if (UnityEngine.Object.op_Implicit((UnityEngine.Object)battleUnitDetailTag))
                        {
                            ((Component)battleUnitDetailTag).get_transform().SetParent(this.GoTagParent.get_transform());
                            ((Component)battleUnitDetailTag).get_transform().set_localScale(Vector3.get_one());
                            battleUnitDetailTag.SetTag(tag);
                            ((Component)battleUnitDetailTag).get_gameObject().SetActive(true);
                        }
                    }
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoAtkDetailParent) && UnityEngine.Object.op_Implicit((UnityEngine.Object) this.AtkDetailBaseItem))
            {
                ((Component)this.AtkDetailBaseItem).get_gameObject().SetActive(false);
                BattleUnitDetail.DestroyChildGameObjects <BattleUnitDetailAtkDetail>(this.GoAtkDetailParent, new List <GameObject>((IEnumerable <GameObject>) new GameObject[1]
                {
                    ((Component)this.AtkDetailBaseItem).get_gameObject()
                }));
                int[] numArray = new int[3]
                {
                    (int)currentStatus[BattleBonus.HitRate],
                    (int)currentStatus[BattleBonus.AvoidRate],
                    (int)currentStatus[ParamTypes.Rec] - 100
                };
                for (int index = 0; index < numArray.Length; ++index)
                {
                    BattleUnitDetail.eBudFluct fluct = BattleUnitDetail.ExchgBudFluct(numArray[index], BattleUnitDetail.eFluctChk.DEFAULT);
                    if (fluct != BattleUnitDetail.eBudFluct.NONE)
                    {
                        BattleUnitDetailAtkDetail unitDetailAtkDetail = (BattleUnitDetailAtkDetail)UnityEngine.Object.Instantiate <BattleUnitDetailAtkDetail>((M0)this.AtkDetailBaseItem);
                        if (UnityEngine.Object.op_Implicit((UnityEngine.Object)unitDetailAtkDetail))
                        {
                            ((Component)unitDetailAtkDetail).get_transform().SetParent(this.GoAtkDetailParent.get_transform());
                            ((Component)unitDetailAtkDetail).get_transform().set_localScale(Vector3.get_one());
                            unitDetailAtkDetail.SetAll((BattleUnitDetailAtkDetail.eAllType)(7 + index), fluct);
                            ((Component)unitDetailAtkDetail).get_gameObject().SetActive(true);
                        }
                    }
                }
                int length = Enum.GetNames(typeof(AttackDetailTypes)).Length;
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    BattleUnitDetailAtkDetail.eType type = (BattleUnitDetailAtkDetail.eType)index1;
                    for (int index2 = 1; index2 < length; ++index2)
                    {
                        int per = 0;
                        switch (index2)
                        {
                        case 1:
                            switch (type)
                            {
                            case BattleUnitDetailAtkDetail.eType.ASSIST:
                                per = (int)currentStatus[BattleBonus.SlashAttack];
                                break;

                            case BattleUnitDetailAtkDetail.eType.RESIST:
                                per = (int)currentStatus[BattleBonus.Resist_Slash];
                                break;

                            case BattleUnitDetailAtkDetail.eType.AVOID:
                                per = (int)currentStatus[BattleBonus.Avoid_Slash];
                                break;
                            }

                        case 2:
                            switch (type)
                            {
                            case BattleUnitDetailAtkDetail.eType.ASSIST:
                                per = (int)currentStatus[BattleBonus.PierceAttack];
                                break;

                            case BattleUnitDetailAtkDetail.eType.RESIST:
                                per = (int)currentStatus[BattleBonus.Resist_Pierce];
                                break;

                            case BattleUnitDetailAtkDetail.eType.AVOID:
                                per = (int)currentStatus[BattleBonus.Avoid_Pierce];
                                break;
                            }

                        case 3:
                            switch (type)
                            {
                            case BattleUnitDetailAtkDetail.eType.ASSIST:
                                per = (int)currentStatus[BattleBonus.BlowAttack];
                                break;

                            case BattleUnitDetailAtkDetail.eType.RESIST:
                                per = (int)currentStatus[BattleBonus.Resist_Blow];
                                break;

                            case BattleUnitDetailAtkDetail.eType.AVOID:
                                per = (int)currentStatus[BattleBonus.Avoid_Blow];
                                break;
                            }

                        case 4:
                            switch (type)
                            {
                            case BattleUnitDetailAtkDetail.eType.ASSIST:
                                per = (int)currentStatus[BattleBonus.ShotAttack];
                                break;

                            case BattleUnitDetailAtkDetail.eType.RESIST:
                                per = (int)currentStatus[BattleBonus.Resist_Shot];
                                break;

                            case BattleUnitDetailAtkDetail.eType.AVOID:
                                per = (int)currentStatus[BattleBonus.Avoid_Shot];
                                break;
                            }

                        case 5:
                            switch (type)
                            {
                            case BattleUnitDetailAtkDetail.eType.ASSIST:
                                per = (int)currentStatus[BattleBonus.MagicAttack];
                                break;

                            case BattleUnitDetailAtkDetail.eType.RESIST:
                                per = (int)currentStatus[BattleBonus.Resist_Magic];
                                break;

                            case BattleUnitDetailAtkDetail.eType.AVOID:
                                per = (int)currentStatus[BattleBonus.Avoid_Magic];
                                break;
                            }

                        case 6:
                            switch (type)
                            {
                            case BattleUnitDetailAtkDetail.eType.ASSIST:
                                per = (int)currentStatus[BattleBonus.JumpAttack];
                                break;

                            case BattleUnitDetailAtkDetail.eType.RESIST:
                                per = (int)currentStatus[BattleBonus.Resist_Jump];
                                break;

                            case BattleUnitDetailAtkDetail.eType.AVOID:
                                per = (int)currentStatus[BattleBonus.Avoid_Jump];
                                break;
                            }
                        }
                        BattleUnitDetail.eBudFluct fluct = BattleUnitDetail.ExchgBudFluct(per, BattleUnitDetail.eFluctChk.ATK_DETAIL);
                        if (fluct != BattleUnitDetail.eBudFluct.NONE)
                        {
                            BattleUnitDetailAtkDetail unitDetailAtkDetail = (BattleUnitDetailAtkDetail)UnityEngine.Object.Instantiate <BattleUnitDetailAtkDetail>((M0)this.AtkDetailBaseItem);
                            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)unitDetailAtkDetail))
                            {
                                ((Component)unitDetailAtkDetail).get_transform().SetParent(this.GoAtkDetailParent.get_transform());
                                ((Component)unitDetailAtkDetail).get_transform().set_localScale(Vector3.get_one());
                                unitDetailAtkDetail.SetAtkDetail((AttackDetailTypes)index2, type, fluct);
                                ((Component)unitDetailAtkDetail).get_gameObject().SetActive(true);
                            }
                        }
                    }
                }
            }
            if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoCondParent) && UnityEngine.Object.op_Implicit((UnityEngine.Object) this.CondBaseItem))
            {
                ((Component)this.CondBaseItem).get_gameObject().SetActive(false);
                BattleUnitDetail.DestroyChildGameObjects <BattleUnitDetailCond>(this.GoCondParent, new List <GameObject>((IEnumerable <GameObject>) new GameObject[1]
                {
                    ((Component)this.CondBaseItem).get_gameObject()
                }));
                using (List <Unit.UnitShield> .Enumerator enumerator = unit.Shields.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Unit.UnitShield      current = enumerator.Current;
                        BattleUnitDetailCond battleUnitDetailCond = (BattleUnitDetailCond)UnityEngine.Object.Instantiate <BattleUnitDetailCond>((M0)this.CondBaseItem);
                        if (UnityEngine.Object.op_Implicit((UnityEngine.Object)battleUnitDetailCond))
                        {
                            ((Component)battleUnitDetailCond).get_transform().SetParent(this.GoCondParent.get_transform());
                            ((Component)battleUnitDetailCond).get_transform().set_localScale(Vector3.get_one());
                            battleUnitDetailCond.SetCondShield(current.shieldType, (int)current.hp);
                            ((Component)battleUnitDetailCond).get_gameObject().SetActive(true);
                        }
                    }
                }
                EUnitCondition[] values = (EUnitCondition[])Enum.GetValues(typeof(EUnitCondition));
                for (int index = 0; index < values.Length; ++index)
                {
                    if (unit.IsUnitCondition(values[index]))
                    {
                        BattleUnitDetailCond battleUnitDetailCond = (BattleUnitDetailCond)UnityEngine.Object.Instantiate <BattleUnitDetailCond>((M0)this.CondBaseItem);
                        if (UnityEngine.Object.op_Implicit((UnityEngine.Object)battleUnitDetailCond))
                        {
                            ((Component)battleUnitDetailCond).get_transform().SetParent(this.GoCondParent.get_transform());
                            ((Component)battleUnitDetailCond).get_transform().set_localScale(Vector3.get_one());
                            battleUnitDetailCond.SetCond(values[index]);
                            ((Component)battleUnitDetailCond).get_gameObject().SetActive(true);
                        }
                    }
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
            GlobalEvent.Invoke("BATTLE_UNIT_DETAIL_REFRESH", (object)this);
        }
        private void Refresh()
        {
            UnitData data1 = (UnitData)null;

            if (Object.op_Implicit((Object)UnitEnhanceV3.Instance))
            {
                data1 = UnitEnhanceV3.Instance.CurrentUnit;
            }
            if (data1 == null)
            {
                data1 = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);
            }
            AbilityData  abilityData  = data1.GetAbilityData((long)GlobalVars.SelectedAbilityUniqueID);
            AbilityParam abilityParam = MonoSingleton <GameManager> .Instance.GetAbilityParam((string)GlobalVars.SelectedAbilityID);

            QuestClearUnlockUnitDataParam[]      unlockedSkills          = data1.UnlockedSkills;
            List <QuestClearUnlockUnitDataParam> unlockUnitDataParamList = new List <QuestClearUnlockUnitDataParam>();

            QuestClearUnlockUnitDataParam[] allUnlockUnitDatas = MonoSingleton <GameManager> .Instance.MasterParam.GetAllUnlockUnitDatas();

            if (allUnlockUnitDatas != null)
            {
                for (int index = 0; index < allUnlockUnitDatas.Length; ++index)
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    AbilityDetailWindow.\u003CRefresh\u003Ec__AnonStorey22A refreshCAnonStorey22A = new AbilityDetailWindow.\u003CRefresh\u003Ec__AnonStorey22A();
                    // ISSUE: reference to a compiler-generated field
                    refreshCAnonStorey22A.param = allUnlockUnitDatas[index];
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated method
                    if (refreshCAnonStorey22A.param.type == QuestClearUnlockUnitDataParam.EUnlockTypes.Skill && refreshCAnonStorey22A.param.uid == data1.UnitID && refreshCAnonStorey22A.param.parent_id == abilityParam.iname && (unlockedSkills == null || Array.FindIndex <QuestClearUnlockUnitDataParam>(unlockedSkills, new Predicate <QuestClearUnlockUnitDataParam>(refreshCAnonStorey22A.\u003C\u003Em__230)) == -1))
                    {
                        // ISSUE: reference to a compiler-generated field
                        unlockUnitDataParamList.Add(refreshCAnonStorey22A.param);
                    }
                }
            }
            RarityParam rarityParam = MonoSingleton <GameManager> .Instance.GetRarityParam((int)data1.UnitParam.raremax);

            int num = Math.Min((int)rarityParam.UnitLvCap + (int)rarityParam.UnitAwakeLvCap, abilityParam.GetRankCap());

            DataSource.Bind <UnitData>(((Component)this).get_gameObject(), data1);
            DataSource.Bind <AbilityData>(((Component)this).get_gameObject(), abilityData);
            AbilityParam data2 = abilityParam;

            if (AbilityDetailWindow.IsEnableSkillChange)
            {
                string key = data1.SearchAbilityReplacementSkill(abilityParam.iname);
                if (!string.IsNullOrEmpty(key))
                {
                    data2 = MonoSingleton <GameManager> .Instance.GetAbilityParam(key);
                }
            }
            DataSource.Bind <AbilityParam>(((Component)this).get_gameObject(), data2);
            if (Object.op_Inequality((Object)this.SkillTemplate, (Object)null))
            {
                List <SkillParam> skillParamList = new List <SkillParam>();
                if (abilityData != null && abilityData.LearningSkills != null)
                {
                    for (int index1 = 0; index1 < abilityData.LearningSkills.Length; ++index1)
                    {
                        if (abilityData.LearningSkills[index1].locklv <= num)
                        {
                            string str1 = abilityData.LearningSkills[index1].iname;
                            if (unlockedSkills != null)
                            {
                                for (int index2 = 0; index2 < unlockedSkills.Length; ++index2)
                                {
                                    if (unlockedSkills[index2].old_id == str1)
                                    {
                                        str1 = unlockedSkills[index2].new_id;
                                        break;
                                    }
                                }
                            }
                            if (AbilityDetailWindow.IsEnableSkillChange)
                            {
                                string str2 = data1.SearchReplacementSkill(str1);
                                if (!string.IsNullOrEmpty(str2))
                                {
                                    str1 = str2;
                                }
                            }
                            skillParamList.Add(MonoSingleton <GameManager> .Instance.GetSkillParam(str1));
                        }
                    }
                    if (unlockedSkills != null)
                    {
                        for (int index = 0; index < unlockedSkills.Length; ++index)
                        {
                            if (unlockedSkills[index].add && unlockedSkills[index].parent_id == abilityData.AbilityID)
                            {
                                skillParamList.Add(MonoSingleton <GameManager> .Instance.GetSkillParam(unlockedSkills[index].new_id));
                            }
                        }
                    }
                }
                else
                {
                    for (int index = 0; index < abilityParam.skills.Length; ++index)
                    {
                        if (abilityParam.skills[index].locklv <= num)
                        {
                            skillParamList.Add(MonoSingleton <GameManager> .Instance.GetSkillParam(abilityParam.skills[index].iname));
                        }
                    }
                }
                if (abilityData == data1.MasterAbility && data1.CollaboAbility != null)
                {
                    using (List <SkillData> .Enumerator enumerator = data1.CollaboAbility.Skills.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            SkillData current = enumerator.Current;
                            skillParamList.Add(current.SkillParam);
                        }
                    }
                }
                for (int index = 0; index < skillParamList.Count; ++index)
                {
                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.SkillTemplate);
                    DataSource.Bind <SkillParam>(gameObject, skillParamList[index]);
                    gameObject.get_transform().SetParent(this.SkillLayoutParent, false);
                    gameObject.SetActive(true);
                }
                for (int index = 0; index < unlockUnitDataParamList.Count; ++index)
                {
                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.SkillLockedTemplate);
                    DataSource.Bind <SkillParam>(gameObject, MonoSingleton <GameManager> .Instance.GetSkillParam(unlockUnitDataParamList[index].new_id));
                    DataSource.Bind <QuestClearUnlockUnitDataParam>(gameObject, unlockUnitDataParamList[index]);
                    gameObject.get_transform().SetParent(this.SkillLayoutParent, false);
                    gameObject.SetActive(true);
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Example #8
0
        public void SetAbilities(AbilityData[] abilities, Unit unit)
        {
            for (int index = 0; index < this.mAbilityButtons.Count; ++index)
            {
                UnityEngine.Object.Destroy((UnityEngine.Object) this.mAbilityButtons[index]);
            }
            this.mAbilityButtons.Clear();
            Transform parent = this.AbilityButton.get_transform().get_parent();

            for (int index1 = 0; index1 < abilities.Length; ++index1)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                UnitCommands.\u003CSetAbilities\u003Ec__AnonStorey38C abilitiesCAnonStorey38C = new UnitCommands.\u003CSetAbilities\u003Ec__AnonStorey38C();
                // ISSUE: reference to a compiler-generated field
                abilitiesCAnonStorey38C.\u003C\u003Ef__this = this;
                if (abilities[index1].AbilityType != EAbilityType.Passive)
                {
                    bool flag = false;
                    int  mp   = (int)unit.CurrentStatus.param.mp;
                    // ISSUE: reference to a compiler-generated field
                    abilitiesCAnonStorey38C.ability = abilities[index1];
                    // ISSUE: reference to a compiler-generated field
                    List <SkillData> skills = abilitiesCAnonStorey38C.ability.Skills;
                    GameObject       go     = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.AbilityButton);
                    go.get_transform().SetParent(parent, false);
                    // ISSUE: reference to a compiler-generated field
                    DataSource.Bind <AbilityData>(go, abilitiesCAnonStorey38C.ability);
                    go.SetActive(true);
                    for (int index2 = 0; index2 < skills.Count; ++index2)
                    {
                        SkillData skill         = skills[index2];
                        int       skillUseCount = (int)unit.GetSkillUseCount(skill);
                        if (unit.GetSkillUsedCost(skill) <= mp && skillUseCount > 0)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag && !string.IsNullOrEmpty(this.AbilityImageBG))
                    {
                        Transform childRecursively = GameUtility.findChildRecursively(go.get_transform(), this.AbilityImageBG);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)childRecursively, (UnityEngine.Object)null))
                        {
                            ((Graphic)((Component)childRecursively).GetComponent <Image>()).set_color(this.AbilityDisableColor);
                        }
                    }
                    if (!flag && !string.IsNullOrEmpty(this.AbilityImageIcon))
                    {
                        Transform childRecursively = GameUtility.findChildRecursively(go.get_transform(), this.AbilityImageIcon);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)childRecursively, (UnityEngine.Object)null))
                        {
                            ((Graphic)((Component)childRecursively).GetComponent <RawImage_Transparent>()).set_color(this.AbilityDisableColor);
                        }
                    }
                    if (!flag && !string.IsNullOrEmpty(this.AbilityName))
                    {
                        Transform childRecursively = GameUtility.findChildRecursively(go.get_transform(), this.AbilityName);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)childRecursively, (UnityEngine.Object)null))
                        {
                            ((Graphic)((Component)childRecursively).GetComponent <LText>()).set_color(this.AbilityDisableColor);
                        }
                    }
                    // ISSUE: reference to a compiler-generated method
                    this.SetButtonEvent(go, new UnitCommands.ClickEvent(abilitiesCAnonStorey38C.\u003C\u003Em__444));
                    this.mAbilityButtons.Add(go);
                }
            }
            this.SortButtons();
        }
Example #9
0
 public EventScript.Sequence OnUseSkill(EventScript.SkillTiming timing, TacticsUnitController controller, SkillData skill, List <TacticsUnitController> TargetLists, bool isFirstPlay)
 {
     return(this.StartSequence((EventScript.TestCondition)(trigger =>
     {
         bool flag = false;
         if (TargetLists != null)
         {
             using (List <TacticsUnitController> .Enumerator enumerator = TargetLists.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     TacticsUnitController current = enumerator.Current;
                     if (this.IsContainsUnit(trigger.TargetUnit, current, controller))
                     {
                         flag = true;
                         break;
                     }
                 }
             }
         }
         if (trigger.Trigger == EventScript.ScriptSequence.StartConditions.UseSkill && (EventScript.SkillTiming)trigger.SkillTiming == timing && (!trigger.IsFirstOnly || isFirstPlay) && (this.IsContainsUnit(trigger.UnitName, controller, (TacticsUnitController)null) && flag))
         {
             return this.IsContainsSkill(trigger.TargetSkill, skill);
         }
         return false;
     }), true, 0));
 }
Example #10
0
 public void Setup(SkillData skill)
 {
     this.m_LearnSkillName.set_text("リーダースキル:" + skill.Name);
     this.m_LearnSkillEffect.set_text(skill.SkillParam.expr);
 }
Example #11
0
 public static void TryCraeteLeaderSkill(TobiraParam tobiraParam, int currentLv, ref SkillData skillData, bool isJust = false)
 {
     if (isJust)
     {
         if (tobiraParam.OverwriteLeaderSkillLevel != currentLv)
         {
             return;
         }
         skillData = new SkillData();
         skillData.Setup(tobiraParam.OverwriteLeaderSkillIname, 1, 1, (MasterParam)null);
     }
     else
     {
         if (tobiraParam.OverwriteLeaderSkillLevel > currentLv)
         {
             return;
         }
         skillData = new SkillData();
         skillData.Setup(tobiraParam.OverwriteLeaderSkillIname, 1, 1, (MasterParam)null);
     }
 }