public void BuyMag() { if ((GetMagicNow < MgcPossId.Count) && (GetMagicNow >= 0)) { string MagicListGet = PlayerPrefs.GetString("Magic", "0 7"); MagicListGet += " " + MgcPossId[GetMagicNow].ToString(); PlayerPrefs.SetString("Magic", MagicListGet); int PointBuy = System.Int32.Parse((AllPointTxt.text)); int pointNow = PointBuy - MagicPrice(MgcPossId[GetMagicNow]); PlayerPrefs.SetInt("Point", pointNow); MgcPossId.RemoveAt(GetMagicNow); if (MgcPossId.Count != GetMagicNow) { GetMagNext(); } else if (GetMagicNow != 0) { GetMagPref(); } else { BtnBuyMgc.SetActive(false); BtnNext.SetActive(false); BtnPref.SetActive(false); DescTextPnl.SetActive(false); } AllPointTxt.text = pointNow.ToString(); } }
public void GameOver() { PasueBtn.SetActive(false); Time.timeScale = 0f; if ((GetMagicNow >= MgcPossId.Count) && (MgcPossId.Count == 0)) { BtnBuyMgc.SetActive(false); BtnNext.SetActive(false); BtnPref.SetActive(false); DescTextPnl.SetActive(false); } int GetPoint = PlayerPrefs.GetInt("Point", 0); GetPoint = System.Int32.Parse((ScoreText.text)) + GetPoint; PlayerPrefs.SetInt("Point", GetPoint); GetMagicPanel.SetActive(true); if (MgcPossId.Count != 0) { SetDescriptText(DescMgcNewPnl, MgcPossId[GetMagicNow]); } if (NameGetMag != null) { if (MgcPossId.Count > 0) { NameGetMag.text = MgcList[MgcPossId[0]].name; } } if (GetMagPrice != null) { if (MgcPossId.Count > 0) { GetMagPrice.text = MagicPrice(MgcPossId[0]).ToString(); } } IsCanBuy(); int HighestScore = PlayerPrefs.GetInt("Score", 0); AllPointTxt.text = GetPoint.ToString(); if (Score > HighestScore) { PlayerPrefs.SetInt("Score", Score); } }