Example #1
0
 private void RelocationStytlePath(NResourceLoc loc)
 {
     using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
     {
         // 便利该目录中的所有Style *.nui文件
         using (UIFileQurery qurery = new UIFileQurery(this.listViewStyle, loc.PackageName, loc.FileName))
         {
             this.textBoxStyle.Text = loc.ToString();
         }
     }
 }
        public void OnLoadRecentFile(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            NResourceLoc      loc  = new NResourceLoc(item.Text);

            if (loc.IsValid())
            {
                using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
                {
                    NLevelEditorEngine.Instance.LoadMainLevel(loc);
                    this.toolStripStatusLableNote.Text = "Level Load from " + loc.ToString();
                    this.RefreshViewports();
                }
            }
        }
 private void toolStripMenuExportLevel_Click(object sender, EventArgs e)
 {
     using (LevelLocDlg dlg = new LevelLocDlg())
     {
         dlg.Text = "Export Level ...";
         dlg.SetResourceLocation(NLevelEditorEngine.Instance.LevelLoc);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             NResourceLoc loc = dlg.ResourceLocation;
             using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
             {
                 NLevelEditorEngine.Instance.ExportMainLevel(loc);
                 this.toolStripStatusLableNote.Text = "Level Export to " + loc.ToString();
             }
         }
     }
 }
 private void saveCurrentLevelToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (LevelLocDlg dlg = new LevelLocDlg())
     {
         dlg.Text = "Save Level ...";
         dlg.SetResourceLocation(NLevelEditorEngine.Instance.LevelLoc);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             NResourceLoc loc = dlg.ResourceLocation;
             using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
             {
                 NLevelEditorEngine.Instance.SaveMainLevel(loc);
                 this.toolStripStatusLableNote.Text = "Level saved to " + loc.ToString();
                 m_RecentFile.Add(loc);
                 m_RecentFile.Save();
             }
         }
     }
 }
 private void autoSaveTimer_Tick(object sender, EventArgs e)
 {
     ++m_TimerTickCount;
     if (m_TimerTickCount >= m_AutoSaveInterval)
     {
         m_TimerTickCount = 0;
         NResourceLoc loc = NLevelEditorEngine.Instance.LevelLoc;
         if (!loc.IsValid())
         {
             return;
         }
         //自动保存到当前level所在文件夹下面的"auto_save+日期+时间"子文件夹
         NResourceLoc auto_save = new NResourceLoc();
         auto_save.PackageName = loc.PackageName;
         auto_save.FileName    = loc.FileName + "\\auto_save";
         NLevelEditorEngine.Instance.FileSystem.CreateDirectory(auto_save.PackageName, auto_save.FileName);
         using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
         {
             NLevelEditorEngine.Instance.SaveMainLevelAs(auto_save);
             this.toolStripStatusLableNote.Text = "Level auto saved to " + auto_save.ToString();
         }
     }
 }