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) { if (abilities[index1].AbilityType != EAbilityType.Passive) { bool flag1 = false; int mp = (int)unit.CurrentStatus.param.mp; AbilityData ability = abilities[index1]; List <SkillData> skills = ability.Skills; GameObject go = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.AbilityButton); go.get_transform().SetParent(parent, false); DataSource.Bind <AbilityData>(go, ability); go.SetActive(true); for (int index2 = 0; index2 < skills.Count; ++index2) { SkillData skill = skills[index2]; int skillUseCount = (int)unit.GetSkillUseCount(skill); int skillUsedCost = unit.GetSkillUsedCost(skill); if (!skill.IsPassiveSkill()) { bool flag2 = skillUseCount > 0 || skill.IsSkillCountNoLimit; if (skillUsedCost <= mp && flag2) { flag1 = true; break; } } } if (!flag1 && !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 (!flag1 && !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); } } this.SetButtonEvent(go, (UnitCommands.ClickEvent)(() => this.OnSelectAbility(ability))); this.mAbilityButtons.Add(go); } } this.SortButtons(); }
public void SetAbilities(AbilityData[] abilities, Unit unit) { for (int index = 0; index < this.mAbilityButtons.Count; ++index) { Object.Destroy((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__AnonStorey280 abilitiesCAnonStorey280 = new UnitCommands.\u003CSetAbilities\u003Ec__AnonStorey280(); // ISSUE: reference to a compiler-generated field abilitiesCAnonStorey280.\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 abilitiesCAnonStorey280.ability = abilities[index1]; // ISSUE: reference to a compiler-generated field List <SkillData> skills = abilitiesCAnonStorey280.ability.Skills; GameObject go = (GameObject)Object.Instantiate <GameObject>((M0)this.AbilityButton); go.get_transform().SetParent(parent, false); // ISSUE: reference to a compiler-generated field DataSource.Bind <AbilityData>(go, abilitiesCAnonStorey280.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 (Object.op_Inequality((Object)childRecursively, (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 (Object.op_Inequality((Object)childRecursively, (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 (Object.op_Inequality((Object)childRecursively, (Object)null)) { ((Graphic)((Component)childRecursively).GetComponent <LText>()).set_color(this.AbilityDisableColor); } } // ISSUE: reference to a compiler-generated method this.SetButtonEvent(go, new UnitCommands.ClickEvent(abilitiesCAnonStorey280.\u003C\u003Em__312)); this.mAbilityButtons.Add(go); } } this.SortButtons(); }