public void SaveGame() { PlayerPrefs.SetInt("save", 1); PlayerPrefs.SetString("now", now.ToString("yyyy/MM/dd HH:mm:ss")); PlayerPrefs.SetString("limitTime", limitTime.ToString("yyyy/MM/dd HH:mm:ss")); PlayerPrefs.SetFloat("fiat", assets); PlayerPrefs.SetString("MainCurrency", mainCurrency.GetName()); PlayerPrefs.SetInt("loanPayment", loanPaymented ? 1 : -1); PlayerPrefs.SetInt("1000man", isAssetsGTsenman ? 1 : -1); PlayerPrefs.SetInt("cleared", cleared ? 1 : -1); foreach (AbstractCurrency currency in currencies) { PlayerPrefs.SetFloat(currency.GetName() + "Assets", currency.GetAssets()); PlayerPrefs.SetInt(currency.GetName() + "Lv", currency.GetLv()); PlayerPrefs.SetString(currency.GetName() + "Prices", currency.ToString()); } }
private void LoadCurrency(AbstractCurrency currency) { currency.SetAssets(PlayerPrefs.GetFloat(currency.GetName() + "Assets")); currency.SetLv(PlayerPrefs.GetInt(currency.GetName() + "Lv")); currency.SetPrices(PlayerPrefs.GetString(currency.GetName() + "Prices")); }
public void ChangeMainCurrency(AbstractCurrency currency) { mainCurrency = currency; Chart.Instance.SetPrices(mainCurrency.GetPrices(), mainCurrency.GetName(), mainCurrency.GetColor()); }
public void AddCurrency(AbstractCurrency currency) { currencies.Add(currency); if (PlayerPrefs.HasKey("save")) { LoadCurrency(currency); } if ((PlayerPrefs.HasKey("MainCurrency") && PlayerPrefs.GetString("MainCurrency") == currency.GetName()) || mainCurrency == null) { ChangeMainCurrency(currency); } }