void OnApplicationPause(bool pause)
 {
     if (!pause && JCloudManager.PlatformIsCloudCompatible())
     {
         JCloudExtern.ResetUbiquityStatus();
     }
 }
 void OnApplicationFocus(bool focus)
 {
     if (focus && JCloudManager.PlatformIsCloudCompatible())
     {
         JCloudExtern.ResetUbiquityStatus();
     }
 }
Example #3
0
    public static bool PollCloudDataAvailability()
    {
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            return(JCloudExtern.GetUbiquitousStoreAvailability());
        }
        else
#endif
        return(false);
    }
Example #4
0
    public static void Save()
    {
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            JCloudExtern.CloudDataSave();
        }
        else
#endif
        PlayerPrefs.Save();
    }
Example #5
0
    public static bool HasKey(string key)
    {
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            return(JCloudExtern.CloudDataHasKey(key));
        }
        else
#endif
        return(PlayerPrefs.HasKey(key));
    }
Example #6
0
    public static void SetFloat(string key, float value)
    {
        // Set float
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            JCloudExtern.CloudDataSetFloat(key, value);
        }
        else
#endif
        PlayerPrefs.SetFloat(key, value);
    }
	public static void CheckManagerStatus() {
			if (sharedManager == null) {
				// Actually we recheck the null status inside the lock, so if it's not null we avoided the lock
				lock (checkLock) {
					if (sharedManager == null) {
						GameObject sharedManagerObject = new GameObject("JCloudManager", typeof(JCloudManager)) as GameObject;
						sharedManager = sharedManagerObject.GetComponent<JCloudManager>();
						DontDestroyOnLoad(sharedManagerObject);
					}
				}
			}
	}
Example #8
0
    public static int GetInt(string key, int defaultValue)
    {
        // Get int, if key doesn't exist, value will keep the defaultValue
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            int value = defaultValue;
            JCloudExtern.CloudDataGetInt(key, ref value);
            return(value);
        }
        else
#endif
        return(PlayerPrefs.GetInt(key, defaultValue));
    }
 public static void CheckManagerStatus()
 {
     if (sharedManager == null)
     {
         // Actually we recheck the null status inside the lock, so if it's not null we avoided the lock
         lock (checkLock) {
             if (sharedManager == null)
             {
                 GameObject sharedManagerObject = new GameObject("JCloudManager", typeof(JCloudManager)) as GameObject;
                 sharedManager = sharedManagerObject.GetComponent <JCloudManager>();
                 DontDestroyOnLoad(sharedManagerObject);
             }
         }
     }
 }
Example #10
0
    public static string GetString(string key, string defaultValue)
    {
        // Get string, if key doesn't exist, value will keep the defaultValue
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            string        value = defaultValue;
            System.IntPtr valuePtr;
            if (JCloudExtern.CloudDataGetString(key, out valuePtr))
            {
                value = Marshal.PtrToStringAnsi(valuePtr);
                JCloudExtern.FreeMemory(valuePtr);
            }

            return(value);
        }
        else
#endif
        return(PlayerPrefs.GetString(key, defaultValue));
    }
Example #11
0
    public static bool UnregisterCloudDataExternalChanges(Component componentOrGameObject)
    {
#if !UNITY_EDITOR && ((UNITY_IPHONE && JCLOUDPLUGIN_IOS) || (UNITY_STANDALONE_OSX && JCLOUDPLUGIN_OSX))
        if (JCloudManager.PlatformIsCloudCompatible() && (AcceptJailbrokenDevices || JCloudExtern.IsJailbroken() == false))
        {
            // Failsafe
            if (componentOrGameObject == null)
            {
                return(false);
            }

            // Check manager status
            JCloudManager.CheckManagerStatus();

            // Remove
            JCloudManager.RemoveKeyValueStoreRegisteredComponent(componentOrGameObject);

            return(true);
        }
#endif

        return(false);
    }