// When JustCheck is true, importing from google will not download any data, just detect if the Spreadsheet is up-to-date public void Import_Google(bool ForceUpdate, bool justCheck) { if (!ForceUpdate && GoogleUpdateFrequency == eGoogleUpdateFrequency.Never) { return; } if (!I2Utils.IsPlaying()) { return; } #if UNITY_EDITOR if (justCheck && GoogleInEditorCheckFrequency == eGoogleUpdateFrequency.Never) { return; } #endif #if UNITY_EDITOR var updateFrequency = GoogleInEditorCheckFrequency; #else var updateFrequency = GoogleUpdateFrequency; #endif string PlayerPrefName = GetSourcePlayerPrefName(); if (!ForceUpdate && updateFrequency != eGoogleUpdateFrequency.Always) { #if UNITY_EDITOR string sTimeOfLastUpdate = UnityEditor.EditorPrefs.GetString("LastGoogleUpdate_" + PlayerPrefName, ""); #else string sTimeOfLastUpdate = PersistentStorage.GetSetting_String("LastGoogleUpdate_" + PlayerPrefName, ""); #endif DateTime TimeOfLastUpdate; try { if (DateTime.TryParse(sTimeOfLastUpdate, out TimeOfLastUpdate)) { double TimeDifference = (DateTime.Now - TimeOfLastUpdate).TotalDays; switch (updateFrequency) { case eGoogleUpdateFrequency.Daily: if (TimeDifference < 1) { return; } break; case eGoogleUpdateFrequency.Weekly: if (TimeDifference < 8) { return; } break; case eGoogleUpdateFrequency.Monthly: if (TimeDifference < 31) { return; } break; case eGoogleUpdateFrequency.OnlyOnce: return; case eGoogleUpdateFrequency.EveryOtherDay: if (TimeDifference < 2) { return; } break; } } } catch (Exception) { } } #if UNITY_EDITOR UnityEditor.EditorPrefs.SetString("LastGoogleUpdate_" + PlayerPrefName, DateTime.Now.ToString()); #else PersistentStorage.SetSetting_String("LastGoogleUpdate_" + PlayerPrefName, DateTime.Now.ToString()); #endif //--[ Checking google for updated data ]----------------- CoroutineManager.Start(Import_Google_Coroutine(justCheck)); }