Пример #1
0
        public void CreateEditorForms()
        {
            NLevelEditorEngine.Instance.LevelChanged += new EventHandler(Editor_LevelChanged);
            NEditorCommandManager cmdMgr = NLevelEditorEngine.Instance.CommandMgr;

            cmdMgr.UndoStackChanged += new EventHandler(this.UndoStackChangedEvent);
            cmdMgr.RedoStackChanged += new EventHandler(this.RedoStackChangedEvent);

            m_layerDlg = new LayerManagerDlg();

            m_GlobalSettingForm = new GlobalSettingForm();

            //加载最近用过的文件
            m_RecentFile = new RecentFile();
            m_RecentFile.Load();
            for (int i = 0; i < m_RecentFile.FileCount; ++i)
            {
                NResourceLoc loc = m_RecentFile.GetFile(i);
                if (loc.IsValid())
                {
                    ToolStripItem item = MTU.DropDown.Items.Add(loc.ToString());
                    if (item != null)
                    {
                        item.Click += this.OnLoadRecentFile;
                    }
                }
            }

            //读取各种设置
            ReadSettings();
        }
Пример #2
0
        static private string MakeComponentName(string prefix, NResourceLoc res)
        {
            string ret = prefix + res.ToString();

            ret = ret.Replace(':', '_');
            return(ret.Replace('/', '_'));
        }
Пример #3
0
        /// <summary>
        /// 响应Resource列表选中事件, 将选中的文件的缩略图显示到列表下方的PictureBox上
        /// </summary>
        private void listViewResource_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection selItems = this.listViewResource.SelectedItems;
            if (selItems.Count <= 0)
            {
                return;
            }

            ListViewItem sel    = selItems[0];
            NFileEntity  nfile  = (NFileEntity)sel.Tag;
            NResourceLoc resLoc = new NResourceLoc(nfile.PackageName, nfile.FilePath);
            //m_resPreview.ShowResource(resLoc);
            //m_resPreview.ZoomExtents();

            int i = m_resBigImgList.Images.IndexOfKey(resLoc.ToString());

            if (i == -1)
            {
                this.pictureBoxResource.Image = null;
            }
            else
            {
                this.pictureBoxResource.Image = m_resBigImgList.Images[i];
            }
        }
Пример #4
0
        public void LoadMaterial(string pkg, string file)
        {
            m_Location = new NResourceLoc(pkg, file);
            m_Material = NMtlBase.FromFile(m_Location);
            if (m_Material == null)
            {
                this.propertyGridMtl.SelectedObject = null;
                return;
            }
            m_Material.Name = m_Location.ToString();

            MaterialProperty mtlProp = new MaterialProperty(m_Material);

            mtlProp.ApplyChange();
            this.propertyGridMtl.SelectedObject = mtlProp;
            if (m_Sphere == null)
            {
                LoadSphere();
            }
            if (m_Material != null)
            {
                m_Sphere.SetMaterial(m_Material);
            }
            m_preview.Refresh();
        }
Пример #5
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();
         }
     }
 }
Пример #6
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            //新建材质
            NResourceLoc resLoc = new NResourceLoc("engine_data", "material/standard.hlsl");
            NMtlStatic   mtl    = new NMtlStatic(resLoc.ToString());

            mtl.DefaultCreate(resLoc);
            m_Material = mtl;
            MaterialProperty mtlProp = new MaterialProperty(m_Material);

            mtlProp.ApplyChange();
            this.propertyGridMtl.SelectedObject = mtlProp;
            LoadSphere();
        }
Пример #7
0
        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();
                }
            }
        }
Пример #8
0
 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();
             }
         }
     }
 }
Пример #9
0
 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();
             }
         }
     }
 }
Пример #10
0
 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();
         }
     }
 }
Пример #11
0
        public MaterialEditor()
        {
            InitializeComponent();

            m_finalClose = false;
            m_realTime   = false;

            m_Location = new NResourceLoc("", "");

            m_preview = new ResourcePreview("MaterialPreview_LV");
            this.splitContainer1.Panel1.Controls.Add(m_preview);

            //新建材质
            NResourceLoc resLoc = new NResourceLoc("engine_data", "material/standard.hlsl");
            NMtlStatic   mtl    = new NMtlStatic(resLoc.ToString());

            mtl.DefaultCreate(resLoc);
            m_Material = mtl;
            MaterialProperty mtlProp = new MaterialProperty(m_Material);

            mtlProp.ApplyChange();
            this.propertyGridMtl.SelectedObject = mtlProp;
            LoadSphere();
        }
Пример #12
0
 public void SetOutputLoc(NResourceLoc loc)
 {
     textBoxOutputFolder.Text = loc.ToString();
 }
Пример #13
0
        private void SaveLocationChanged(object sender, EventArgs e)
        {
            NResourceLoc loc = NLevelEditorEngine.Instance.CurrentFolder;

            this.statusSaveLoc.Text = string.Format("Save Location [{0}]", loc.ToString());
        }