Exemplo n.º 1
0
    private void SetItemIcons(int itemId)
    {
        this.rootTypeId   = itemId;
        this.branchTypeId = GemGlobal.GetNeedId(itemId);
        bool enabled = GemUI.instance.typeIdNext != this.rootTypeId;

        this.btnGrids[0].get_transform().GetComponent <Animator>().set_enabled(enabled);
        this.btnGrids[0].get_transform().set_localScale(Vector3.get_one());
        GemSingleUI gemSingleUI = UIManagerControl.Instance.GetUIIfExist("GemSingleUI") as GemSingleUI;

        if (gemSingleUI != null)
        {
            gemSingleUI.SetOneGem(itemId);
        }
        if (GemGlobal.IsActiveOneKeyCompose(GemUI.instance.equipCurr, GemUI.instance.slotCurr, this.rootTypeId))
        {
            this.btnCompose.get_transform().set_localPosition(this.btnCompose.get_transform().get_localPosition().AssignX(-92.2f));
            this.btnOneKeyCompose.set_enabled(true);
            this.btnOneKeyCompose.get_gameObject().SetActive(true);
            this.btnOneKeyCompose.onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickBtnOneKeyCompose);
            List <MaterialGem> oneKeyComposeGems = GemGlobal.GetOneKeyComposeGems(GemUI.instance.equipCurr, GemUI.instance.slotCurr, this.rootTypeId);
            if (oneKeyComposeGems != null)
            {
                Text component         = base.FindTransform("btnOneKeyCompose").FindChild("texCostVal").GetComponent <Text>();
                int  oneKeyComposeCost = GemGlobal.GetOneKeyComposeCost(oneKeyComposeGems, this.rootTypeId);
                component.set_text("x" + oneKeyComposeCost);
                this.SetCostActive("btnOneKeyCompose", true, oneKeyComposeCost);
            }
            else
            {
                this.SetCostActive("btnOneKeyCompose", false, 0);
            }
        }
        else
        {
            this.btnCompose.get_transform().set_localPosition(this.btnCompose.get_transform().get_localPosition().AssignXZero());
            this.btnOneKeyCompose.set_enabled(false);
            this.btnOneKeyCompose.get_gameObject().SetActive(false);
        }
        this.SetScroll(GemUI.instance.typeIdNext, itemId);
        this.SetOneItemIcon(0, this.rootTypeId);
        this.SetOneItemIcon(1, this.branchTypeId);
        Text component2 = base.FindTransform("btnCompose").FindChild("texCostVal").GetComponent <Text>();
        int  amount     = GemGlobal.GetAmount(itemId);

        component2.set_text("x" + amount);
        this.SetCostActive("btnCompose", true, amount);
        int         num            = 0;
        List <long> materailGemIds = this.GetMaterailGemIds(itemId, ref num);
        Transform   transform      = this.btnGrids[1].get_transform().Find("texPercent");
        int         composeAmount  = GemGlobal.GetComposeAmount(itemId);
        string      text           = (materailGemIds.get_Count() < composeAmount) ? "<color=#ff0000>" : "<color=#00ff00>";

        transform.GetComponent <Text>().set_text(string.Concat(new object[]
        {
            text,
            num,
            "</color>/",
            composeAmount
        }));
    }