Example #1
0
        // Load single data
        public T TryLoad <T>(string key, T defaultValue = default(T), bool isLocal = false)
        {
            ES3File targetFile = null;

            if (!isLocal)
            {
                targetFile = file;
            }
            else
            {
                targetFile = localFile;
            }

            if (targetFile == null)
            {
                return(defaultValue);
            }
            if (!targetFile.KeyExists(key))
            {
                return(defaultValue);
            }

            try
            {
                return(targetFile.Load <T>(key, defaultValue));
            }
            catch (System.Exception e)
            {
                UnityEngine.Debug.LogException(e);
                return(defaultValue);
            }
        }
Example #2
0
        public bool IsSaveKeyExist(string key, bool isLocal = false)
        {
            ES3File targetFile = null;

            if (!isLocal)
            {
                targetFile = file;
            }
            else
            {
                targetFile = localFile;
            }

            if (targetFile == null)
            {
                return(false);
            }

            bool result = targetFile.KeyExists(key);

            return(result);
        }