Example #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);
            }
        }
    }