public void OnInvButtonClicked() { inTheMain = false; MyStoreInvScript = inventory.GetComponent <inventoryInStore> (); if (MyStoreInvScript == null) { inTheMain = true; MyMainInvScript = inventory.GetComponent <Inventory> (); } if (!inventoryPanel.activeSelf) { inventoryPanel.SetActive(true); SkillTouch1.GetComponent <Image>().raycastTarget = false; SkillTouch2.GetComponent <Image>().raycastTarget = false; SkillTouch3.GetComponent <Image>().raycastTarget = false; } else { inventoryPanel.SetActive(false); SkillTouch1.GetComponent <Image>().raycastTarget = true; SkillTouch2.GetComponent <Image>().raycastTarget = true; SkillTouch3.GetComponent <Image>().raycastTarget = true; if (inTheMain) { MyMainInvScript.save(); } else { MyStoreInvScript.save(); } } }
public void OnSellId1() { Coin.Play(); int cost = 3; MyInvScript.items [WhichSlot] = new Item(); if (transform.parent.childCount == 2) { Destroy(transform.parent.GetChild(0).gameObject); } MyInvScript.save(); //droppedItem.slot = id; PlayerDB.DB.gold += cost; }