private void Reload() { Localisation.Reload(); if (!Province.ReloadAll()) { ShowMessage($"Error loading provinces:\n{Province.Status}\n{Parser.Status}"); Close(); } if (!State.ReloadAll()) { ShowMessage($"Error loading states:\n{State.Status}\n{Parser.Status}"); Close(); } if (!Country.ReloadAll()) { ShowMessage($"Error loading countries:\n{Parser.Status}"); Close(); } resourceManager.ReloadResourceMap(true, false); stateSplitter = new StateSplitterForm(resourceManager); resourceEditor = new ResourceEditorForm(resourceManager); stateEditor = new StateEditorForm(resourceManager); provinceCreator = new ProvinceCreatorForm(); localisationEditor = new LocalisationEditorForm(); debugForm = new DebugForm(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // 创建log NLogger.Instance.AddLogOutput(new NFileLogOutput("NexusEditor.log")); // 读取本地化配置 NexusEditor.Properties.Resources.Culture = new CultureInfo(ConfigurationManager.AppSettings["Localization"]); SplashForm.StartSplash(NexusEditor.Properties.Resources.EditorSplash); try { engine = new NLevelEditorEngine(); engine.InitCore(); mainForm = new EditorMainForm(); mainForm.CreateLogForm(); //-- create engine config CustomConfigurationSection configuration = CustomConfigurationSection.Open(); mainForm.ClientSize = new Size(configuration.EngineSetting.ClientWidth, configuration.EngineSetting.ClientHeight); NEngineConfig engineCfg = new NEngineConfig(); engineCfg.RenderWndHandle = mainForm.RenderPanelHandle; engineCfg.ClientWidth = Screen.PrimaryScreen.Bounds.Width; engineCfg.ClientHeight = Screen.PrimaryScreen.Bounds.Height; engineCfg.ColorBits = configuration.EngineSetting.ColorBits; engineCfg.FullScreen = configuration.EngineSetting.FullScreen; engineCfg.EnableHDR = configuration.EngineSetting.EnableHDR; engineCfg.EnableSSAO = configuration.EngineSetting.EnableSSAO; engineCfg.RenderClass = configuration.EngineSetting.RenderClass; engineCfg.FileSystemClass = configuration.EngineSetting.FileSystemClass; engineCfg.EngineDataPkg = configuration.EngineSetting.EngineDataPkg; engineCfg.ResourceCacheClass = configuration.EngineSetting.ResourceCacheClass; engineCfg.ResourceIOClass = configuration.EngineSetting.ResourceIOClass; engineCfg.FileSystemRoot = configuration.EngineSetting.FileSystemRoot; if (string.IsNullOrEmpty(engineCfg.FileSystemRoot)) { engineCfg.FileSystemRoot = NFileSystem.DefaultFileSystemRoot; } //-- NEditorConfig editorCfg = new NEditorConfig(); editorCfg.actorEdClassAssembly = configuration.EditorEngineSetting.ActorEdClassAssembly; editorCfg.actorEditorClass = configuration.EditorEngineSetting.ActorEditorClass; configuration.Save(); engine.InitModules(engineCfg, editorCfg); } catch (System.Exception e) { ShowException(e, "Nexus Engine Init FAILED!"); engine.Dispose(); mainForm.Dispose(); return; } try { //-- create default level engine.CreateMainLevel("defaultLevel"); //-- create editor windows mainForm.CreateEditorForms(); mainForm.CreateViewport(); //-- open resrouce resourceForm = new ResourceEditorForm(); SplashForm.CloseSplash(); //-- run resourceForm.Show(); mainForm.Show(); mainForm.BringToFront(); Application.Run(mainForm); } catch (System.Exception e) { ShowException(e, "Nexus Engine Exception!"); } //-- close resourceForm.Close(); engine.Close(); engine.Dispose(); NLogger.Instance.Clear(); mainForm.Dispose(); }