public void BuyGoods() { if (!instance.ismybaggoods && instance.ShopBag.itemlist[instance.choseid] != null) { int tempprice = instance.ShopBag.itemlist[instance.choseid].itemprice; int allcoin = instance.playEqBag.coin.itemHeld; if (tempprice <= allcoin) { instance.playEqBag.coin.itemHeld -= tempprice; if (instance.ShopBag.itemlist[instance.choseid].isequip) { InventoryMG.MGAddToBag(instance.ShopBag.itemlist[instance.choseid], 0); chooseBagReflash(2); } else { Debug.Log("Buy Medicines"); InventoryMG.MGAddToBag(instance.ShopBag.itemlist[instance.choseid], 1); // chooseBagReflash(1); InventoryMG.reflashHMPcount(); } instance.goodsinfo.text = ""; instance.ShopBag.itemlist[instance.choseid] = null; chooseBagReflash(0); } else { instance.WarningPanel.SetActive(true); } } }
public void OnPointerDown(PointerEventData eventData) { // Debug.Log(eventData.pointerCurrentRaycast.gameObject.name); if (eventData.pointerCurrentRaycast.gameObject.name == "EqSlot(Clone)") { lastObject = eventData.pointerCurrentRaycast.gameObject.transform.GetChild(0).gameObject; if (eventData.pointerCurrentRaycast.gameObject.GetComponent <EquipSlot>().isEquip) { lastObject.SetActive(true); invoketime = Time.time; } else { lastObject.SetActive(false); } } else if (eventData.pointerCurrentRaycast.gameObject.name == "Removetext") { // Debug.Log(eventData.pointerCurrentRaycast.gameObject.transform.parent.parent); int tempitemid = eventData.pointerCurrentRaycast.gameObject.transform.parent.parent.GetComponent <EquipSlot>().EquipSlotItem.attributeid; EquipMG.PutEquipToBag(eventData.pointerCurrentRaycast.gameObject.transform.parent.parent.GetComponent <EquipSlot>().Eqslotid, tempitemid); InventoryMG.MGAddToBag(eventData.pointerCurrentRaycast.gameObject.transform.parent.parent.GetComponent <EquipSlot>().EquipSlotItem, 0); } else { lastObject.SetActive(false); } }
public void AddItem() { if (thisitem.isequip) { InventoryMG.MGAddToBag(thisitem, 0); } else { InventoryMG.MGAddToBag(thisitem, 1); } }
private void PutToEquipPos(item thisitem, int itemid, int slotid) { //if (itemid == slotid) //{ item RemovedEquip = EquipMG.GetEquipFromBag(thisitem, slotid); if (RemovedEquip != null) { InventoryMG.MGAddToBag(RemovedEquip, 0); } thisitem.itemHeld -= 1; InventoryMG.reflashbag(0); //} }