private void btnOK_Click(object sender, EventArgs e) { if (!m_OpenFileMode) { NResourceLoc loc = GetResourceLocation(); if (NEngine.Instance().FileSystem.IsFileExist(loc.PackageName, loc.FileName)) { DialogResult rst = MessageBox.Show("当前名称的文件已经存在,是否覆盖?", "警告", MessageBoxButtons.YesNo); if (rst != DialogResult.Yes) { return; } else { DialogResult = DialogResult.OK; this.Close(); } } else { DialogResult = DialogResult.OK; this.Close(); } } else { DialogResult = DialogResult.OK; this.Close(); } }
/// <summary> /// 引擎Callback函数 /// </summary> /// <param name="file">文件对象描述</param> public override void OnFileEntity(ref NFileEntity file) { if (file.type == EFileEntityType.Regular) { bool add = true; if (m_filter != null) { add = m_filter.FileEnabled(file); } if (add) { ListViewItem it = m_listCtrl.Items.Add(file.FileName); string thumbName = ThumbnailManager.Instance.LoadThumbnail(file.PackageName, file.FilePath, m_imgList, m_imgListSmall); uint fileSize = NEngine.Instance().FileSystem.GetFileSize(file.PackageName, file.FilePath); DateTime fileTime = NEngine.Instance().FileSystem.GetFileTime(file.PackageName, file.FilePath); it.ImageKey = thumbName; it.Tag = file; //-- sub item [file size] string strFileSize; if (fileSize > 1024) { strFileSize = string.Format("{0}KB", fileSize / 1024); } else { strFileSize = fileSize.ToString(); } it.SubItems.Add(strFileSize); //-- sub item [resource type] it.SubItems.Add(GetResourceTypeByFileExt(file.FileExtension)); //-- sub item [file time] string strFileTime = string.Format("{0} {1}", fileTime.ToShortDateString(), fileTime.ToShortTimeString()); it.SubItems.Add(strFileTime); } } }
/// <summary> /// 初始化GUI系统,在InitModules时调用 /// </summary> private void InitGuiSystem() { NRenderResourceManager renderResMgr = NEngine.Instance().RenderResManager; guiCanvas = renderResMgr.NewUICanvas(); // 创建UI系统 new GUISystem(guiCanvas); //加载程序集,注册内置窗口类型 Assembly executingAssembly = Assembly.GetExecutingAssembly(); WindowManager.Instance.LoadAssembly(Path.GetDirectoryName(executingAssembly.Location) + System.IO.Path.DirectorySeparatorChar + @"Nexus.GUI.dll"); // 加载当前执行文件中窗口类型 WindowManager.Instance.AttachAssembly(executingAssembly); WindowManager.Instance.AttachAssembly(Assembly.GetEntryAssembly()); // 创建一个缺省的唯一父窗口 GUISystem.Instance.RootWindow = WindowManager.Instance.CreateWindow("Nexus.GUI.Widgets.GUISheet", GUISystem.DefaultRootWindowName, null); }
/// <summary> /// 窗口大小发生变化 /// </summary> protected virtual void GameViewportControl_SizeChanged(object sender, EventArgs e) { NEngineConfig eng = NEngine.Instance().Config; gameViewport.Width = (uint)Math.Min(eng.ClientWidth, this.ClientSize.Width); gameViewport.Height = (uint)Math.Min(eng.ClientHeight, this.ClientSize.Height); gameViewport.X = (uint)(eng.ClientWidth - gameViewport.Width) / 2; gameViewport.Y = (uint)(eng.ClientHeight - gameViewport.Height) / 2; gameViewport.Camera.SetPerspective(gameViewport.Camera.FOV, Math.Min(this.ClientSize.Width, eng.ClientWidth), Math.Min(this.ClientSize.Height, eng.ClientHeight), 10, 50000); gameViewport.Update(); Window rootWnd = GUISystem.Instance == null ? null : GUISystem.Instance.RootWindow; if (rootWnd != null) { rootWnd.AbsolutePosition = new Vector2(gameViewport.X, gameViewport.Y); rootWnd.AbsoluteSize = new Vector2(gameViewport.Width, gameViewport.Height); } }
public NGUIWidgetsRender() { NRenderResourceManager renderResMgr = NEngine.Instance().RenderResManager; m_uiCanvas = renderResMgr.NewUICanvas(); }