summaryrefslogtreecommitdiff
path: root/Runtime/Utilities/PlayerPrefs.h
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Utilities/PlayerPrefs.h')
-rw-r--r--Runtime/Utilities/PlayerPrefs.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/Runtime/Utilities/PlayerPrefs.h b/Runtime/Utilities/PlayerPrefs.h
new file mode 100644
index 0000000..fbb693c
--- /dev/null
+++ b/Runtime/Utilities/PlayerPrefs.h
@@ -0,0 +1,65 @@
+#ifndef PLAYERPREFS_H
+#define PLAYERPREFS_H
+
+#include <string>
+#include <vector>
+
+#if UNITY_EDITOR
+class EditorPrefs {
+public:
+
+ static void UseCleanTestPrefs ();
+ static bool SetInt (const std::string& name, int value);
+ static bool SetBool (const std::string& name, bool value);
+ static bool SetString (const std::string& name, const std::string& value);
+ static bool SetFloat (const std::string& name, float value);
+
+ static int GetInt (const std::string& name, int def = 0);
+ static bool GetBool (const std::string& name, bool def = false);
+ static std::string GetString (const std::string& name, const std::string& def = std::string ());
+ static float GetFloat (const std::string& name, float def = 0.0F);
+
+ static bool HasKey (const std::string& name);
+ static void DeleteKey (const std::string& name);
+ static void DeleteAll ();
+
+ static void Sync ();
+};
+#endif
+
+class PlayerPrefs {
+public:
+ typedef std::vector<UInt8> RawData;
+public:
+ static bool SetInt (const std::string& name, int value);
+ static bool SetString (const std::string& name, const std::string& value);
+ static bool SetFloat (const std::string& name, float value);
+
+ static int GetInt (const std::string& name, int def = 0);
+ static std::string GetString (const std::string& name, const std::string& def = std::string ());
+ static float GetFloat (const std::string& name, float def = 0.0F);
+
+ static bool HasKey (const std::string& name);
+ static void DeleteKey (const std::string& name);
+ static void DeleteAll ();
+
+ #if UNITY_WII_API && (UNITY_WIN || UNITY_WII)
+ static bool GetRawData(RawData& rawData);
+ static bool SetRawData(const RawData& rawData);
+ #endif
+
+ static void Sync ();
+ #if UNITY_METRO
+ static void Init();
+ #elif WEBPLUG
+ static void Init (const std::string& playerURL);
+ #endif
+ #if UNITY_LINUX
+ static std::string GetPath ();
+ #endif
+
+ static void StaticInitialize();
+ static void StaticDestroy();
+};
+
+#endif