Exemple #1
0
    void RefreshBeforeAndAfterAttribute()
    {
        beforeFusionLevel.text = Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMFUSIONLEVEL") + " : " + _equipment.CurrentFusionLevel();

        if (null != _equipment.NextFusionData)
        {
            afterFusionLevel.text = Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMFUSIONLEVEL") + " : " + (int)(_equipment.CurrentFusionLevel() + 1);
            afterTitle.text       = Localization.Localize("IDS_MESSAGE_FUSION_AFTER");

            afterAttribute1.text = _equipment.GetFusionAttribute0(false);
            afterAttribute2.text = _equipment.GetFusionAttribute1(false);
            afterAttribute3.text = _equipment.GetFusionAttribute2(false);

            afterAttribute1.gameObject.SetActive(true);
            afterAttribute2.gameObject.SetActive(true);
            afterAttribute3.gameObject.SetActive(true);
            afterFusionLevel.gameObject.SetActive(true);
            supplementButton.gameObject.SetActive(true);
            scIcon.gameObject.SetActive(true);
            fusionCostSC.gameObject.SetActive(true);
            startFusionButton.gameObject.SetActive(true);
        }
        else
        {
            afterTitle.text = Localization.Localize("IDS_MESSAGE_FUSION_MAXFUSIONLEVEL");
            afterFusionLevel.gameObject.SetActive(false);
            afterAttribute1.gameObject.SetActive(false);
            afterAttribute2.gameObject.SetActive(false);
            afterAttribute3.gameObject.SetActive(false);
            supplementButton.gameObject.SetActive(false);
            scIcon.gameObject.SetActive(false);
            fusionCostSC.gameObject.SetActive(false);
            startFusionButton.gameObject.SetActive(false);
        }
        beforeAttribute1.text = _equipment.GetFusionAttribute0(true);
        beforeAttribute2.text = _equipment.GetFusionAttribute1(true);
        beforeAttribute3.text = _equipment.GetFusionAttribute2(true);
    }
    void OnEnable()
    {
        if (null != FCUIInventory.Instance)
        {
            _currentItem        = FCUIInventory.Instance.CurrentSelectionItem;
            itemNameLabel.text  = Localization.Localize(_currentItem.ItemData.nameIds);
            itemNameLabel.color = FCConst.RareColorMapping[(EnumRareLevel)_currentItem.ItemData.rareLevel];
            if (_currentItem.ItemData.type != ItemType.tattoo)
            {
                slot.Item = _currentItem;
            }
            equipLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMLEVEL"), _currentItem.ItemData.level.ToString());
            useLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMENABLELEVEL"), _currentItem.ItemData.enableLevel.ToString());
            fightScore.FS = _currentItem.FS;
            tattooSlot.gameObject.SetActive(false);
            slot.gameObject.SetActive(true);
            costSC.SC = _currentItem.CostSC;
            if (_currentItem.IsEquipment())
            {
                SitchOtherLayout(false);

                itemPartValue.Refresh(Localization.Localize("IDS_MESSAGE_INVENTORY_EQUIPPART"), Localization.Localize(Utils.GetItemPartNamesIDS(_currentItem.ItemData.type, _currentItem.ItemData.subType)));
                fusionLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMFUSIONLEVEL"), _currentItem.CurrentFusionLevel().ToString());
                attribute1.Refresh(_currentItem, 0);
                attribute2.Refresh(_currentItem, 1);
                attribute3.Refresh(_currentItem, 2);
                attribute4.Clear();
                attribute5.Clear();
                attribute6.Clear();
                equipButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_EQUIP");
                equipButton.gameObject.SetActive(true);
                fusionButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_FUSION");
                fusionButton.gameObject.SetActive(true);

                itemPartValue.gameObject.SetActive(true);
                useLevelValue.gameObject.SetActive(true);
                fusionLevelValue.gameObject.SetActive(true);
                equipLevelValue.gameObject.SetActive(true);
                fightScore.gameObject.SetActive(true);

                //whether the equipment is on body
                if (_currentItem.IsEquiped())
                {
                    equipButton.GetComponent <UIImageButton>().isEnabled = false;
                    sellButton.GetComponent <UIImageButton>().isEnabled  = false;
                }
                else
                {
                    equipButton.GetComponent <UIImageButton>().isEnabled = true;
                    sellButton.GetComponent <UIImageButton>().isEnabled  = true;
                }
                //fusion
                if (null != _currentItem.NextFusionData)
                {
                    fusionButton.GetComponent <UIImageButton>().isEnabled = true;
                }
                else
                {
                    fusionButton.GetComponent <UIImageButton>().isEnabled = false;
                }
            }
            else//not equipment
            {
                SitchOtherLayout(true);

                itemPartValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMTYPE"), Localization.Localize(Utils.GetItemPartNamesIDS(_currentItem.ItemData.type, _currentItem.ItemData.subType)));
                attribute1.Refresh(Localization.Localize(_currentItem.ItemData.descriptionIds));
                attribute2.Clear();
                attribute3.Clear();
                attribute4.Clear();
                attribute5.Clear();
                attribute6.Clear();

                itemPartValue.gameObject.SetActive(true);
                equipLevelValue.gameObject.SetActive(true);
                useLevelValue.gameObject.SetActive(false);
                fusionLevelValue.gameObject.SetActive(false);
                fightScore.gameObject.SetActive(false);

                middleButton.gameObject.SetActive(true);
                otherSellButton.gameObject.SetActive(true);

                //tatoo
                if (_currentItem.ItemData.type == ItemType.tattoo)
                {
                    rightButton.isEnabled = true;
                    rightButton.gameObject.SetActive(true);
                    rightButton.label.text = Localization.Localize("IDS_BUTTON_TATTOO_TATTOODISENCHANT");

                    middleButton.gameObject.SetActive(true);
                    middleButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_EQUIP");
                    tattooSlot.tattooItem   = _currentItem;
                    tattooSlot.gameObject.SetActive(true);
                    slot.gameObject.SetActive(false);
                    useLevelValue.gameObject.SetActive(true);
                    fusionLevelValue.gameObject.SetActive(true);
                    TattooData td = DataManager.Instance.GetTattooData(_currentItem.ItemData.id);
                    useLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_TATTOO_TATTOOBEARPOINT")
                                          , td.bearingPoint.ToString());
                    fusionLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_TATTOO_TATTOOPOSITION")
                                             , Utils.GetTattooApplicablePositions(td.applicableParts));
                }//tribute
                else if (_currentItem.ItemData.type == ItemType.tribute)
                {
                    middleButton.gameObject.SetActive(false);

                    rightButton.gameObject.SetActive(true);
                    rightButton.label.text = Localization.Localize("IDS_BUTTON_HUD_TRIBUTE");
                }//recipe
                else if (_currentItem.ItemData.type == ItemType.recipe)
                {
                    middleButton.isEnabled = true;
                    middleButton.gameObject.SetActive(true);
                    middleButton.label.text = Localization.Localize("IDS_BUTTON_TATTOO_ACTIVATION");

                    rightButton.isEnabled = true;
                    rightButton.gameObject.SetActive(true);
                    rightButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_EXCHANGE");
                }
                else
                {
                    middleButton.gameObject.SetActive(false);
                    rightButton.gameObject.SetActive(false);
                }
            }
        }
    }