private void ToolsListBox_SelectedItemChanged(object sender, ListBox <ListBoxItem> .SelectedItemEventArgs e) { if (selectedTool != null) { selectedTool.OnDeselected(); //if (selectedTool.ControlPanels != null) // foreach (var pane in selectedTool.ControlPanels) // { // foreach (var control in pane.Controls) // { // Remove(control); // } // } } if (e.Item != null) { selectedTool = (ITool)e.Item; MainScreen.Instance.ToolName = selectedTool.Title; //MainScreen.Instance.AllowKeyboardToMoveConsole = true; Panels.CharacterPickPanel.SharedInstance.HideCharacter = false; Panels.CharacterPickPanel.SharedInstance.HideForeground = false; Panels.CharacterPickPanel.SharedInstance.HideBackground = false; selectedTool.OnSelected(); Panels.CharacterPickPanel.SharedInstance.Reset(); } }
private void ToolsListBox_SelectedItemChanged(object sender, SadConsole.Controls.ListBox <SadConsole.Controls.ListBoxItem> .SelectedItemEventArgs e) { Tools.ITool tool = e.Item as Tools.ITool; if (e.Item != null) { selectedTool = tool; List <CustomPanel> newPanels = new List <CustomPanel>() { gameObjectNamePanel, animationPanel, framesPanel, toolsPanel }; if (tool.ControlPanels != null && tool.ControlPanels.Length != 0) { newPanels.AddRange(tool.ControlPanels); } panels = newPanels.ToArray(); MainScreen.Instance.ToolsPane.RedrawPanels(); if (tool is Tools.EntityCenterTool) { surface.GetLayer(LayerAnimCenter).IsVisible = true; surface.GetLayer(LayerBackground).IsVisible = true; } else { surface.GetLayer(LayerAnimCenter).IsVisible = false; surface.GetLayer(LayerBackground).IsVisible = false; } } }
/// <summary> /// Create new instance of tool for creating lines /// </summary> /// <returns></returns> public Commands.ICommand CreateLineTool() { _tool = new Tools.LineTool(); _cmd = new Commands.LineCommand((Tools.LineTool)_tool); _lastTool = ToolList.LineTool; return _cmd; }
//public void Move(int x, int y) //{ // consoleWrapper.Position = new Point(x, y); // if (MainScreen.Instance.ActiveEditor == this) // MainScreen.Instance.UpdateBorder(consoleWrapper.Position); // MainScreen.Instance.UpdateBrush(); // foreach (var entity in Objects) // entity.RenderOffset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location; // foreach (var zone in Zones) // zone.RenderOffset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location; //} public void OnSelected() { MainScreen.Instance.RefreshBorder(); layerManagementPanel.SetLayeredSurface(surface); if (selectedTool == null) { SelectedTool = tools.First().Value; } else { var oldTool = selectedTool; SelectedTool = null; SelectedTool = selectedTool; } foreach (var item in MainScreen.Instance.OpenEditors) { var editor = item as GameObjectEditor; if (editor != null && editor.LinkedEditor == this) { // sync back up any entities. foreach (var resizeObject in Objects) { var gameObject = resizeObject.GameObject; var animationName = gameObject.Animation.Name; gameObject.Animations.Clear(); gameObject.Name = LinkedGameObjects[gameObject].Name; foreach (var animation in LinkedGameObjects[gameObject].Animations) { gameObject.Animations.Add(animation.Key, animation.Value); } if (animationName != null && gameObject.Animations.ContainsKey(animationName)) { gameObject.Animation = gameObject.Animations[animationName]; } else { gameObject.Animation = gameObject.Animations.First().Value; } } } } MainScreen.Instance.ToolsPane.PanelFiles.DocumentsListbox.IsDirty = true; GameObjectPanel.RebuildListBox(); }
public bool ProcessKeyboard(Keyboard info) { if (!toolsPanel.SelectedTool.ProcessKeyboard(info, surface)) { var keys = info.KeysReleased.Select(k => k.Character).ToList(); foreach (var item in tools.Values) { if (keys.Contains(item.Hotkey)) { SelectedTool = item; return(true); } } return(false); } return(true); }
private void ToolsListBox_SelectedItemChanged(object sender, SadConsole.Controls.ListBox <SadConsole.Controls.ListBoxItem> .SelectedItemEventArgs e) { Tools.ITool tool = e.Item as Tools.ITool; if (e.Item != null) { selectedTool = tool; List <CustomPanel> newPanels = new List <CustomPanel>() { layerManagementPanel, toolsPanel }; if (tool.ControlPanels != null && tool.ControlPanels.Length != 0) { newPanels.AddRange(tool.ControlPanels); } panels = newPanels.ToArray(); MainScreen.Instance.ToolsPane.RedrawPanels(); } }
private void ToolsListBox_SelectedItemChanged(object sender, SadConsole.Controls.ListBox<SadConsole.Controls.ListBoxItem>.SelectedItemEventArgs e) { Tools.ITool tool = e.Item as Tools.ITool; if (e.Item != null) { selectedTool = tool; List<CustomPanel> newPanels = new List<CustomPanel>() { layerManagementPanel, GameObjectPanel, ZonesPanel, HotspotPanel, toolsPanel }; if (tool.ControlPanels != null && tool.ControlPanels.Length != 0) newPanels.AddRange(tool.ControlPanels); panels = newPanels.ToArray(); EditorConsoleManager.ToolsPane.RedrawPanels(); } }
public bool ProcessKeyboard(KeyboardInfo info) { if (!toolsPanel.SelectedTool.ProcessKeyboard(info, textSurface)) { var keys = info.KeysReleased.Select(k => k.Character).ToList(); foreach (var item in tools.Values) { if (keys.Contains(item.Hotkey)) { SelectedTool = item; return true; } } return false; } return true; }
public void OnSelected() { if (selectedTool == null) SelectedTool = tools.First().Value; else { var oldTool = selectedTool; SelectedTool = null; SelectedTool = selectedTool; } foreach (var item in EditorConsoleManager.OpenEditors) { var editor = item as GameObjectEditor; if (editor != null && editor.LinkedEditor == this) { // sync back up any entities. foreach (var resizeObject in Objects) { var gameObject = resizeObject.GameObject; var animationName = gameObject.Animation.Name; gameObject.Animations.Clear(); gameObject.Name = LinkedGameObjects[gameObject].Name; foreach (var animation in LinkedGameObjects[gameObject].Animations) gameObject.Animations.Add(animation.Key, animation.Value); if (animationName != null && gameObject.Animations.ContainsKey(animationName)) gameObject.Animation = gameObject.Animations[animationName]; else gameObject.Animation = gameObject.Animations.First().Value; } } } EditorConsoleManager.ToolsPane.PanelFiles.DocumentsListbox.IsDirty = true; GameObjectPanel.RebuildListBox(); }
private void ToolsListBox_SelectedItemChanged(object sender, ListBox<ListBoxItem>.SelectedItemEventArgs e) { if (selectedTool != null) { selectedTool.OnDeselected(); //if (selectedTool.ControlPanels != null) // foreach (var pane in selectedTool.ControlPanels) // { // foreach (var control in pane.Controls) // { // Remove(control); // } // } } if (e.Item != null) { selectedTool = (ITool)e.Item; EditorConsoleManager.ToolName = selectedTool.Title; //EditorConsoleManager.AllowKeyboardToMoveConsole = true; Panels.CharacterPickPanel.SharedInstance.HideCharacter = false; Panels.CharacterPickPanel.SharedInstance.HideForeground = false; Panels.CharacterPickPanel.SharedInstance.HideBackground = false; selectedTool.OnSelected(); Panels.CharacterPickPanel.SharedInstance.Reset(); } }
public void OnSelected() { if (selectedTool == null) SelectedTool = tools.First().Value; else { var oldTool = selectedTool; SelectedTool = null; SelectedTool = selectedTool; } }
public ToolBuilder() { _tool = new Tools.LineTool(); _cmd = new Commands.LineCommand((Tools.LineTool)_tool); _lastTool = ToolList.LineTool; }
private void ToolsListBox_SelectedItemChanged(object sender, SadConsole.Controls.ListBox<SadConsole.Controls.ListBoxItem>.SelectedItemEventArgs e) { Tools.ITool tool = e.Item as Tools.ITool; if (e.Item != null) { selectedTool = tool; List<CustomPanel> newPanels = new List<CustomPanel>() { gameObjectNamePanel, animationPanel, framesPanel, toolsPanel }; if (tool.ControlPanels != null && tool.ControlPanels.Length != 0) newPanels.AddRange(tool.ControlPanels); panels = newPanels.ToArray(); EditorConsoleManager.ToolsPane.RedrawPanels(); //if (tool is Tools.EntityCenterTool) //{ // textSurface.GetLayer(LayerAnimCenter).IsVisible = true; // textSurface.GetLayer(LayerBackground).IsVisible = true; // //textSurface.Tint = new Color(0f, 0f, 0f, 0.2f); //} //else //{ // textSurface.GetLayer(LayerAnimCenter).IsVisible = false; // textSurface.GetLayer(LayerBackground).IsVisible = false; // //textSurface.Tint = new Color(0f, 0f, 0f, 1f); //} } }
private void SelectedAnimationChanged(AnimatedTextSurface animation) { selectedAnimation = animation; consoleWrapper.TextSurface = textSurface = new LayeredTextSurface(animation.Width, animation.Height, Settings.Config.ScreenFont, 4); SyncSpecialLayerToAnimation(); ((LayeredTextSurface)consoleWrapper.TextSurface).SetActiveLayer(0); // inform the outer box we've changed size if (EditorConsoleManager.ActiveEditor == this) EditorConsoleManager.UpdateBorder(consoleWrapper.Position); framesPanel.SetAnimation(animation); SelectedTool = selectedTool; }
public bool ProcessKeyboard(KeyboardInfo info) { bool toolHandled = toolsPanel.SelectedTool.ProcessKeyboard(info, textSurface); if (!toolHandled) { if (info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.OemOpenBrackets)) { framesPanel.TryPreviousFrame(); return true; } else if (info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.OemCloseBrackets)) { framesPanel.TryNextFrame(); return true; } else { var keys = info.KeysReleased.Select(k => k.Character).ToList(); foreach (var item in tools.Values) { if (keys.Contains(item.Hotkey)) { SelectedTool = item; return true; } } } } return false; }
public void OnSelected() { if (IsLinked) EditorConsoleManager.ToolsPane.PanelFiles.CloseButton.IsEnabled = false; else EditorConsoleManager.ToolsPane.PanelFiles.CloseButton.IsEnabled = true; if (selectedTool == null) SelectedTool = tools.First().Value; else { var oldTool = selectedTool; SelectedTool = null; SelectedTool = selectedTool; } }