Exemple #1
0
    //角色装备按钮点击事件
    public void ShowGoodsItem(UISceneWidget eventObj, GoodsItem gi, bool isLeft)
    {
        if (gi.Goods.GoodsType == GoodsType.Equip)
        {
            UIGoodsItem       uigi      = null;
            BackpackRoleEquip roleEquip = null;
            if (isLeft)
            {
                uigi = eventObj.GetComponent <UIGoodsItem>();
            }
            else
            {
                roleEquip = eventObj.GetComponent <BackpackRoleEquip>();
            }
            UIGoods.Instance.Close();                           //关闭道具界面
            UIEquip.Instance.Show(gi, isLeft, uigi, roleEquip); //显示装备界面
        }
        else                                                    /*if(gi.Goods.GoodsType == GoodsType.Drug)*/
        {
            UIGoodsItem uigi = eventObj.GetComponent <UIGoodsItem>();
            UIEquip.Instance.Close();                   //关闭装备界面
            UIGoods.Instance.Show(gi, uigi);            //显示道具界面
        }

        //如果是装备类型,且为背包装备,或者不为装备类型,可以出售物品
        if ((gi.Goods.GoodsType == GoodsType.Equip && isLeft) || gi.Goods.GoodsType != GoodsType.Equip)
        {
            this.uigi = eventObj.GetComponent <UIGoodsItem>();
            EnableButton();
            //出售价格 = 物品单价 × 物品数量
            mLabel_Price.text = (this.uigi.goodsItem.Goods.Price * this.uigi.goodsItem.Count).ToString();
        }
    }
Exemple #2
0
    public void Show(GoodsItem gi, bool isLeft, UIGoodsItem uigi, BackpackRoleEquip roleEquip)
    {
//		gameObject.SetActive(true);
        SetVisible(true);
        goodsItem      = gi;
        uiGoodsItem    = uigi;
        this.roleEquip = roleEquip;

        Vector3 pos = transform.localPosition;          //自身坐标

        this.isLeft = isLeft;
        if (isLeft)                                                                 //如果在左边显示
        {
            transform.localPosition = new Vector3(-Mathf.Abs(pos.x), pos.y, pos.z); //Mathf.Abs取绝对值
            mLabel_Equip.text       = "装备";
        }
        else
        {
            transform.localPosition = new Vector3(Mathf.Abs(pos.x), pos.y, pos.z);
            mLabel_Equip.text       = "脱下";
        }

        mSprite_Equip.spriteName = gi.Goods.ICON;
        mLabel_Name.text         = gi.Goods.Name;
        mLabel_Quality.text      = gi.Goods.Quality.ToString();
        mLabel_Damage.text       = gi.Goods.Damage.ToString();
        mLabel_Hp.text           = gi.Goods.HP.ToString();
        mLabel_Des.text          = gi.Goods.Des;
        mLabel_Lv.text           = gi.Level.ToString();
    }
Exemple #3
0
 //显示
 public void Show(GoodsItem gi, UIGoodsItem uigi)
 {
     SetVisible(true);
     this.gi                 = gi;
     this.uigi               = uigi;
     mLabel_Name.text        = gi.Goods.Name;
     mSprite_Icon.spriteName = gi.Goods.ICON;
     mLabel_Des.text         = gi.Goods.Des;
     mLabel_Number.text      = "使用(" + gi.Count + ")";
 }
Exemple #4
0
 private void ClearObject()
 {
     goodsItem   = null;
     uiGoodsItem = null;             //清空背包
 }
Exemple #5
0
 void Clear()
 {
     gi        = null;
     this.uigi = null;
 }