private void LoadDailyRewardModel() { SaveDailyReward saveDailyReward = LoadDailyReward(); //this._bLoadDailySucess = true; if (saveDailyReward == null) { CheckDailyReward.GetInstance().UpdateFirstPlay(); int coin = CheckDailyReward.GetInstance().GetCoin(); int indexDay = CheckDailyReward.GetInstance().DailyRewardModel.IndexDay; ////////oogleAnalyticsV4.getInstance().LogEvent("Daily Reward", "Daily Reward " + indexDay.ToString(), string.Empty, 0L); DailyRewarDialog dialog = GameManager.Instance.OnShowDialog <DailyRewarDialog>("DailyAward"); dialog.ParseData(coin, indexDay); this.AddDiamond(coin); //this._panelDailyReward.Show(indexDay, coin); //int num = PlayerPrefs.GetInt(Constant.UserCoin); //num += coin; //PlayerPrefs.SetInt(Constant.UserCoin, num); SaveDailyRewardModel(CheckDailyReward.GetInstance().DailyRewardModel); } else { CheckDailyReward.GetInstance().DailyRewardModel = saveDailyReward; this.ProcessDailyReward(); } }
public static CheckDailyReward GetInstance() { if (CheckDailyReward._instance == null) { CheckDailyReward._instance = new CheckDailyReward(); } return(CheckDailyReward._instance); }
private void ProcessDailyReward() { if (CheckDailyReward.GetInstance().Check()) { int coin = CheckDailyReward.GetInstance().GetCoin(); int indexDay = CheckDailyReward.GetInstance().DailyRewardModel.IndexDay; DailyRewarDialog dialog = GameManager.Instance.OnShowDialog <DailyRewarDialog>("DailyAward"); dialog.ParseData(coin, indexDay); this.AddDiamond(coin); SaveDailyRewardModel(CheckDailyReward.GetInstance().DailyRewardModel); } }
// Save - load function public void LoadProfile() { // Init for first play this.diamond = 0; this.ads = true; this.highScore = 0; // Init for second, third, ... play if (PlayerPrefs.HasKey(KEY_DIAMOND)) { this.highScore = PlayerPrefs.GetInt(KEY_HIGH_SCORE); } if (PlayerPrefs.HasKey(KEY_DIAMOND)) { this.diamond = PlayerPrefs.GetInt(KEY_DIAMOND); } if (PlayerPrefs.HasKey(KEY_ADS)) { this.ads = PlayerPrefs.GetInt(KEY_ADS) == 1 ? true : false; } CheckDailyReward.GetInstance().DailyRewardModel = this.LoadDailyReward(); }