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
    private SpringPanel springPanel;    //复位背包列表

    void Awake()
    {
        Instance       = this;
        mButton_Closed = GetWidget("Button_Closed");
        if (mButton_Closed != null)
        {
            mButton_Closed.OnMouseClick = this.ButtonClosedOnClick;
        }
        Equip_Weapon      = Global.FindChild <BackpackRoleEquip>(transform, "Button_Weapon");
        Equip_Clothes     = Global.FindChild <BackpackRoleEquip>(transform, "Button_Clothes");
        Equip_Pants       = Global.FindChild <BackpackRoleEquip>(transform, "Button_Pants");
        Equip_Bracers     = Global.FindChild <BackpackRoleEquip>(transform, "Button_Bracers");
        Equip_Necklace    = Global.FindChild <BackpackRoleEquip>(transform, "Button_Necklace");
        Equip_Shoes       = Global.FindChild <BackpackRoleEquip>(transform, "Button_Shoes");
        mLabel_Hp         = Global.FindChild <UILabel>(transform, "Label_Hp");
        mLabel_Mp         = Global.FindChild <UILabel>(transform, "Label_Mp");
        mLabel_GoodsCount = Global.FindChild <UILabel>(transform, "Label_GoodsCount");
        mLabel_Price      = Global.FindChild <UILabel>(transform, "Label_Price");
        mLabel_Power      = Global.FindChild <UILabel>(transform, "Label_Power");

        mButton_Arrange = GetWidget("Button_Arrange");
        if (mButton_Arrange != null)
        {
            mButton_Arrange.OnMouseClick = this.ButtonArrangeOnClick;
        }
        mButton_sale = GetWidget("Button_Sale");
        if (mButton_sale != null)
        {
            mButton_sale.OnMouseClick = this.ButtonsaleOnClick;
        }
        DisableButton();                                                      //禁用出售按钮
        GoodsManager.Instance.FindGoods();                                    //初始化背包列表
        mLabel_Power.text = CharacterTemplate.Instance.GetPower().ToString(); //设置战斗力数值
        UpdateGoodsInfo();                                                    //更新背包栏
        v3 = new Vector3(372f, 157f, 0);
    }