Exemple #1
0
    public override void UpdateUI()
    {
        ClearMaterials();
        base.UpdateUI();

        if (item == null)
        {
            return;
        }

        Piece.InventoryPiece piece = (Piece.InventoryPiece)item;

        for (int i = 0; i < piece.piece.materialsNeeded.Length; i++)
        {
            GameObject go = ObjectPool.Instantiate(prefab, prefab.transform.position, prefab.transform.rotation, parent);

            RectTransform rect = go.GetComponent <RectTransform>();
            rect.transform.localScale = Vector3.one;

            InventoryItemUI            itemUI = go.GetComponent <InventoryItemUI>();
            GameMaterial.InventoryItem gmItem = new GameMaterial.InventoryItem()
            {
                material = piece.piece.materialsNeeded[i].material,
                quantity = piece.piece.materialsNeeded[i].quantity
            };

            itemUI.item = gmItem;
            itemUI.UpdateUI();
        }
    }
Exemple #2
0
    public void Show(InventoryItem it, InventoryItemUI itUI, KnapsackRoleEquip roleEquip, bool isLeft = true)
    {
        OnForwardClick();

        this.it        = it;
        this.itUI      = itUI;
        this.roleEquip = roleEquip;
        Vector3 pos = transform.localPosition;

        this.isLeft = isLeft;
        if (isLeft)
        {
            transform.localPosition = new Vector3(-Mathf.Abs(pos.x), pos.y, pos.z);
            equipdownText.text      = "穿上装备";
        }
        else
        {
            transform.localPosition = new Vector3(Mathf.Abs(pos.x), pos.y, pos.z);
            equipdownText.text      = "御下装备";
        }

        zhuangbeiImage.overrideSprite = Resources.Load(it.Inventory.Icon, typeof(Sprite)) as Sprite;
        nameText.text     = it.Inventory.Name;
        zheliangText.text = it.Inventory.Quality.ToString();
        dangeText.text    = it.Inventory.Damage.ToString();
        leftText.text     = it.Inventory.HP.ToString();    //
        levelText.text    = it.Level.ToString();
        powerText.text    = it.Inventory.Power.ToString(); //
        doesText.text     = it.Inventory.Des;              //
    }
Exemple #3
0
 //接受点击每个小格子传来消息
 public void OnInventoryClick(object[] objectArray)
 {
     InventoryItem it = objectArray[0] as InventoryItem;
     InventoryItemUI itUI =null;
     KnapspackRoleEquip kre = null;
     bool isLeft=false;
     if(it.Inventory.InventoryTYPE==InventoryType.Equip)
     {
        isLeft= (bool)objectArray[1];
         if(isLeft)
         {
             itUI = objectArray[2] as InventoryItemUI;
         }
         else
         {
             kre = objectArray[2] as KnapspackRoleEquip;
         }
         equip.Show(it,itUI,isLeft);
     }
     else
     {
         itUI = objectArray[2] as InventoryItemUI;
         inventoryPopup.Show(it,itUI);
     }
     if((it.Inventory.InventoryTYPE==InventoryType.Equip&&isLeft)||it.Inventory.InventoryTYPE!=InventoryType.Equip)
     {
         this.itUI = objectArray[2] as InventoryItemUI;
         EnableButton(itUI.it.Inventory.Price*itUI.it.Count);
     }
 }
Exemple #4
0
 public void Close()
 {
     gameObject.SetActive(false);
     it    = null;
     itui  = null;
     eitem = null;
 }
Exemple #5
0
 public void Show(InventoryItem it, InventoryItemUI itUI, bool isLeft = true)
 {
     gameObject.SetActive(true);
     this.it     = it;
     this.itUI   = itUI;
     this.isLeft = isLeft;
     if (isLeft)
     {
         btnText.text = "卸下";
         transform.GetComponent <RectTransform>().anchoredPosition = new Vector2(400, 0);
     }
     else
     {
         btnText.text = "装备";
         transform.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
     }
     equipImage.sprite = Resources.Load("Equip/" + it.Inventory.ICON, typeof(Sprite)) as Sprite;
     nameText.text     = it.Inventory.Name;
     qualityText.text  = it.Inventory.Quality.ToString();
     damageText.text   = it.Inventory.Damage.ToString();
     hpText.text       = it.Inventory.HP.ToString();
     powerText.text    = it.Inventory.Power.ToString();
     levelText.text    = it.Inventory.Level.ToString();
     desText.text      = it.Inventory.DES;
 }
Exemple #6
0
    public void OnThrowButtonClicked()
    {
        if (mSelectedItem == null)
        {
            Debug.LogError("No selected item.");
            return;
        }

        var item = mSelectedItem.Item;
        var spec = item.Spec as InventoryItemThrowableSpec;

        if (spec == null)
        {
            return;
        }

        InventoryActionsPanel.SetActive(false);
        mSelectedItem = null;
        UpdateInfoPanel();

        if (!mGameController.Inventory.RemoveItem(item, notifyChanged: false))
        {
            return;
        }

        mUI.OnCloseInventoryButtonClicked();
        mGameController.PerformThrowAttack(spec.Throwable);
    }
Exemple #7
0
    public void OnEatButtonClicked()
    {
        if (mSelectedItem == null)
        {
            Debug.LogError("No selected item.");
            return;
        }

        var item = mSelectedItem.Item;
        var spec = item.Spec as InventoryItemConsumableSpec;

        if (spec == null)
        {
            return;
        }

        InventoryActionsPanel.SetActive(false);
        mSelectedItem = null;
        UpdateInfoPanel();

        if (!mGameController.Inventory.RemoveItem(item))
        {
            return;
        }

        mGameController.AdjustHealth(spec.HealthBonusPercent * mGameController.MaxHealth / 100L);
    }
Exemple #8
0
    public void OnEquipButtonClicked()
    {
        if (mSelectedItem == null)
        {
            Debug.LogError("No selected item.");
            return;
        }

        var item = mSelectedItem.Item;
        var spec = item.Spec as InventoryItemWeaponSpec;

        if (spec == null)
        {
            return;
        }

        if (mGameController.EquippedWeapon != item)
        {
            mGameController.EquipWeapon(item);
            Refresh(false);
        }

        InventoryActionsPanel.SetActive(false);
        mSelectedItem = null;
        UpdateInfoPanel();

        mUI.OnCloseInventoryButtonClicked();
    }
Exemple #9
0
    public void ClickItem(InventoryItemUI item, Vector2 position)
    {
        if (item != null && item.Item != null && item.Item.Spec != null && !InventoryActionsPanel.activeSelf)
        {
            mSelectedItem = item;
            UpdateInfoPanel();

            InventoryActionsPanel.SetActive(true);
            InventoryActionsPanelContents.GetComponent <RectTransform>().anchoredPosition = position;

            var weapon = mSelectedItem.Item.Spec as InventoryItemWeaponSpec;

            bool isWeapon    = weapon != null;
            bool isFood      = mSelectedItem.Item.Spec is InventoryItemConsumableSpec;
            bool isThrowable = mSelectedItem.Item.Spec is InventoryItemThrowableSpec;
            bool isEquipped  = mSelectedItem.Item == mGameController.EquippedWeapon;

            bool canThrow   = !isEquipped && isThrowable;
            bool canEat     = isFood;
            bool canUpgrade = isWeapon && weapon.CanUpgrade();
            bool canEquip   = isWeapon && !isEquipped;

            if (canUpgrade)
            {
                string cost = $"<size=60%><color=#FF4040>-{weapon.GetUpgradeCost()}";
                UpgradeButtonText.text = String.Format(Language.Current.UpgradeButton, cost);
            }

            NoActions.SetActive(!canThrow && !canEat && !canUpgrade && !canEquip);
            ThrowButton.SetActive(canThrow);
            EatButton.SetActive(canEat);
            UpgradeButton.SetActive(canUpgrade);
            EquipButton.SetActive(canEquip);
        }
    }
Exemple #10
0
 public void  SetEquipPopup(InventoryItem item, InventoryItemUI itemUI, KnapsackRoleEquip roleEquip, bool isLeft = true)
 {
     this.gameObject.SetActive(true);
     this.isLeft = isLeft;
     if (isLeft == true)
     {
         this.transform.position = Vector3.zero;
         btnLabel.text           = "装备";
     }
     else
     {
         this.transform.localPosition = new Vector3(500f, 0f, 0f);
         btnLabel.text = "卸下";
     }
     this.inventory       = item;
     this.inventoryItemUI = itemUI;
     this.roleEquip       = roleEquip;
     sprite.spriteName    = item.Inventory.Icon;
     nameLabel.text       = item.Inventory.Name;
     qualityLabel.text    = item.Inventory.Quality.ToString();
     damageLabel.text     = item.Inventory.Damage.ToString();
     hpLabel.text         = item.Inventory.Hp.ToString();
     powerLabel.text      = item.Inventory.Power.ToString();
     desLabel.text        = item.Inventory.Des;
     levelLabel.text      = item.Level.ToString();
 }
Exemple #11
0
    //接受点击每个小格子传来消息
    public void OnInventoryClick(object[] objectArray)
    {
        InventoryItem      it   = objectArray[0] as InventoryItem;
        InventoryItemUI    itUI = null;
        KnapspackRoleEquip kre  = null;
        bool isLeft             = false;

        if (it.Inventory.InventoryTYPE == InventoryType.Equip)
        {
            isLeft = (bool)objectArray[1];
            if (isLeft)
            {
                itUI = objectArray[2] as InventoryItemUI;
            }
            else
            {
                kre = objectArray[2] as KnapspackRoleEquip;
            }
            equip.Show(it, itUI, isLeft);
        }
        else
        {
            itUI = objectArray[2] as InventoryItemUI;
            inventoryPopup.Show(it, itUI);
        }
        if ((it.Inventory.InventoryTYPE == InventoryType.Equip && isLeft) || it.Inventory.InventoryTYPE != InventoryType.Equip)
        {
            this.itUI = objectArray[2] as InventoryItemUI;
            EnableButton(itUI.it.Inventory.Price * itUI.it.Count);
        }
    }
Exemple #12
0
    public void onInventoryClick(object[] objArray)
    {
        InventoryItem it     = objArray[0] as InventoryItem;
        bool          isLeft = (bool)objArray[1];

        if (it.Inventory.InventoryType == InventoryType.Equip)
        {
            inventoryPopup.onClose();
            if (isLeft == false)
            {
                itUI = objArray[2] as InventoryItemUI;
                enableSellBtn();
                sellPriceTxt.text = (itUI.it.Inventory.Price * itUI.it.Count).ToString();
            }
            equipPopup.Show(it, itUI, isLeft);
        }
        else
        {
            itUI = objArray[2] as InventoryItemUI;
            equipPopup.onClose();
            inventoryPopup.Show(it, itUI);
            enableSellBtn();
            sellPriceTxt.text = (itUI.it.Inventory.Price * itUI.it.Count).ToString();
        }
    }
Exemple #13
0
    public void OnEquipClick(object[] objectArry)
    {
        it     = (InventoryItem)objectArry[0];
        isLeft = (bool)objectArry[1];

        if (isLeft)
        {
            itUI = (InventoryItemUI)objectArry[2];
        }
        else
        {
            kSRE = (KnapStackRoleEquip)objectArry[2];
        }

        if (it.inventory.ItemsType == ItemType.Equip)
        {
            equipInfoFrame.ShowEquipInfoUI(it, itUI, kSRE, isLeft);
            itemInfoFrame.CloseButtonClick();
        }
        else
        {
            itUI = (InventoryItemUI)objectArry[2];
            itemInfoFrame.ShowItemDesUI(it, itUI);
            equipInfoFrame.CloseButtonClick();
        }

        if (it.inventory.ItemsType != ItemType.Equip || (it.inventory.ItemsType == ItemType.Equip && isLeft))
        {
            this.transform.GetChild(2).SendMessage("OnEnableButton", (InventoryItemUI)objectArry[2]);
        }
    }
Exemple #14
0
    public void OnInventoryClick(object[] arr)
    {
        InventoryItem item   = arr[0] as InventoryItem;
        bool          isLeft = (bool)arr[1];

        InventoryItemUI   itemUI    = null;
        KnapsackRoleEquip roleEquip = null;

        if (isLeft)
        {
            itemUI = arr[2] as InventoryItemUI;
        }
        else
        {
            roleEquip = arr[2] as KnapsackRoleEquip;
        }

        if (item.Inventory.InventoryType == InventoryType.Equip)
        {
            equipPopup.SetEquipPopup(arr[0] as InventoryItem, itemUI, roleEquip, isLeft);
        }
        else
        {
            InventoryItemUI itemUIdrug = arr[2] as InventoryItemUI;
            inventoryPopup.SetInventoryPopup(arr[0] as InventoryItem, itemUIdrug);
        }
    }
    private void Update()
    {
        if (
            GameMaster.sharedInstance.currentScene.name != SceneName.mainMenu &&
            GameMaster.sharedInstance.currentScene.name != SceneName.characterSelection
            )
        {
            if (Input.GetKeyUp(KeyCode.I))
            {
                inventoryPanel.SetActive(!inventoryPanel.activeInHierarchy);
            }
        }

        if (Input.GetKeyUp(KeyCode.G))
        {
            GameObject      newButton       = Instantiate(inventoryItemElement) as GameObject;
            InventoryItemUI inventoryItemUI = newButton.GetComponent <InventoryItemUI>();
            inventoryItemUI.itemElementText.text = string.Format("Nuevo ítem {0}", Time.time);
            newButton.transform.SetParent(inventoryPanelItem);

            //inventoryItemUI.equipButton.GetComponent<Button>().onClick.AddListener(
            //    () =>
            //    {

            //    }
            //);

            //newButton.transform.SetParent(inventoryPanelItem);
        }
    }
Exemple #16
0
    // Adds an Item at origin x, y using item's space
    // TODO: Prechecks for performance
    // A: Check if item shape > inventory shape (very unlikely)
    // B: Keep track of remaining space and compare remaining space before anything else
    public bool AddItemAtSlot(InventoryItemUI item, int x, int y)
    {
        // Debug.Log(PrintGrid());
        Debug.Log("Base State:");
        // Debug.Log(PrintLayout());
        Debug.Log("...........");

        foreach (Vector2 slotPosition in item.itemSlots)
        {
            if (!(IsSlotFree(new Vector2(slotPosition.x + x, slotPosition.y + y))))
            {
                return(false);
            }
        }

        foreach (Vector2 slotPosition in item.itemSlots)
        {
            GetSlotAt(x + (int)slotPosition.x, y + (int)slotPosition.y).Take();
        }

        Debug.Log("After Adding:");
        // Debug.Log(PrintLayout());

        item.transform.SetParent(transform.parent);
        item.transform.localPosition
            = GetSlotAt(x, y).transform.localPosition;

        return(true);
    }
Exemple #17
0
    public void Show(InventoryItem it, InventoryItemUI itUI, bool isleft = true)
    {
        this.it   = it;
        this.itUI = itUI;
        gameObject.SetActive(true);
        Vector3 pos = transform.localPosition;

        this.isLeft = isleft;
        if (isleft)
        {
            transform.localPosition = new Vector3(-Mathf.Abs(pos.x), pos.y, pos.z);
            buttonnameLbel.text     = "装备";
            upgradeBtn.isEnabled    = false;
        }
        else
        {
            transform.localPosition = new Vector3(Mathf.Abs(pos.x), pos.y, pos.z);
            buttonnameLbel.text     = "卸下";
            upgradeBtn.isEnabled    = true;
        }
        icon.spriteName   = it.Inventory.Icon;
        nameLabel.text    = it.Inventory.Name;
        qualityLabel.text = it.Inventory.Quality.ToString();
        lifeLabel.text    = it.Inventory.HP.ToString();
        damageLabel.text  = it.Inventory.Damage.ToString();
        powerLabel.text   = it.Inventory.Power.ToString();
        desLabel.text     = it.Inventory.Des.ToString();
        levelLabel.text   = it.Level.ToString();
    }
Exemple #18
0
 public void CloseButtonClick()
 {
     this.it   = null;
     this.itUI = null;
     this.gameObject.SetActive(false);
     InventoryUI.GetInstance.OnDisableButton();
 }
Exemple #19
0
    public void Show(InventoryItem it, InventoryItemUI itUI, KnapsackRoleEquip roleEquip, bool isLeft = true)
    {
        gameObject.SetActive(true);
        this.it        = it;
        this.itUI      = itUI;
        this.roleEquip = roleEquip;
        Vector3 pos = transform.localPosition;

        this.isLeft = isLeft;
        if (isLeft)
        {
            transform.localPosition = new Vector3(-Mathf.Abs(pos.x), pos.y, pos.z);
            btnLabel.text           = "装备";
        }
        else
        {
            transform.localPosition = new Vector3(Mathf.Abs(pos.x), pos.y, pos.z);
            btnLabel.text           = "卸下";
        }
        equipSprite.spriteName = it.Inventory.ICON;
        nameLabel.text         = it.Inventory.Name;
        qualityLabel.text      = it.Inventory.Quality.ToString();
        damageLabel.text       = it.Inventory.Damage.ToString();
        hpLabel.text           = it.Inventory.HP.ToString();
        powerLabel.text        = it.Inventory.Power.ToString();
        desLabel.text          = it.Inventory.Des;
        levelLabel.text        = it.Level.ToString();
    }
Exemple #20
0
    /// <summary>
    /// 点击卸下按钮和装备按钮是触发
    /// </summary>
    public void OnEquipClick()
    {
        int startValue = PlayerInfo._instance.GetAllPower();

        //左边v表示从背包里面点击 ---装备
        if (this.isLeft)
        {
            //清空背包ui的item
            this.itUI.Clear();
            PlayerInfo._instance.DressOn(this.item);
        }//右边表示从role中点击装备 ---卸下
        else
        {
            this.itRole.Clear();
            PlayerInfo._instance.DressOff(this.item);
        }
        this.item = null;
        this.itUI = null;
        gameObject.SetActive(false);
        int endValue = PlayerInfo._instance.GetAllPower();

        //PlayerInfo._instance.PowerNum = endValue;
        PowerShow.instance.ShowPowerChange(startValue, endValue);

        InventoryUI._instance.SendMessage("UpdateCount");// to inventoryUi  更新格子个数-1
        transform.parent.SendMessage("DisBtn");
    }
Exemple #21
0
    public void OnInventoryClick(object[] objectArray)
    {
        InventoryItem it     = objectArray[0] as InventoryItem;
        bool          isleft = (bool)objectArray[1];

        if (it.Inventory.InventoryType == InventoryType.Equip || it.Inventory.InventoryType == InventoryType.Pet || it.Inventory.InventoryType == InventoryType.PetEquip)
        {
            InventoryItemUI   itUI      = null;
            KnapsackRoleEquip roleEquip = null;
            if (isleft == true)
            {
                itUI = objectArray[2] as InventoryItemUI;
            }
            else
            {
                roleEquip = objectArray[2] as KnapsackRoleEquip;
            }
            inventory.CloseOn();
            equip.Show(it, itUI, roleEquip, isleft);
        }
        else
        {
            InventoryItemUI itUI = objectArray[2] as InventoryItemUI;
            equip.closeon();
            inventory.Show(it, itUI);
        }
        if ((it.Inventory.InventoryType == InventoryType.Equip && isleft == true) || it.Inventory.InventoryType != InventoryType.Equip)
        {
            this.itUI = objectArray[2] as InventoryItemUI;
            EnableButton();
            pricesale.text = (this.itUI.it.Inventory.Price * this.itUI.it.Count).ToString();
        }
    }
    public void OnDrop(BaseEventData data)
    {
        InventoryItemUI droppedItemUI = inventoryUI.GetDraggedInventoryItem();
        InventoryItem   droppedItem   = droppedItemUI.GetItem();

        SetItem(droppedItem);
    }
Exemple #23
0
    public void ShowEquipInfoUI(InventoryItem it, InventoryItemUI itemUI, KnapStackRoleEquip kSRE, bool isLeft = true)
    {
        this.gameObject.SetActive(true);
        this.it   = it;
        this.itUI = itemUI;
        this.kSRE = kSRE;
        Vector3 pos = this.transform.localPosition;

        equipName.text         = it.inventory.Name;
        quality.text           = it.inventory.Quality.ToString();
        damage.text            = it.inventory.Damge.ToString();
        hP.text                = it.inventory.HP.ToString();
        startLevel.text        = it.Level.ToString();
        power.text             = it.inventory.Power.ToString();
        des.text               = it.inventory.Des;
        equipSprite.spriteName = it.inventory.IconName;

        if (isLeft)
        {
            equipLabel.text = "装备";
            this.transform.localPosition = new Vector3(-Mathf.Abs(30), pos.y, pos.z);
            edEquip.Set(this, "EquipButtonClick");
        }
        else
        {
            equipLabel.text = "卸下";
            edEquip.Set(this, "EquipPutOff");
            this.transform.localPosition = new Vector3(Mathf.Abs(220), pos.y, pos.z);
        }

        equipButton.onClick.Add(edEquip);
    }
Exemple #24
0
	public void OnInventoryClick(object[] objectArray)
	{
		InventoryItem it = objectArray[0] as InventoryItem;
		bool isLeft = (bool)objectArray[1];

		if(it.Inventory.InventoryType == InventoryType.Equip)
		{
			InventoryItemUI itUI = null;
			KnapsackRoleEquip roleEquip = null;
			if(isLeft == true)
			{
				 itUI = objectArray[2] as InventoryItemUI;
			}
			else
			{
				roleEquip = objectArray[2] as KnapsackRoleEquip;
			}
            inventoryPopup.Close();
			equipPopup.Show(it,itUI,roleEquip,isLeft);
		}
		else
		{
		    InventoryItemUI itUI = objectArray[2] as InventoryItemUI;
            equipPopup.Close();
			inventoryPopup.Show(it, itUI);
		}

	    if ((it.Inventory.InventoryType == InventoryType.Equip && isLeft == true) ||
	        it.Inventory.InventoryType != InventoryType.Equip)
	    {
            this.itUI = objectArray[2] as InventoryItemUI;
	        EnableButton();
	        priceLabel.text = (itUI.it.Inventory.Price * this.itUI.it.Count).ToString();
	    }
	}
Exemple #25
0
 public void onClose()
 {
     it   = null;
     itUI = null;
     this.gameObject.SetActive(false);
     Knaspack._intance.disableSellBtn();
 }
Exemple #26
0
 public void Show(InventoryItem it,InventoryItemUI itUI,bool isleft=true)
 {
     this.it = it;
     this.itUI = itUI;
     gameObject.SetActive(true);
     Vector3 pos = transform.localPosition;
     this.isLeft = isleft;
     if(isleft)
     {
         transform.localPosition = new Vector3(-Mathf.Abs(pos.x),pos.y,pos.z);
         buttonnameLbel.text = "装备";
         upgradeBtn.isEnabled = false;
     }
     else
     {
         transform.localPosition = new Vector3(Mathf.Abs(pos.x), pos.y, pos.z);
         buttonnameLbel.text = "卸下";
         upgradeBtn.isEnabled = true;
     }
     icon.spriteName = it.Inventory.Icon;
     nameLabel.text = it.Inventory.Name;
     qualityLabel.text = it.Inventory.Quality.ToString();
     lifeLabel.text = it.Inventory.HP.ToString();
     damageLabel.text = it.Inventory.Damage.ToString();
     powerLabel.text = it.Inventory.Power.ToString();
     desLabel.text = it.Inventory.Des.ToString();
     levelLabel.text = it.Level.ToString();
 }
Exemple #27
0
    /// <summary>
    /// Creates UI item, plays its "get" animation and adds it to list of active UI items
    /// </summary>
    /// <param name="key">Item to create a UI item from</param>
    public void AddItem(InteractableItemKey key)
    {
        // If slot already exists, make that item fill the slot
        foreach (InventoryItemUI slotItem in slotItems)
        {
            if (slotItem.itemKey == key)
            {
                slotItem.PlayItemGetAnimation();
                activeItems.Add(slotItem);
                slotItems.Remove(slotItem);
                return;
            }
        }

        // else create new item and immediately fill the slot
        GameObject      item   = Instantiate(itemPrefab, itemParent);
        InventoryItemUI itemUI = item.GetComponent <InventoryItemUI>();

        if (itemUI == null)
        {
            Debug.LogError("Item prefab in InventoryUI does not have a InventoryItemUI component");
            Destroy(item);
        }
        else
        {
            itemUI.Init(key);
            itemUI.PlayItemGetAnimation();
            activeItems.Add(itemUI);
        }
    }
    public void Show(InventoryItem it, InventoryItemUI itUI, KnapsackRoleEquip roleEquip, bool isleft = true)     //物品的显示
    {
        gameObject.SetActive(true);
        this.it        = it;
        this.itUI      = itUI;
        this.roleEquip = roleEquip;
        this.isleft    = isleft;
        Vector3 pos = transform.localPosition;

        if (isleft)
        {
            transform.localPosition = new Vector3(-370, 9, pos.z);
            btntxt.text             = "装备";
        }
        else
        {
            transform.localPosition = new Vector3(380, 9, pos.z);
            btntxt.text             = "卸下";
        }

        equipimg.sprite  = it.Inventory.Icon;
        equipText.text   = it.Inventory.Name;
        qualityText.text = it.Inventory.Quality.ToString();
        damageText.text  = it.Inventory.Damage.ToString();
        hpText.text      = it.Inventory.Hp.ToString();
        powerText.text   = it.Inventory.Power.ToString();
        desText.text     = it.Inventory.Des;
        levelText.text   = it.Level.ToString();
    }
Exemple #29
0
    public void OnEquipClick(object[] objectArray)
    {
        InventoryItem it     = (InventoryItem)objectArray[0];
        bool          isLeft = (bool)objectArray[1];


        if (it.Inventory.Inventorytype == InventoryType.Euqip)
        {
            InventoryItemUI   itUI      = null;
            KnapsackRoleEquip roleEquip = null;
            if (isLeft == true)
            {
                itUI = objectArray[2] as InventoryItemUI;
            }
            else
            {
                roleEquip = objectArray[2] as KnapsackRoleEquip;
            }



            equipPopup.Show(it, itUI, roleEquip, isLeft);
        }
        else
        {
            _inventoryPopup.Show(it);
        }
    }
Exemple #30
0
	public void Show(InventoryItem it,InventoryItemUI itUI,KnapsackRoleEquip roleEquip ,bool isLeft = true)
	{
		gameObject.SetActive(true);
		this.it = it;
		this.itUI = itUI;
		this.roleEquip = roleEquip;
		Vector3 pos = transform.localPosition;
		this.isLeft = isLeft;
		if(isLeft)
		{
			transform.localPosition = new Vector3(-Mathf.Abs(pos.x),pos.y,pos.z);
			btnLabel.text = "装备";
		}
		else
		{
			transform.localPosition = new Vector3(Mathf.Abs(pos.x),pos.y,pos.z);
			btnLabel.text = "卸下";
		}
		equipSprite.spriteName = it.Inventory.Icon;
		nameLabel.text = it.Inventory.Name;
		qualityLabel.text = it.Inventory.Quqlity.ToString();
		damageLabel.text = it.Inventory.Damage.ToString();
		hpLabel.text = it.Inventory.HP.ToString();
		powerLabel.text = it.Inventory.Power.ToString();
		desLabel.text = it.Inventory.Des;
		levelLabel.text = it.Level.ToString();
	}
Exemple #31
0
    public void OnInventoryClick(object[] objArr)
    {
        InventoryItem it     = objArr [0] as InventoryItem;
        bool          isLeft = (bool)objArr [1];

        if (it._Item._InventoryType == InventoryType.Equip)
        {
            InventoryItemUI itUI = null;
            BagRoleEquip    bre  = null;
            if (isLeft == true)
            {
                itUI = objArr [2] as InventoryItemUI;
            }
            else
            {
                bre = objArr[2] as BagRoleEquip;
            }
            inventoryPopup.Close();
            equipPopup.Show(it, itUI, bre, isLeft);
        }
        else
        {
            InventoryItemUI itUI = objArr[2] as InventoryItemUI;
            equipPopup.Close();
            inventoryPopup.Show(it, itUI);
        }
        if ((it._Item._InventoryType == InventoryType.Equip && isLeft == true) || it._Item._InventoryType != InventoryType.Equip)
        {
            this.it = it;
            EnableBtn();
        }
    }
Exemple #32
0
    public void Show(InventoryItem it, InventoryItemUI itUi, KnapsackRoleEquip itRole, bool isLeft = true) //show将点击的inventoryUI传进来
    {
        gameObject.SetActive(true);
        this.item   = it;   //被点击的itui传给界面自己的item
        this.itUI   = itUi;
        this.isLeft = isLeft;
        this.itRole = itRole;
        Vector3 pos = transform.localPosition;

        if (isLeft)
        {
            transform.localPosition = new Vector3(-355.0f, pos.y, pos.z);
            btnLabel.text           = "装备";
        }
        else
        {
            transform.localPosition = new Vector3(3.0f, pos.y, pos.z);
            btnLabel.text           = "卸下";
        }
        equipSprite.spriteName = item.inventory.ICON;
        nameLabel.text         = item.inventory.Name;
        qualityLabel.text      = item.inventory.Quality.ToString();
        damageLabel.text       = item.inventory.Damage.ToString();
        hpLabel.text           = item.inventory.HP.ToString();
        powerLabel.text        = item.inventory.Power.ToString();
        desLabel.text          = item.inventory.Des;
        levelLabel.text        = item.Level.ToString();
    }
Exemple #33
0
 public void OnEnableButton(InventoryItemUI itUI)
 {
     this.itUI = itUI;
     sellButton.SetState(UIButtonColor.State.Normal, true);
     sellButton.GetComponent <BoxCollider>().enabled = true;
     sellButton.GetComponent <UIPlaySound>().enabled = true;
     priceLabel.text = (itUI.it.Count * itUI.it.inventory.Price).ToString();
 }
 public void On_InventoryPopup_Close_Click()
 {
     it = null;
     itUI = null;
     nameLabel.text = "";
     desLabel.text = "";
     transform.parent.parent.SendMessage("DisenableButton");
     gameObject.SetActive(false);
 }
 public void Show(InventoryItem it,InventoryItemUI itUI)
 {
     this.it = it;
     this.itUI = itUI;
     gameObject.SetActive(true);
     nameLabel.text = it.Inventory.Name;
     desLabel.text = it.Inventory.Des;
     iconSprite.spriteName = it.Inventory.Icon;
 }
Exemple #36
0
 public void Show(InventoryItem it, InventoryItemUI itUI)
 {
     this.gameObject.SetActive(true);
     this.it             = it;
     this.itUI           = itUI;
     _name.text          = it._Item._Name;
     pic_item.spriteName = it._Item._Headpic;
     describe.text       = it._Item._Describe;
 }
Exemple #37
0
	public void Show(InventoryItem it ,InventoryItemUI itUI)
	{
		this.gameObject.SetActive(true);
	    this.it = it;
	    this.itUI = itUI;
		nameLabel.text = it.Inventory.Name;
		inventorySprite.spriteName = it.Inventory.Icon;
		desLabel.text = it.Inventory.Des;
		btnLabel.text = "批量使用("+it.Count +")";
	}
	void ClearObject()
	{
		it = null;
		itUI = null;
		roleEquip = null;
	}
Exemple #39
0
 void ClearObject()
 {
     it=null;
     itUI = null;
 }
Exemple #40
0
    private void Clear()
    {
		this.it = null;
	    this.itUI = null;
    }