Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnApplicationPause(bool pauseStatus){
- if (pauseStatus) {
- PlayerPrefs.SetString ("sysString", System.DateTime.Now.ToBinary ().ToString ());
- print ("Saveing this date to prefs " + System.DateTime.Now.ToBinary ().ToString ());
- s = 0;
- m = 0;
- h = 0;
- d = 0;
- totalS = 0;
- } else {
- gps.LoadGPS();
- click.LoadStuff ();
- click.LoadClickCost ();
- click.LoadButtonScript ();
- gems.LoadGems ();
- item.LoadItem ();
- gps.LoadGPS ();
- currentDate = DateTime.Now;
- long temp = Convert.ToInt64(PlayerPrefs.GetString("sysString"));
- DateTime oldDate = DateTime.FromBinary (temp);
- Debug.Log ("Old Date: " + oldDate);
- TimeSpan difference = currentDate.Subtract(oldDate);
- Debug.Log ("Diff: " + difference);
- s = (int)difference.Seconds;
- m = (int)difference.Minutes;
- h = (int)difference.Hours;
- d = (int)difference.Days;
- totalS = (int)difference.TotalSeconds;
- Debug.Log ("Diff2: " + s);
- Debug.Log ("GPS: " + gps.gps);
- Welcome.SetActive (true);
- offlineTime.text = d.ToString() + "d " + h.ToString() + "h " + m.ToString() + "m " + s.ToString() + "s";
- earnedGold.text = "$ " + CurrencyConventer.Instance.GetCurrencyIntoString (Mathf.Round (gps.gps * totalS / offlineDivider), false);
- click.gold = click.gold + gps.gps * totalS / 5;
- Debug.Log ("GPS OFFLINE: " + gps.gps);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement