Lastest P31Prefs class
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Prime31;
#if UNITY_IPHONE
public class P31Prefs
{
public static bool iCloudDocumentStoreAvailable { get { return _iCloudDocumentStoreAvailable; } }
private static bool _iCloudDocumentStoreAvailable;
static P31Prefs()
{
_iCloudDocumentStoreAvailable = iCloudBinding.documentStoreAvailable();
}
public static bool synchronize()
{
PlayerPrefs.Save();
return iCloudBinding.synchronize();
}
public static bool hasKey( string key )
{
return iCloudBinding.hasKey( key );
}
public static List<object> allKeys()
{
return iCloudBinding.allKeys();
}
public static void removeObjectForKey( string key )
{
iCloudBinding.removeObjectForKey( key );
PlayerPrefs.DeleteKey( key );
}
public static void removeAll()
{
iCloudBinding.removeAll();
PlayerPrefs.DeleteAll();
}
public static void setInt( string key, int val )
{
iCloudBinding.setInt( val, key );
PlayerPrefs.SetInt( key, val );
}
public static int getInt( string key )
{
return iCloudBinding.intForKey( key );
}
public static void setFloat( string key, float val )
{
iCloudBinding.setDouble( val, key );
PlayerPrefs.SetFloat( key, val );
}
public static float getFloat( string key )
{
return iCloudBinding.doubleForKey( key );
}
public static void setString( string key, string val )
{
iCloudBinding.setString( val, key );
PlayerPrefs.SetString( key, val );
}
public static string getString( string key )
{
return iCloudBinding.stringForKey( key );
}
public static void setBool( string key, bool val )
{
iCloudBinding.setBool( val, key );
PlayerPrefs.SetInt( key, val ? 1 : 0 );
}
public static bool getBool( string key )
{
return iCloudBinding.boolForKey( key );
}
public static void setDictionary( string key, Hashtable val )
{
var json = Prime31.Json.jsonEncode( val );
iCloudBinding.setDictionary( json, key );
PlayerPrefs.SetString( key, json );
}
public static IDictionary getDictionary( string key )
{
return iCloudBinding.dictionaryForKey( key );
}
}
#endif