Esempio n. 1
0
        // ---------[ Initialization ]---------
        /// <summary>Sets the initial Singleton values.</summary>
        static LocalUser()
        {
            LocalUser._instance = new LocalUser();
            LocalUser.AssertListsNotNull(ref LocalUser._instance);
            LocalUser.isLoaded = false;

            LocalUser.Load();
        }
Esempio n. 2
0
        // ---------[ Data I/O ]---------
        /// <summary>Loads the LocalUser instance.</summary>
        public static void Load(System.Action callback = null)
        {
            LocalUser.isLoaded = false;

            UserDataStorage.ReadJSONFile <LocalUser>(LocalUser.FILENAME, (path, success, fileData) =>
            {
                LocalUser.AssertListsNotNull(ref fileData);

                LocalUser._instance = fileData;
                LocalUser.isLoaded  = success;

                if (callback != null)
                {
                    callback.Invoke();
                }
            });
        }
Esempio n. 3
0
        // ---------[ Data I/O ]---------
        /// <summary>Loads the LocalUser instance.</summary>
        public static void Load(System.Action callback = null)
        {
            Debug.Assert(UserDataStorage.isInitialized,
                         "[mod.io] UserDataStorage is not yet intialized. Please call"
                         + " UserDataStorage.InitializeForUser() before attempting to"
                         + " load the LocalUser from disk.");

            LocalUser.isLoaded = false;

            UserDataStorage.TryReadJSONFile <LocalUser>(LocalUser.FILENAME, (success, fileData) =>
            {
                LocalUser.AssertListsNotNull(ref fileData);

                LocalUser._instance = fileData;
                LocalUser.isLoaded  = success;

                if (callback != null)
                {
                    callback.Invoke();
                }
            });
        }