示例#1
0
 void SaveNetworkUTCTime()
 {
     // DateTime dummy = new DateTime(2016, 7, 8);
     // Get UTC time
     // first check from PlayerPref and compare to current device clock
     // to determine if its necessary to get network time from server
     // we don't want to keep making server connection if its not necessary
     if (PlayerPrefs.GetInt("lastLoginDay") != DateTime.UtcNow.Day /*dummy.Day */ ||
         PlayerPrefs.GetInt("lastLoginMonth") != DateTime.UtcNow.Month /*dummy.Month*/ ||
         PlayerPrefs.GetInt("lastLoginYear") != DateTime.UtcNow.Year /*dummy.Year*/)
     {
         NetworkHandler.GetNetworkUTCTimeAsync(); // save game code path = true
         StartCoroutine(RunOnMainThread());
     }
 }