Пример #1
0
        /// <summary>
        /// Begin loading the asset folder
        /// </summary>
        /// <returns></returns>
        public static EAssetDatabase Load()
        {
            ELogger.Log(ELogger.LogType.Log, ELoggerTag.Initialize, "Asset start loading...");

            // Check project folder structure exist
            foreach (var i in FolderStructure.All)
            {
                if (!Directory.Exists(i))
                {
                    _lastLoadResult = new LoadingResult()
                    {
                        flag = LoadingResultFlag.FolderNotExist, message = "Missing " + i + " folder in the project root"
                    };
                    ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, _lastLoadResult.message);
                    return(null);
                }
            }
            EAssetDatabase buffer = new EAssetDatabase();

            _lastLoadResult = new LoadingResult()
            {
                flag = LoadingResultFlag.Successfully, message = "Asset database loading successfully"
            };
            ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, _lastLoadResult.message);
            return(buffer);
        }
Пример #2
0
        public static EGameSetting Loading()
        {
            if (!File.Exists(SettingFileName))
            {
                _lastLoadResult = new LoadingResult()
                {
                    flag = LoadingResultFlag.FileNotExist, message = "file path: " + SettingFileName + " does not exist"
                };
                ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, _lastLoadResult.message);
                return(null);
            }

            string jsonText = File.ReadAllText(SettingFileName);

            try
            {
                EGameSetting buffer =
                    JsonConvert.DeserializeObject <EGameSetting>(jsonText, new JsonSerializerSettings
                {
                    MissingMemberHandling = MissingMemberHandling.Error
                });

                _lastLoadResult = new LoadingResult()
                {
                    flag = LoadingResultFlag.Successfully, message = "Setting file loading successfully"
                };
                ELogger.Log(ELogger.LogType.Log, ELoggerTag.Initialize, _lastLoadResult.message);
                return(buffer);
            }
            catch (JsonSerializationException ex)
            {
                _lastLoadResult = new LoadingResult()
                {
                    flag = LoadingResultFlag.Failed, message = ex.Message
                };
                ELogger.Log(ELogger.LogType.Log, ELoggerTag.Initialize, _lastLoadResult.message);
                return(null);
                // Could not find member 'DeletedDate' on object of type 'Account'. Path 'DeletedDate', line 4, position 23.
            }
        }