示例#1
0
文件: ELogger.cs 项目: Elly2018/Ellie
        public static void LogOutput()
        {
            string[] message = ELogger.GetLoggerMessage();
            string   _m      = "";

            for (int i = 0; i < message.Length; i++)
            {
                _m += message[i] + "\n";
            }

            File.WriteAllText(LogFileName, _m);
        }
示例#2
0
        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);
        }