public void OnBeginDrag(PointerEventData eventData) { ShopManager.Instance.scroll.OnBeginDrag(eventData); item = GameManager.Instance.dataShop.dataItemShop[index]; target = Camera.main.ScreenToWorldPoint(Input.mousePosition); y = target.y; checkDrag = PlayerPrefs.GetInt("levelsd" + index) <= PlayerPrefs.GetInt("level") && (int.Parse(number.text) < int.Parse(numberMax.text) || idLoai == 5); if (checkDrag) { spr = ShopManager.Instance.spriteDrag; spr.transform.position = target; spr.sprite = item.icon; transform.GetChild(1).gameObject.SetActive(false); } if (GameManager.Instance.guide) { if (index == 0 && Guide.Instance.step > 3) { checkDrag = false; transform.GetChild(1).gameObject.SetActive(true); } } }
public void updateLenLevel() { item = GameManager.Instance.dataShop.dataItemShop[index]; if (idLoai != 5 && PlayerPrefs.GetInt("level") >= (item.plusLevel + PlayerPrefs.GetInt("levelsd" + index))) { PlayerPrefs.SetInt("slmax" + index, PlayerPrefs.GetInt("slmax" + index) + item.plusMaxsl); PlayerPrefs.SetInt("levelsd" + index, PlayerPrefs.GetInt("levelsd" + index) + item.plusLevel); numberMax.text = PlayerPrefs.GetInt("slmax" + index).ToString(); } if (PlayerPrefs.GetInt("level") >= PlayerPrefs.GetInt("levelsd" + index)) { if (idLoai != 5) { btnNumber.gameObject.SetActive(true); number.text = PlayerPrefs.GetInt("slkeo" + index).ToString(); numberMax.text = PlayerPrefs.GetInt("slmax" + index).ToString(); } switch (idLoai) { case 1: case 0: ShopManager.Instance.openNew(0, true); break; case 2: case 3: case 6: ShopManager.Instance.openNew(1, true); break; case 4: ShopManager.Instance.openNew(2, true); break; case 5: ShopManager.Instance.openNew(3, true); break; } ShopManager.Instance.openNew(ShopManager.Instance.index1, false); ShopManager.Instance.onImgNew(); unlock.SetActive(true); coin.transform.parent.gameObject.SetActive(true); btnLevel.gameObject.SetActive(false); icon.sprite = item.icon; icon.SetNativeSize(); Language.Instance.setNameText(item.nameVi, item.nameEng, nameItemShop); } }