/// <summary>Initializes the data storage functionality for a given user.</summary> public static void SetActiveUser(int platformUserId, SetActiveUserCallback <int> callback) { UserDataStorage.PLATFORM_IO.SetActiveUser(platformUserId, (id, success) => { if (success) { LocalUser.Load( () => { if (callback != null) { callback.Invoke(id, success); } }); } else { LocalUser.instance = new LocalUser(); Debug.Log("[mod.io] Failed to set active user. LocalUser cleared."); if (callback != null) { callback.Invoke(id, success); } } }); }
// ---------[ Initialization ]--------- /// <summary>Sets the initial Singleton values.</summary> static LocalUser() { LocalUser._instance = new LocalUser(); LocalUser.AssertListsNotNull(ref LocalUser._instance); LocalUser.isLoaded = false; LocalUser.Load(); }
// ---------[ Initialization ]--------- /// <summary>Loads the platform I/O behaviour.</summary> static UserDataStorage() { // Select the platform appropriate functions #if UNITY_EDITOR && !DISABLE_EDITOR_CODEPATH UserDataStorage.PLATFORM_IO = new SystemIOWrapper_Editor(); #elif MODIO_FACEPUNCH_SUPPORT UserDataStorage.PLATFORM_IO = new FacepunchUserDataIO(); #elif MODIO_STEAMWORKSNET_SUPPORT UserDataStorage.PLATFORM_IO = new SteamworksNETUserDataIO(); #else UserDataStorage.PLATFORM_IO = new SystemIOWrapper(); #endif UserDataStorage.PLATFORM_IO.InitializeForDefaultUser((success) => { if (success) { LocalUser.Load(); } }); }