public bool LoadEntity(GameObject entity) { var editor = new GameObjectEditor(); editor.SetEntity(entity); editor.LinkedEditor = this; MainScreen.Instance.AddEditor(editor, false); var localEntity = new GameObject(entity.Animation); foreach (var item in entity.Animations.Values) { localEntity.Animations[item.Name] = item; } Objects.Add(new ResizableObject(ResizableObject.ObjectType.GameObject, localEntity)); GameObjectPanel.RebuildListBox(); localEntity.Position = entity.Position; LinkedGameObjects.Add(localEntity, entity); FixLinkedObjectTitles(); return(true); }
private void LoadEditor(string file, FileLoaders.IFileLoader loader) { Editors.IEditor editor = null; if (loader is FileLoaders.LayeredSurface || loader is FileLoaders.BasicSurface) { editor = new Editors.LayeredConsoleEditor(); AddEditor(editor, false); editor.Load(file, loader); } else if (loader is FileLoaders.GameObject) { editor = new Editors.GameObjectEditor(); AddEditor(editor, false); editor.Load(file, loader); } else if (loader is FileLoaders.Scene) { editor = new Editors.SceneEditor(); AddEditor(editor, false); editor.Load(file, loader); } if (editor != null) { //editor.RenderedConsole.TextSurface.RenderArea = new Rectangle(0, 0, InnerEmptyBounds.Width, InnerEmptyBounds.Height); ChangeActiveEditor(editor); } topBarPane.IsVisible = true; ToolsPane.IsVisible = true; }
public void RemoveGameObject(ResizableObject gameObject) { var otherObject = LinkedGameObjects[gameObject.GameObject]; GameObjectEditor foundDoc = null; foreach (var doc in MainScreen.Instance.OpenEditors) { if (doc is GameObjectEditor) { if (((GameObjectEditor)doc).GameObject == otherObject) { foundDoc = (GameObjectEditor)doc; } } } if (foundDoc != null) { MainScreen.Instance.RemoveEditor(foundDoc); LinkedGameObjects.Remove(gameObject.GameObject); Objects.Remove(gameObject); } }
private void CreateNewEditor(Editors.Editors editorType, int width, int height, Color defaultForeground, Color defaultBackground) { Editors.IEditor editor = null; switch (editorType) { case SadConsoleEditor.Editors.Editors.Console: editor = new Editors.LayeredConsoleEditor(); editor.New(defaultForeground, defaultBackground, width, height); break; case SadConsoleEditor.Editors.Editors.GameObject: editor = new Editors.GameObjectEditor(); editor.New(defaultForeground, defaultBackground, width, height); break; case SadConsoleEditor.Editors.Editors.Scene: editor = new Editors.SceneEditor(); editor.New(defaultForeground, defaultBackground, width, height); break; case SadConsoleEditor.Editors.Editors.GUI: break; default: break; } if (editor != null) { AddEditor(editor, true); } topBarPane.IsVisible = true; ToolsPane.IsVisible = true; }
public bool LoadEntity(GameObject entity) { var editor = new GameObjectEditor(); editor.SetEntity(entity); editor.LinkedEditor = this; EditorConsoleManager.AddEditor(editor, false); var localEntity = new GameObject(entity.Font); foreach (var item in entity.Animations.Values) localEntity.Animations.Add(item.Name, item); localEntity.Animation = localEntity.Animations[entity.Animation.Name]; localEntity.RenderOffset = consoleWrapper.Position; Objects.Add(new ResizableObject(ResizableObject.ObjectType.GameObject, localEntity)); GameObjectPanel.RebuildListBox(); localEntity.Position = entity.Position; localEntity.RenderOffset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location; LinkedGameObjects.Add(localEntity, entity); FixLinkedObjectTitles(); return true; }
private static void LoadEditor(string file, FileLoaders.IFileLoader loader) { Editors.IEditor editor = null; if (loader is FileLoaders.LayeredTextSurface || loader is FileLoaders.TextSurface) { editor = new Editors.LayeredConsoleEditor(); AddEditor(editor, false); editor.Load(file, loader); } else if (loader is FileLoaders.GameObject) { editor = new Editors.GameObjectEditor(); AddEditor(editor, false); editor.Load(file, loader); } else if (loader is FileLoaders.Scene) { editor = new Editors.SceneEditor(); AddEditor(editor, false); editor.Load(file, loader); } if (editor != null) { editor.RenderedConsole.TextSurface.RenderArea = new Rectangle(0, 0, InnerEmptyBounds.Width, InnerEmptyBounds.Height); ChangeActiveEditor(editor); } topBarPane.IsVisible = true; ToolsPane.IsVisible = true; scrollerContainer.IsVisible = true; }
private static void CreateNewEditor(Editors.Editors editorType, int width, int height, Color defaultForeground, Color defaultBackground) { Editors.IEditor editor = null; switch (editorType) { case SadConsoleEditor.Editors.Editors.Console: editor = new Editors.LayeredConsoleEditor(); editor.New(defaultForeground, defaultBackground, width, height); break; case SadConsoleEditor.Editors.Editors.GameObject: editor = new Editors.GameObjectEditor(); editor.New(defaultForeground, defaultBackground, width, height); break; case SadConsoleEditor.Editors.Editors.Scene: editor = new Editors.SceneEditor(); editor.New(defaultForeground, defaultBackground, width, height); break; case SadConsoleEditor.Editors.Editors.GUI: break; default: break; } if (editor != null) { AddEditor(editor, true); } topBarPane.IsVisible = true; ToolsPane.IsVisible = true; scrollerContainer.IsVisible = true; }