public void ShowLoadEditorPopup() { Windows.SelectFilePopup popup = new Windows.SelectFilePopup(); popup.Center(); popup.Closed += (s, e) => { if (popup.DialogResult) { LoadEditor(popup.SelectedFile, popup.SelectedLoader); } }; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.LayeredSurface(), new FileLoaders.Scene(), new FileLoaders.GameObject() }; popup.Show(true); }
public void ShowStartup() { Window.Prompt("Create new or open existing?", "New", "Open", (b) => { if (b) { Windows.NewConsolePopup popup = new Windows.NewConsolePopup(); popup.Center(); popup.Closed += (s, e) => { if (!popup.DialogResult) { ShowStartup(); } else { CreateNewEditor(popup.Editor, popup.SettingWidth, popup.SettingHeight, popup.SettingForeground, popup.SettingBackground); } }; popup.Show(true); } else { Windows.SelectFilePopup popup = new Windows.SelectFilePopup(); popup.Center(); popup.Closed += (s, e) => { if (!popup.DialogResult) { ShowStartup(); } else { LoadEditor(popup.SelectedFile, popup.SelectedLoader); } }; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.LayeredSurface(), new FileLoaders.BasicSurface(), new FileLoaders.Scene(), new FileLoaders.GameObject() }; popup.Show(true); } }); }
void saveAnimationToFile_ButtonClicked(object sender, EventArgs e) { var animation = (AnimatedTextSurface)animations.SelectedItem; SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { popup.SelectedLoader.Save(animation, popup.SelectedFile); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.Animation() }; popup.SelectButtonText = "Save"; popup.SkipFileExistCheck = true; popup.Show(true); popup.Center(); }
void addNewAnimationFromFile_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { var animation = (AnimatedTextSurface)popup.SelectedLoader.Load(popup.SelectedFile); entity.Animations[animation.Name] = animation; RebuildListBox(); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.Animation() }; popup.Show(true); popup.Center(); }
private void _saveBrush_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { popup.SelectedLoader.Save(saveBrushHandler(), popup.SelectedFile); } }; popup.CurrentFolder = lastFolder ?? Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.TextSurface(), new FileLoaders.TextFile() }; popup.SelectButtonText = "Save"; popup.SkipFileExistCheck = true; popup.Show(true); popup.Center(); }
private void _loadBrush_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { if (System.IO.File.Exists(popup.SelectedFile)) { lastFolder = System.IO.Path.GetDirectoryName(popup.SelectedFile); //if (System.IO.Path.GetExtension(popup.SelectedFile) == ".ans") //{ // using (var ansi = new SadConsole.Ansi.Document(popup.SelectedFile)) // { // var console = new SadConsole.Consoles.Console(80, 1); // console.TextSurface.ResizeOnShift = true; // SadConsole.Ansi.AnsiWriter writer = new SadConsole.Ansi.AnsiWriter(ansi, console); // writer.ReadEntireDocument(); // _loadBrushHandler(console.CellData); // } //} //else loadBrushHandler((TextSurface)popup.SelectedLoader.Load(popup.SelectedFile)); } } }; popup.CurrentFolder = lastFolder ?? Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.TextSurface(), new FileLoaders.TextFile() }; popup.Show(true); popup.Center(); }
private static void ShowStartup() { Window.Prompt("Create new or open existing?", "New", "Open", (b) => { if (b) { Windows.NewConsolePopup popup = new Windows.NewConsolePopup(); popup.Center(); popup.Closed += (s, e) => { if (!popup.DialogResult) ShowStartup(); else CreateNewEditor(popup.Editor, popup.SettingWidth, popup.SettingHeight, popup.SettingForeground, popup.SettingBackground); }; popup.Show(true); } else { Windows.SelectFilePopup popup = new Windows.SelectFilePopup(); popup.Center(); popup.Closed += (s, e) => { if (!popup.DialogResult) ShowStartup(); else LoadEditor(popup.SelectedFile, popup.SelectedLoader); }; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.LayeredTextSurface(), new FileLoaders.TextSurface(), new FileLoaders.Scene(), new FileLoaders.GameObject() }; popup.Show(true); } }); }
public static void ShowLoadEditorPopup() { Windows.SelectFilePopup popup = new Windows.SelectFilePopup(); popup.Center(); popup.Closed += (s, e) => { if (popup.DialogResult) LoadEditor(popup.SelectedFile, popup.SelectedLoader); }; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.LayeredTextSurface(), new FileLoaders.Scene(), new FileLoaders.GameObject() }; popup.Show(true); }
void saveLayerToFile_ButtonClicked(object sender, EventArgs e) { var layer = (LayeredTextSurface.Layer)layers.SelectedItem; SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { TextSurface newSurface = new TextSurface(surface.Width, surface.Height, layer.Cells); newSurface.Save(popup.SelectedFile); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.TextSurface() }; popup.SelectButtonText = "Save"; popup.SkipFileExistCheck = true; popup.Show(true); popup.Center(); }
void addNewLayerFromFile_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { TextSurface newSurface = TextSurface.Load(popup.SelectedFile); if (newSurface.Width != surface.Width || newSurface.Height != surface.Height) { var tempSurface = new TextSurface(surface.Width, surface.Height, surface.Font); newSurface.Copy(tempSurface); var newLayer = surface.Add(tempSurface); LayerMetadata.Create("Loaded", true, true, true, newLayer); } else { var layer = surface.Add(newSurface); LayerMetadata.Create("Loaded", true, true, true, layer); } RebuildListBox(); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.TextSurface() }; popup.Show(true); popup.Center(); }
void ImportEntity_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { var entity = (GameObject)popup.SelectedLoader.Load(popup.SelectedFile); entity.Position = new Microsoft.Xna.Framework.Point(0, 0); //entity.RenderOffset = (EditorConsoleManager.ActiveEditor as Editors.SceneEditor).Position; (EditorConsoleManager.ActiveEditor as Editors.SceneEditor)?.LoadEntity(entity); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.GameObject() }; popup.Show(true); popup.Center(); }
void saveFrameToFile_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { TextSurface surface = new TextSurface(selectedFrame.Width, selectedFrame.Height, selectedFrame.Cells, Settings.Config.ScreenFont); surface.DefaultForeground = selectedFrame.DefaultForeground; surface.DefaultBackground = selectedFrame.DefaultBackground; popup.SelectedLoader.Save(surface, popup.SelectedFile); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.TextSurface(), new FileLoaders.TextFile() }; popup.SelectButtonText = "Save"; popup.SkipFileExistCheck = true; popup.Show(true); popup.Center(); }
void addNewFrameFromFile_ButtonClicked(object sender, EventArgs e) { SelectFilePopup popup = new SelectFilePopup(); popup.Closed += (o2, e2) => { if (popup.DialogResult) { var surface = (ITextSurfaceRendered)popup.SelectedLoader.Load(popup.SelectedFile); var newFrame = currentAnimation.CreateFrame(); surface.Copy(newFrame); EnableDisableControls(0); DrawFrameCount(); } }; popup.CurrentFolder = Environment.CurrentDirectory; popup.FileLoaderTypes = new FileLoaders.IFileLoader[] { new FileLoaders.TextSurface(), new FileLoaders.TextFile() }; popup.Show(true); popup.Center(); }