Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 KB | None | 0 0
  1. void OnApplicationPause(bool pauseStatus){
  2.         if (pauseStatus) {
  3.             PlayerPrefs.SetString ("sysString", System.DateTime.Now.ToBinary ().ToString ());
  4.  
  5.             print ("Saveing this date to prefs " + System.DateTime.Now.ToBinary ().ToString ());
  6.  
  7.             s = 0;
  8.             m = 0;
  9.             h = 0;
  10.             d = 0;
  11.             totalS = 0;
  12.         } else {
  13.             gps.LoadGPS();
  14.             click.LoadStuff ();
  15.             click.LoadClickCost ();
  16.             click.LoadButtonScript ();
  17.             gems.LoadGems ();
  18.             item.LoadItem ();
  19.             gps.LoadGPS ();
  20.             currentDate = DateTime.Now;
  21.             long temp = Convert.ToInt64(PlayerPrefs.GetString("sysString"));
  22.             DateTime oldDate = DateTime.FromBinary (temp);
  23.             Debug.Log ("Old Date: " + oldDate);
  24.             TimeSpan difference = currentDate.Subtract(oldDate);
  25.             Debug.Log ("Diff: " + difference);
  26.             s = (int)difference.Seconds;
  27.             m = (int)difference.Minutes;
  28.             h = (int)difference.Hours;
  29.             d = (int)difference.Days;
  30.             totalS = (int)difference.TotalSeconds;
  31.  
  32.             Debug.Log ("Diff2: " + s);
  33.             Debug.Log ("GPS: " + gps.gps);
  34.  
  35.             Welcome.SetActive (true);
  36.  
  37.             offlineTime.text = d.ToString() + "d " + h.ToString() + "h " + m.ToString() + "m " + s.ToString() + "s";
  38.             earnedGold.text = "$ " + CurrencyConventer.Instance.GetCurrencyIntoString (Mathf.Round (gps.gps * totalS / offlineDivider),         false);
  39.  
  40.             click.gold = click.gold + gps.gps * totalS / 5;
  41.  
  42.             Debug.Log ("GPS OFFLINE: " + gps.gps);
  43.         }
  44.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement