Esempio n. 1
0
    public override void UpdateUI()
    {
        SetActive((Enum)UI.OBJ_FRAME_BG, IsShowFrameBG());
        detailBase = SetPrefab(GetCtrl(UI.OBJ_DETAIL_ROOT), "ItemDetailEquipBase", true);
        SetFontStyle(detailBase, UI.STR_TITLE_ITEM_INFO, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_STATUS, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_SKILL_SLOT, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_ABILITY, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_SELL, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_ATK, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_ELEM_ATK, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_DEF, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_ELEM_DEF, 2);
        SetFontStyle(detailBase, UI.STR_TITLE_HP, 2);
        EquipItemInfo equip = detailItemData as EquipItemInfo;

        SetActive((Enum)UI.BTN_CHANGE, localEquipSetData != null && CanSmithSection(callSection));
        SetActive((Enum)UI.BTN_CREATE, CanSmithSection(callSection));
        SetActive((Enum)UI.BTN_GROW, CanSmithSection(callSection));
        SetActive((Enum)UI.BTN_GROW_OFF, CanSmithSection(callSection));
        SetActive((Enum)UI.BTN_ABILITY, CanSmithSection(callSection));
        SetActive((Enum)UI.BTN_ABILITY_OFF, CanSmithSection(callSection));
        SetActive((Enum)UI.BTN_SELL, IsEnableDispSellButton(callSection) && MonoBehaviourSingleton <ItemExchangeManager> .I.IsExchangeScene());
        if (equip != null)
        {
            int exceed = equip.exceed;
            SetActive((Enum)UI.BTN_EXCEED, equip.tableData.exceedID != 0);
            SetActive((Enum)UI.SPR_COUNT_0_ON, exceed > 0);
            SetActive((Enum)UI.SPR_COUNT_1_ON, exceed > 1);
            SetActive((Enum)UI.SPR_COUNT_2_ON, exceed > 2);
            SetActive((Enum)UI.SPR_COUNT_3_ON, exceed > 3);
            EquipParam(equip);
            SetSkillIconButton(detailBase, UI.OBJ_SKILL_BUTTON_ROOT, "SkillIconButton", equip.tableData, equipAttachSkill, "SKILL_ICON_BUTTON", 0);
            SetSprite((Enum)UI.SPR_SP_ATTACK_TYPE, (!equip.tableData.IsWeapon()) ? string.Empty : equip.tableData.spAttackType.GetBigFrameSpriteName());
            AbilityItemInfo abilityItem = equip.GetAbilityItem();
            bool            flag        = abilityItem != null;
            if ((equip.ability != null && equip.ability.Length > 0) || flag)
            {
                bool   empty_ability      = true;
                int    validAbilityLength = equip.GetValidAbilityLength();
                string allAbilityName     = string.Empty;
                string allAp          = string.Empty;
                string allAbilityDesc = string.Empty;
                SetTable(detailBase, UI.TBL_ABILITY, "ItemDetailEquipAbilityItem", equip.ability.Length + (flag ? 1 : 0), false, delegate(int i, Transform t, bool is_recycle)
                {
                    //IL_0302: Unknown result type (might be due to invalid IL or missing references)
                    //IL_0312: Expected O, but got Unknown
                    if (i < equip.ability.Length)
                    {
                        EquipItemAbility equipItemAbility2 = equip.ability[i];
                        if (equipItemAbility2.id == 0)
                        {
                            SetActive(t, false);
                        }
                        else
                        {
                            SetActive(t, true);
                            if (equipItemAbility2.IsNeedUpdate())
                            {
                                SetActive(t, UI.OBJ_ABILITY, false);
                                SetActive(t, UI.OBJ_FIXEDABILITY, false);
                                SetActive(t, UI.OBJ_NEED_UPDATE_ABILITY, true);
                                SetLabelText(t, UI.LBL_NEED_UPDATE_ABILITY, StringTable.Get(STRING_CATEGORY.ABILITY, 0u));
                                SetButtonEnabled(t, false);
                            }
                            else if (!equipItemAbility2.IsActiveAbility())
                            {
                                SetActive(t, UI.OBJ_ABILITY, false);
                                SetActive(t, UI.OBJ_FIXEDABILITY, false);
                                SetActive(t, UI.OBJ_NEED_UPDATE_ABILITY, true);
                                SetLabelText(t, UI.LBL_NEED_UPDATE_ABILITY, StringTable.Get(STRING_CATEGORY.ABILITY, 1u));
                                SetButtonEnabled(t, false);
                            }
                            else if (equip.IsFixedAbility(i))
                            {
                                SetActive(t, UI.OBJ_ABILITY, false);
                                SetActive(t, UI.OBJ_FIXEDABILITY, true);
                                SetActive(t, UI.OBJ_NEED_UPDATE_ABILITY, false);
                                SetLabelText(t, UI.LBL_FIXEDABILITY, Utility.TrimText(equipItemAbility2.GetName(), FindCtrl(t, UI.LBL_FIXEDABILITY).GetComponent <UILabel>()));
                                SetLabelText(t, UI.LBL_FIXEDABILITY_NUM, equipItemAbility2.GetAP());
                            }
                            else
                            {
                                empty_ability = false;
                                SetActive(t, UI.OBJ_NEED_UPDATE_ABILITY, false);
                                SetLabelText(t, UI.LBL_ABILITY, Utility.TrimText(equipItemAbility2.GetName(), FindCtrl(t, UI.LBL_ABILITY).GetComponent <UILabel>()));
                                SetLabelText(t, UI.LBL_ABILITY_NUM, equipItemAbility2.GetAP());
                            }
                            SetAbilityItemEvent(t, i, touchAndReleaseButtons);
                            allAbilityName += equipItemAbility2.GetName();
                            allAp          += equipItemAbility2.GetAP();
                            allAbilityDesc += equipItemAbility2.GetDescription();
                        }
                    }
                    else
                    {
                        SetActive(t, UI.OBJ_ABILITY, false);
                        SetActive(t, UI.OBJ_ABILITY_ITEM, true);
                        SetLabelText(t, UI.LBL_ABILITY_ITEM, abilityItem.GetName());
                        SetTouchAndRelease(t.GetComponentInChildren <UIButton>().get_transform(), "ABILITY_ITEM_DATA_POPUP", "RELEASE_ABILITY", t);
                        allAbilityName += abilityItem.GetName();
                        allAbilityDesc += abilityItem.GetDescription();
                    }
                });
                PreCacheAbilityDetail(allAbilityName, allAp, allAbilityDesc);
                if (empty_ability)
                {
                    SetActive(detailBase, UI.STR_NON_ABILITY, 0 == validAbilityLength);
                    SetActive((Enum)UI.BTN_ABILITY, false);
                    SetActive((Enum)UI.BTN_ABILITY_OFF, CanSmithSection(callSection));
                }
                else
                {
                    SetActive(detailBase, UI.STR_NON_ABILITY, false);
                    SetActive((Enum)UI.BTN_ABILITY_OFF, false);
                }
                if (equip.tableData.IsShadow())
                {
                    SetActive(detailBase, UI.STR_NON_ABILITY, false);
                    SetActive((Enum)UI.BTN_ABILITY, CanSmithSection(callSection));
                    SetActive((Enum)UI.BTN_ABILITY_OFF, CanSmithSection(callSection));
                }
            }
            else
            {
                SetActive(detailBase, UI.STR_NON_ABILITY, true);
                SetActive((Enum)UI.BTN_ABILITY, false);
                SetActive((Enum)UI.BTN_ABILITY_OFF, CanSmithSection(callSection));
            }
        }
        else
        {
            SetActive((Enum)UI.SPR_COUNT_0_ON, false);
            SetActive((Enum)UI.SPR_COUNT_1_ON, false);
            SetActive((Enum)UI.SPR_COUNT_2_ON, false);
            SetActive((Enum)UI.SPR_COUNT_3_ON, false);
            EquipItemTable.EquipItemData table = detailItemData as EquipItemTable.EquipItemData;
            SetActive((Enum)UI.BTN_EXCEED, table.exceedID != 0);
            EquipTableParam(table);
            SetSkillIconButton(detailBase, UI.OBJ_SKILL_BUTTON_ROOT, "SkillIconButton", table, equipAttachSkill, "SKILL_ICON_BUTTON", 0);
            SetSprite((Enum)UI.SPR_SP_ATTACK_TYPE, (!table.IsWeapon()) ? string.Empty : table.spAttackType.GetBigFrameSpriteName());
            if (table.fixedAbility.Length > 0)
            {
                string allAbilityName2 = string.Empty;
                string allAp2          = string.Empty;
                string allAbilityDesc2 = string.Empty;
                SetTable(detailBase, UI.TBL_ABILITY, "ItemDetailEquipAbilityItem", table.fixedAbility.Length, false, delegate(int i, Transform t, bool is_recycle)
                {
                    EquipItemAbility equipItemAbility = new EquipItemAbility((uint)table.fixedAbility[i].id, table.fixedAbility[i].pt);
                    SetActive(t, true);
                    SetActive(t, UI.OBJ_ABILITY, false);
                    SetActive(t, UI.OBJ_FIXEDABILITY, true);
                    SetLabelText(t, UI.LBL_FIXEDABILITY, Utility.TrimText(equipItemAbility.GetName(), FindCtrl(t, UI.LBL_FIXEDABILITY).GetComponent <UILabel>()));
                    SetLabelText(t, UI.LBL_FIXEDABILITY_NUM, equipItemAbility.GetAP());
                    SetAbilityItemEvent(t, i, touchAndReleaseButtons);
                    allAbilityName2 += equipItemAbility.GetName();
                    allAp2          += equipItemAbility.GetAP();
                    allAbilityDesc2 += equipItemAbility.GetDescription();
                });
                PreCacheAbilityDetail(allAbilityName2, allAp2, allAbilityDesc2);
                SetActive(detailBase, UI.STR_NON_ABILITY, false);
            }
            else
            {
                SetActive(detailBase, UI.STR_NON_ABILITY, true);
            }
        }
    }
 protected override void ResultEquipInfo()
 {
     if (resultData.itemData != null)
     {
         EquipItemInfo item = resultData.itemData as EquipItemInfo;
         EquipItemTable.EquipItemData tableData = item.tableData;
         bool flag = tableData.IsVisual();
         SetActive(detailBase, UI.BTN_SELL, false);
         SetActive(detailBase, UI.BTN_GROW, false);
         SetActive(detailBase, UI.BTN_GRAY, false);
         SetActive(detailBase, UI.OBJ_FAVORITE_ROOT, false);
         SetActive(detailBase, UI.SPR_IS_EVOLVE, item.tableData.IsEvolve());
         SetActive(detailBase, UI.STR_LV, !flag);
         SetActive(detailBase, UI.STR_ONLY_VISUAL, flag);
         SetupBottomButton();
         SetLabelText(detailBase, UI.LBL_NAME, tableData.name);
         SetLabelText(detailBase, UI.LBL_LV_MAX, tableData.maxLv.ToString());
         SetSprite(detailBase, UI.SPR_SP_ATTACK_TYPE, (!tableData.IsWeapon()) ? string.Empty : tableData.spAttackType.GetBigFrameSpriteName());
         if (smithType == SmithType.GROW)
         {
             string text = base.sectionData.GetText("STATUS_DIFF_FORMAT");
             SetLabelCompareParam(detailBase, UI.LBL_LV_NOW, item.level, resultData.beforeLevel, -1);
             SetLabelDiffParam(detailBase, UI.LBL_AFTER_ATK, item.atk, UI.LBL_DIFF_ATK, resultData.beforeAtk, UI.LBL_ATK, text);
             SetLabelDiffParam(detailBase, UI.LBL_AFTER_DEF, item.def, UI.LBL_DIFF_DEF, resultData.beforeDef, UI.LBL_DEF, text);
             SetLabelDiffParam(detailBase, UI.LBL_AFTER_HP, item.hp, UI.LBL_DIFF_HP, resultData.beforeHp, UI.LBL_HP, text);
             SetLabelDiffParam(detailBase, UI.LBL_AFTER_ELEM, item.elemAtk, UI.LBL_DIFF_ELEM, resultData.beforeElemAtk, UI.LBL_ELEM, text);
             SetDiffElementSprite(detailBase, item.GetElemAtkType(), resultData.beforeElemAtk, item.elemAtk, UI.SPR_ELEM, UI.SPR_DIFF_ELEM, true);
             int num  = item.elemDef;
             int num2 = resultData.beforeElemDef;
             if (item.tableData.isFormer)
             {
                 num  = Mathf.FloorToInt((float)num * 0.1f);
                 num2 = Mathf.FloorToInt((float)num2 * 0.1f);
             }
             SetLabelDiffParam(detailBase, UI.LBL_AFTER_ELEM_DEF, num, UI.LBL_DIFF_ELEM_DEF, num2, UI.LBL_ELEM_DEF, text);
             SetDiffElementSprite(detailBase, item.GetElemDefType(), resultData.beforeElemDef, item.elemDef, UI.SPR_ELEM_DEF, UI.SPR_DIFF_ELEM_DEF, false);
         }
         else
         {
             SetLabelText(detailBase, UI.LBL_LV_NOW, item.level.ToString());
             SetLabelText(detailBase, UI.LBL_ATK, item.atk.ToString());
             SetLabelText(detailBase, UI.LBL_DEF, item.def.ToString());
             SetLabelText(detailBase, UI.LBL_HP, item.hp.ToString());
             SetLabelText(detailBase, UI.LBL_ELEM, item.elemAtk.ToString());
             SetElementSprite(detailBase, UI.SPR_ELEM, item.GetElemAtkType());
             int num3 = item.elemDef;
             if (item.tableData.isFormer)
             {
                 num3 = Mathf.FloorToInt((float)num3 * 0.1f);
             }
             SetLabelText(detailBase, UI.LBL_ELEM_DEF, num3.ToString());
             SetDefElementSprite(detailBase, UI.SPR_ELEM_DEF, item.GetElemDefType());
         }
         SetSkillIconButton(detailBase, UI.OBJ_SKILL_BUTTON_ROOT, "SkillIconButton", item.tableData, GetSkillSlotData(item), "SKILL_ICON_BUTTON", 0);
         SetLabelText(detailBase, UI.LBL_SELL, tableData.sale.ToString());
         SetEquipmentTypeIcon(detailBase, UI.SPR_TYPE_ICON, UI.SPR_TYPE_ICON_BG, UI.SPR_TYPE_ICON_RARITY, item.tableData);
         AbilityItemInfo abilityItem = item.GetAbilityItem();
         bool            flag2       = abilityItem != null;
         if ((item.ability != null && item.ability.Length > 0) || flag2)
         {
             bool   empty_ability  = true;
             string allAbilityName = string.Empty;
             string allAp          = string.Empty;
             string allAbilityDesc = string.Empty;
             SetTable(detailBase, UI.TBL_ABILITY, "ItemDetailEquipAbilityItem", item.ability.Length + (flag2 ? 1 : 0), false, delegate(int i, Transform t, bool is_recycle)
             {
                 //IL_0211: Unknown result type (might be due to invalid IL or missing references)
                 //IL_0221: Expected O, but got Unknown
                 if (i < item.ability.Length)
                 {
                     EquipItemAbility equipItemAbility = item.ability[i];
                     if (equipItemAbility.id == 0)
                     {
                         SetActive(t, false);
                     }
                     else
                     {
                         empty_ability = false;
                         SetActive(t, true);
                         if (equipItemAbility.IsNeedUpdate())
                         {
                             SetActive(t, UI.OBJ_ABILITY, false);
                             SetActive(t, UI.OBJ_FIXEDABILITY, false);
                             SetActive(t, UI.OBJ_NEED_UPDATE_ABILITY, true);
                             SetButtonEnabled(t, false);
                         }
                         else if (item.IsFixedAbility(i))
                         {
                             SetActive(t, UI.OBJ_ABILITY, false);
                             SetActive(t, UI.OBJ_FIXEDABILITY, true);
                             SetLabelText(t, UI.LBL_FIXEDABILITY, equipItemAbility.GetName());
                             SetLabelText(t, UI.LBL_FIXEDABILITY_NUM, equipItemAbility.GetAP());
                         }
                         else
                         {
                             SetLabelText(t, UI.LBL_ABILITY, equipItemAbility.GetName());
                             SetLabelText(t, UI.LBL_ABILITY_NUM, equipItemAbility.GetAP());
                         }
                         SetAbilityItemEvent(t, i, touchAndReleaseButtons);
                         allAbilityName += equipItemAbility.GetName();
                         allAp          += equipItemAbility.GetAP();
                         allAbilityDesc += equipItemAbility.GetDescription();
                     }
                 }
                 else
                 {
                     SetActive(t, UI.OBJ_ABILITY, false);
                     SetActive(t, UI.OBJ_ABILITY_ITEM, true);
                     SetLabelText(t, UI.LBL_ABILITY_ITEM, abilityItem.GetName());
                     SetTouchAndRelease(t.GetComponentInChildren <UIButton>().get_transform(), "ABILITY_ITEM_DATA_POPUP", "RELEASE_ABILITY", t);
                     allAbilityName += abilityItem.GetName();
                     allAbilityDesc += abilityItem.GetDescription();
                 }
             });
             PreCacheAbilityDetail(allAbilityName, allAp, allAbilityDesc);
             if (empty_ability)
             {
                 SetActive(detailBase, UI.STR_NON_ABILITY, true);
             }
             else
             {
                 SetActive(detailBase, UI.STR_NON_ABILITY, false);
             }
         }
         else
         {
             SetActive(detailBase, UI.STR_NON_ABILITY, true);
         }
     }
 }