コード例 #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
        private void ReLoadTextures()
        {
            if (textureLoc != null &&
                textureLoc.IsValid() &&
                !string.IsNullOrEmpty(textureLoc.FileName) &&
                !string.IsNullOrEmpty(textureLoc.PackageName))
            {
                texture = NResourceManager.Instance.LoadResourceTexture2D(
                    textureLoc, EResourceIOMode.Auto, EResourceIOPriority.Normal);
            }
            else
            {
                Texture = null;
            }

            if (alphaMapLoc != null &&
                alphaMapLoc.IsValid() &&
                !string.IsNullOrEmpty(alphaMapLoc.FileName) &&
                !string.IsNullOrEmpty(alphaMapLoc.PackageName))
            {
                alphaMap = NResourceManager.Instance.LoadTextureAtlas(
                    alphaMapLoc, EResourceIOMode.Auto, EResourceIOPriority.Normal);

                if (alphaMap != null)
                {
                    NTexAtlasItem item = alphaMap.GetItem(alphaMapAtlasName);
                    alphaMapUVRect = new Rect(item.UVStart.x, item.UVStart.y, item.UVEnd.x, item.UVEnd.y);
                }
            }
            else
            {
                alphaMap = null;
            }
        }
コード例 #3
0
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     //保存到文件
     if (m_Location.IsValid())
     {
         m_Material.SaveToFile(m_Location);
     }
     else
     {
         toolStripButtonSave_Click(sender, e);
     }
 }
コード例 #4
0
 public void SetResourceLocation(NResourceLoc loc)
 {
     if (loc.IsValid())
     {
         this.txtPackage.Text = loc.PackageName;
         this.txtFolder.Text  = loc.FileName;
     }
     else
     {
         this.txtPackage.Text = "";
         this.txtFolder.Text  = "";
     }
 }
コード例 #5
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();
                }
            }
        }
コード例 #6
0
        private void RefreshFileList()
        {
            NResourceLoc curFolder = NLevelEditorEngine.Instance.CurrentFolder;

            if (curFolder.IsValid())
            {
                NEFileListBuilder lb = new NEFileListBuilder(m_backEndList,
                                                             this.imageListForList, this.imageListForListSmall,
                                                             curFolder.PackageName, curFolder.FileName);
                lb.SetFilter(m_filter);
                lb.BuildList();

                SearchFliterResourceList();
            }
        }
コード例 #7
0
 private void ReLoadTextureAtlas()
 {
     if (resourceAtlasLocation != null &&
         resourceAtlasLocation.IsValid() &&
         !string.IsNullOrEmpty(resourceAtlasLocation.FileName) &&
         !string.IsNullOrEmpty(resourceAtlasLocation.PackageName))
     {
         TextureAtlas = NResourceManager.Instance.LoadTextureAtlas(
             resourceAtlasLocation, EResourceIOMode.Auto, EResourceIOPriority.Normal);
     }
     else
     {
         TextureAtlas = null;
     }
 }
コード例 #8
0
        //添加一个新的文件(需要检测是否有重复,如果有重复,则删除旧的,添加新的)
        public void     Add(NResourceLoc loc)
        {
            if (!loc.IsValid())
            {
                return;
            }
            int i = m_FileList.IndexOf(loc);

            if (i != -1)
            {
                m_FileList.RemoveAt(i);
            }
            if (m_FileList.Count >= m_MaxItemCount)
            {
                m_FileList.RemoveAt(m_FileList.Count - 1);
            }
            m_FileList.Insert(0, loc);
        }
コード例 #9
0
        static public bool AcceptResoruceFile(NResourceLoc res)
        {
            if (!res.IsValid())
            {
                return(false);
            }

            bool accept = false;

            switch (res.FileExtension)
            {
            case "spt":
            case "nmdl":
            case "nam":
                accept = true;
                break;
            }

            return(accept);
        }
コード例 #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();
         }
     }
 }