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. } }
public EWindow(int width, int height) : base(width, height, new GraphicsMode(32, 0, 0, 4), "Ellyality Demo") { GLWidth = width; GLHeight = height; // Initialize the engine EEngine.Initialize(); VSync = VSyncMode.Off; // Loading the asset into database EEngine.instance.assetDatabase = EAssetDatabase.Load(); // Check if the loading successfully if (EAssetDatabase.GetResult().flag == LoadingResultFlag.FolderNotExist) { ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, "Missing project folder"); EAssetDatabase.CreateFolderStructure(); EErrorReport.ExportReport(ELogger.GetLoggerMessage()); Exit(); } if (EAssetDatabase.GetResult().flag == LoadingResultFlag.Failed) { ELogger.Log(ELogger.LogType.Error, ELoggerTag.Initialize, "Loading asset failed"); EErrorReport.ExportReport(ELogger.GetLoggerMessage()); Exit(); } // Loading the setting file into engine EEngine.instance.setting = EGameSetting.Loading(); // Check if the loading successfully if (EGameSetting.GetResult().flag == LoadingResultFlag.FileNotExist) { ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, "Missing project files"); EGameSetting.CreateDefaultSetting(); EErrorReport.ExportReport(ELogger.GetLoggerMessage()); Exit(); } if (EGameSetting.GetResult().flag == LoadingResultFlag.Failed) { ELogger.Log(ELogger.LogType.Error, ELoggerTag.Initialize, "Loading setting failed"); EGameSetting.CreateDefaultSetting(); EErrorReport.ExportReport(ELogger.GetLoggerMessage()); Exit(); } // If there is no scene has select // Create an empty scene for engine drawing if (EEngine.instance.setting.FirstLoadingScene == null || EEngine.instance.setting.FirstLoadingScene == "") { EEngine.instance.loadScene.Add(EScene.GetDefaultScene()); ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, "Default scene setting is null ! loading default scene instead..."); } // Hide console window var handle = GetConsoleWindow(); ShowWindow(handle, EEngine.instance.setting.DebugMode ? SW_SHOW : SW_HIDE); ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, "Application fixed update rate: " + EEngine.instance.setting.FixedUpdateTime.ToString()); ELogger.Log(ELogger.LogType.Warning, ELoggerTag.Initialize, "Application frame fresh rate: " + (double)1 / (double)EEngine.instance.setting.FramePreSecond); Run(EEngine.instance.setting.FixedUpdateTime, (double)1 / (double)EEngine.instance.setting.FramePreSecond); }