public void exitGameYes() { try { MyAdvertisement.ShowFullNormal(); } catch { } thank.SetActive(true); StartCoroutine(exit()); }
public void tangExp(int expPlus) { PlayerPrefs.SetInt("exp", PlayerPrefs.GetInt("exp") + expPlus); if (PlayerPrefs.GetInt("exp") >= PlayerPrefs.GetInt("expmax")) { DialogController.Instance.closeDialogUI(); try { MyAdvertisement.ShowFullNormal(); } catch { } if (huy) { Destroy(huy); } Language.Instance.onSound(6); GameManager.Instance.cameraOnOff(true); dialogLevelUp.SetActive(true); PlayerPrefs.SetInt("exp", PlayerPrefs.GetInt("exp") - PlayerPrefs.GetInt("expmax")); PlayerPrefs.SetInt("level", PlayerPrefs.GetInt("level") + 1); if (PlayerPrefs.GetInt("level") > 7) { PlayerPrefs.SetInt("expmax", PlayerPrefs.GetInt("expmax") + 30 * PlayerPrefs.GetInt("level")); } else { PlayerPrefs.SetInt("expmax", 15 * PlayerPrefs.GetInt("level")); } level = PlayerPrefs.GetInt("level"); loadItemLevel(); //update lai shop for (int i = 0; i < 43; i++) { contentShop.GetChild(i).GetComponent <ItemShop>().updateLenLevel(); } Oder.Instance.idVatPhamUnlock(); txtLevel.text = level.ToString(); levelUp1.text = txtLevel.text; loadDataCrop(); StorageController.Instance.load(); } exp = PlayerPrefs.GetInt("exp"); expmax = PlayerPrefs.GetInt("expmax"); transform.GetChild(0).GetComponent <Image>().fillAmount = (float)exp / expmax; txtExp.text = exp.ToString(); txtExpMax.text = expmax.ToString(); }
void Awake() { //Application.targetFrameRate = 60; //PlayerPrefs.SetInt("resource" + 0, 10000); //PlayerPrefs.SetInt("resource" + 1, 10000); try { MyAdvertisement.ShowFullNormal(); } catch { } PlayerPrefs.SetInt("move", 0); PlayerPrefs.SetInt("checkDrag", 1); if (!PlayerPrefs.HasKey("scaleX")) { PlayerPrefs.SetInt("scaleX", 1); } if (!PlayerPrefs.HasKey("level")) { PlayerPrefs.SetInt("level", 1); PlayerPrefs.SetInt("expmax", 10); if (tangTien) { PlayerPrefs.SetInt("resource" + 0, 1500000); PlayerPrefs.SetInt("resource" + 1, 1000000); PlayerPrefs.SetInt("ns" + 0, 10); PlayerPrefs.SetInt("ns" + 91, 10); PlayerPrefs.SetInt("ns" + 92, 10); } else { PlayerPrefs.SetInt("resource" + 0, 150); PlayerPrefs.SetInt("resource" + 1, 10); //cho so luong lua PlayerPrefs.SetInt("ns" + 0, 6); PlayerPrefs.SetInt("ns" + 91, 3); PlayerPrefs.SetInt("ns" + 92, 3); } } Instance = this; initArray(); //guide if (PlayerPrefs.GetInt("step") <= 1) { PlayerPrefs.SetInt("levelsd" + 0, 1); PlayerPrefs.SetInt("coinshop" + 0, 10); if (PlayerPrefs.GetInt("step") == 0) { PlayerPrefs.SetInt("slkeo" + 0, 6); PlayerPrefs.SetInt("slmax" + 0, 9); guideField(-8.5f, 2.8f, 0); guideField(-9.35f, 2.4f, 1); guideField(-7.6f, 2.4f, 2); guideField(-8.5f, 2f, 3); guideField(-6.8f, 2, 4); guideField(-7.65f, 1.6f, 5); } } if (PlayerPrefs.GetInt("step") < 20) { guide = true; } else { guide = false; } for (int i = 0; i < 43; i++) { idLoai = dataShop.dataItemShop[i].idType; if (idLoai != 3) { for (int j = 0; j < PlayerPrefs.GetInt("slkeo" + i); j++) { //init doi tuong initOb = Instantiate(dataShop.dataItemShop[i].itemShop, Vector2.zero, Quaternion.identity); initOb.gameObject.name += j; Vector2 pos = new Vector2(PlayerPrefs.GetFloat("posx" + initOb.gameObject.name), PlayerPrefs.GetFloat("posy" + initOb.gameObject.name)); initOb.transform.position = highlightMap.GetCellCenterLocal(highlightMap.WorldToCell(pos)); initOb.GetComponent <MoveObject>().idLoai = dataShop.dataItemShop[i].idType; int col = initOb.GetComponent <MoveObject>().col; int row = initOb.GetComponent <MoveObject>().row; if (PlayerPrefs.GetInt("scaleX" + initOb.gameObject.name) == 1) { setArray(col, row, pos, true); } else { setArray(row, col, pos, true); } setOrder(initOb, dataShop.dataItemShop[i].idType, initOb.transform.GetChild(0).transform.position.y); setParent(idLoai, initOb); } } } }