private void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e) { var dockContent = dockPanel1.ActiveDocument as DockContent; if (dockContent == null) { return; } LayoutViewer viewer = null; foreach (var control in dockContent.Controls) { if (control is LayoutViewer) { viewer = control as LayoutViewer; } } if (viewer != null) { var file = viewer.LayoutFile; ActiveLayout = file; ReloadEditors(file); ActiveViewport = viewer; UpdateUndo(); viewer.UpdateViewport(); Console.WriteLine("changed " + ActiveLayout.FileName); } }
private void showGameWindowToolStripMenuItem_Click(object sender, EventArgs e) { if (GamePreviewWindow == null || GamePreviewWindow.Disposing || GamePreviewWindow.IsDisposed) { GamePreviewWindow = new LayoutViewer(this, ActiveLayout, Textures); GamePreviewWindow.GameWindow = true; GamePreviewWindow.Dock = DockStyle.Fill; STForm form = new STForm(); form.Text = "Game Preview"; form.AddControl(GamePreviewWindow); form.Show(this); } }
private void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e) { var dockContent = dockPanel1.ActiveDocument as LayoutViewer; if (dockContent != null) { var file = (dockContent).LayoutFile; ReloadEditors(file); ActiveViewport = dockContent; dockContent.UpdateViewport(); } }
public void LoadBxlyt(BxlytHeader header, string fileName) { LayoutFiles.Add(header); ActiveLayout = header; LayoutViewer Viewport = new LayoutViewer(header, Textures); Viewport.Dock = DockStyle.Fill; Viewport.Show(dockPanel1, DockState.Document); Viewport.DockHandler.AllowEndUserDocking = false; Viewports.Add(Viewport); ActiveViewport = Viewport; ActiveViewport.UseOrtho = orthographicViewToolStripMenuItem.Checked; if (!isLoaded) { InitializeDockPanels(); } isLoaded = true; }
public void LoadBxlyt(BxlytHeader header) { /* if (PluginRuntime.BxfntFiles.Count > 0) * { * var result = MessageBox.Show("Found font files opened. Would you like to save character images to disk? " + * "(Allows for faster loading and won't need to be reopened)", "Layout Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question); * if (result == DialogResult.Yes) * { * var cacheDir = $"{Runtime.ExecutableDir}/Cached/Font"; * if (!System.IO.Directory.Exists(cacheDir)) * System.IO.Directory.CreateDirectory(cacheDir); * * foreach (var bffnt in PluginRuntime.BxfntFiles) * { * if (!System.IO.Directory.Exists($"{cacheDir}/{bffnt.Name}")) * System.IO.Directory.CreateDirectory($"{cacheDir}/{bffnt.Name}"); * * var fontBitmap = bffnt.GetBitmapFont(true); * foreach (var character in fontBitmap.Characters) * { * var charaMap = character.Value; * charaMap.CharBitmap.Save($"{cacheDir}/{bffnt.Name}/cmap_{Convert.ToUInt16(character.Key).ToString("x2")}_{charaMap.CharWidth}_{charaMap.GlyphWidth}_{charaMap.LeftOffset}.png"); * } * * fontBitmap.Dispose(); * } * } * }*/ LayoutFiles.Add(header); ActiveLayout = header; LayoutViewer Viewport = new LayoutViewer(this, header, Textures); Viewport.DockContent = new DockContent(); Viewport.DockContent.Text = header.FileName; Viewport.DockContent.Controls.Add(Viewport); Viewport.Dock = DockStyle.Fill; Viewport.DockContent.Show(dockPanel1, DockState.Document); Viewport.DockContent.DockHandler.AllowEndUserDocking = false; Viewports.Add(Viewport); ActiveViewport = Viewport; UpdateUndo(); /* if (ActiveViewport == null) * { * LayoutViewer Viewport = new LayoutViewer(this,header, Textures); * Viewport.DockContent = new DockContent(); * Viewport.DockContent.Controls.Add(Viewport); * Viewport.Dock = DockStyle.Fill; * Viewport.DockContent.Show(dockPanel1, DockState.Document); * Viewport.DockContent.DockHandler.AllowEndUserDocking = false; * Viewports.Add(Viewport); * ActiveViewport = Viewport; * } * else * ActiveViewport.LoadLayout(header);*/ orthographicViewToolStripMenuItem.Checked = Runtime.LayoutEditor.UseOrthographicView; if (!isLoaded) { InitializeDockPanels(); } LayoutAnimList?.SearchAnimations(header); CustomMapper.LoadMK8DCharaSelect(Textures, header); isLoaded = true; }