/// <summary> /// Lấy số Gold hiện tại /// </summary> public int LoadGold() { string gold = ReadWriteFileText.GetStringFromPrefab(Data._Gold); if (gold != "") { return(int.Parse(gold)); } return(0); }
// Use this for initialization void Awake() { string sound = ReadWriteFileText.GetStringFromPrefab(Data._LinkSound); if (sound == "") { _GameControler = FindObjectOfType <GameControler>(); _GameControler._GameState._Music = true; _GameControler._GameState._Sound = true; } else { string[] arrSound = sound.Split('#'); _GameControler._GameState._Music = bool.Parse(arrSound[0]); _GameControler._GameState._Sound = bool.Parse(arrSound[1]); } }
/// <summary> /// Load danh sách súng player /// </summary> public void LoadStatePickPlayer() { string strPick = ReadWriteFileText.GetStringFromPrefab(Data._LinkPic); if (strPick == "") { strPick = "1*1*1*0*1*0*0*0*1*0*0*1*0*0*0*1*0*0"; } string[] arrPick = strPick.Split('*'); string[] arrAmmo = Data._LinkAmmo.Split('*'); _GameControler._ListStatePickPlayer = new Pick[arrPick.Length]; for (int i = 0; i < arrPick.Length; i++) { string state = arrPick[i] == "1" ? "true" : "false"; Pick pic = new Pick(i, int.Parse(arrAmmo[i]), bool.Parse(state)); _GameControler._ListStatePickPlayer[i] = pic; } }
public void btnSound_Click() { if (_GameControler._GameState._Sound) { _GameControler._GameState._Sound = false; } else { _GameControler._GameState._Sound = true; } ReadWriteFileText.SaveStringToPrefab(Data._LinkSound, _GameControler._GameState._Music + "#" + _GameControler._GameState._Sound); if (_GameControler._GameState._Sound) { _ListButton[1].color = Color.white; } else { _ListButton[1].color = Color.grey; } }
public void btnMusic_Click() { if (_GameControler._GameState._Music) { _GameControler._GameState._Music = false; _BgSound.PlayBackground(false); } else { _GameControler._GameState._Music = true; _BgSound.PlayBackground(true); } ReadWriteFileText.SaveStringToPrefab(Data._LinkSound, _GameControler._GameState._Music + "#" + _GameControler._GameState._Sound); if (_GameControler._GameState._Music) { _ListButton[0].color = Color.white; } else { _ListButton[0].color = Color.grey; } }
public void SetPopup(int _Team) { _GameControler = FindObjectOfType <GameControler>(); _UIManager = FindObjectOfType <UIManager>(); if (_Team == 0)//Green thắng { _imgTeam[0].SetActive(true); _imgTeam[1].SetActive(false); if (_GameControler._TypeGame == 0) { _imgMedal[0].SetActive(true); _imgMedal[1].SetActive(true); _imgMedal[2].SetActive(true); //====== int numStar = _GameControler._NumberPlayer; if (numStar > 3) { numStar = 3; } GameObject[] arrPlayer = GameObject.FindGameObjectsWithTag("Player"); int a = _GameControler._NumberPlayer - arrPlayer.Length; numStar -= a; if (numStar < 1) { numStar = 1; } if (numStar == 1) { _imgMedal[0].GetComponent <Image>().sprite = _SpriteMedal[0]; _imgMedal[1].GetComponent <Image>().sprite = _SpriteMedal[1]; _imgMedal[2].GetComponent <Image>().sprite = _SpriteMedal[1]; } else if (numStar == 2) { _imgMedal[0].GetComponent <Image>().sprite = _SpriteMedal[0]; _imgMedal[1].GetComponent <Image>().sprite = _SpriteMedal[0]; _imgMedal[2].GetComponent <Image>().sprite = _SpriteMedal[1]; } else { _imgMedal[0].GetComponent <Image>().sprite = _SpriteMedal[0]; _imgMedal[1].GetComponent <Image>().sprite = _SpriteMedal[0]; _imgMedal[2].GetComponent <Image>().sprite = _SpriteMedal[0]; } //============= ReadWriteFileText.SaveStringToPrefab(Data._Gold, (_GameControler._Gold + numStar) + ""); _GameControler._Gold += numStar; string strPick = "1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1"; if (_GameControler._Gold >= 90) { strPick = "1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1"; } else if (_GameControler._Gold >= 60) { strPick = "1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*0*1"; } else if (_GameControler._Gold >= 45) { strPick = "1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*0*0"; } else if (_GameControler._Gold >= 32) { strPick = "1*1*1*1*1*1*1*1*1*1*1*1*1*1*0*1*0*0"; } else if (_GameControler._Gold >= 24) { strPick = "1*1*1*1*1*1*1*1*1*1*1*1*1*0*0*1*0*0"; } else if (_GameControler._Gold >= 18) { strPick = "1*1*1*1*1*1*1*0*1*1*1*1*1*0*0*1*0*0"; } else if (_GameControler._Gold >= 12) { strPick = "1*1*1*1*1*1*0*0*1*1*1*1*1*0*0*1*0*0"; } else if (_GameControler._Gold >= 7) { strPick = "1*1*1*0*1*1*0*0*1*1*1*1*1*0*0*1*0*0"; } else if (_GameControler._Gold >= 3) { strPick = "1*1*1*0*1*1*0*0*1*0*1*1*1*0*0*1*0*0"; } else if (_GameControler._Gold >= 1) { strPick = "1*1*1*0*1*1*0*0*1*0*1*1*0*0*0*1*0*0"; } else { strPick = "1*1*1*0*1*0*0*0*1*0*0*1*0*0*0*1*0*0"; } ReadWriteFileText.SaveStringToPrefab(Data._LinkPic, strPick); } else { _imgMedal[0].SetActive(false); _imgMedal[1].SetActive(false); _imgMedal[2].SetActive(false); } } else { _imgTeam[0].SetActive(false); _imgTeam[1].SetActive(true); //=========== _imgMedal[0].SetActive(false); _imgMedal[1].SetActive(false); _imgMedal[2].SetActive(false); } //??? if (GameServices.IsInitialized()) { GameServices.ReportScore(_GameControler._Gold, EM_GameServicesConstants.Leaderboard_Medals); } }
/// <summary> /// Thực hiện mở khóa pick /// </summary> public void UnlockPick() { string strPick = "1*1*1*0*1*0*0*0*1*0*0*1*0*0*0*1*0*0"; ReadWriteFileText.SaveStringToPrefab(Data._LinkPic, strPick); }