public override void Begin() { Engine.MapLoaded = true; Logger.Log("Beginning map editor."); // Initialize room list window RoomListWindow = new WindowRoomList(); ToolListWindow = new WindowToolList(BGAutotiler, FGAutotiler); List <string> roomNames = new List <string>(); foreach (Room room in State.LoadedLevel.Rooms) { roomNames.Add(room.Name); } RoomListWindow.RoomNames = roomNames.ToArray(); Engine.CreateWindow(RoomListWindow); Engine.CreateWindow(ToolListWindow); Engine.Instance.GraphicsDevice.SetRenderTarget(null); Engine.OnViewportUpdate += UpdateViewport; RoomListWindow.UpdateListHeight(); ToolListWindow.UpdateListHeight(); // Initialize shortcuts Shortcuts = new ShortcutManager(); Shortcuts.RegisterShortcut(new Shortcut(Menubar.Open, Keys.LeftControl, Keys.O)); Shortcuts.RegisterShortcut(new Shortcut(new Action(() => { Menubar.Save(); }), Keys.LeftControl, Keys.S)); Shortcuts.RegisterShortcut(new Shortcut(Menubar.SaveAs, Keys.LeftControl, Keys.LeftShift, Keys.S)); Shortcuts.RegisterShortcut(new Shortcut(State.Redo, Keys.LeftControl, Keys.LeftShift, Keys.Z)); Shortcuts.RegisterShortcut(new Shortcut(State.Undo, Keys.LeftControl, Keys.Z)); }
public override void RenderGUI() { ImGui.Text("Tilesets"); ImGui.SetNextItemWidth(235f); string search = MapEditor.Instance.ToolListWindow.Searches[GetSearchGroup()]; var toolListWindow = MapEditor.Instance.ToolListWindow; if (ToolManager.SelectedLayer == ToolLayer.Background) { if (ImGui.ListBoxHeader("TilesetsList", toolListWindow.BGTilesets.Count, toolListWindow.VisibleItemsCount)) { WindowToolList.CreateSelectables(search, toolListWindow.BGTilesets.OrderBy((s) => s), (item) => { if (ImGui.Selectable(item, ToolManager.BGTileset == toolListWindow.BGTilesets.IndexOf(item))) { ToolManager.BGTileset = toolListWindow.BGTilesets.IndexOf(item); } }); ImGui.ListBoxFooter(); } } else { if (ImGui.ListBoxHeader("TilesetsList", toolListWindow.FGTilesets.Count, toolListWindow.VisibleItemsCount)) { WindowToolList.CreateSelectables(search, toolListWindow.FGTilesets.OrderBy((s) => s), (item) => { if (ImGui.Selectable(item, ToolManager.FGTileset == toolListWindow.FGTilesets.IndexOf(item))) { ToolManager.FGTileset = toolListWindow.FGTilesets.IndexOf(item); } }); ImGui.ListBoxFooter(); } } }
public override void RenderGUI() { ImGui.Text("Entities"); ImGui.SetNextItemWidth(235f); string search = MapEditor.Instance.ToolListWindow.Searches[GetSearchGroup()]; var toolListWindow = MapEditor.Instance.ToolListWindow; SelectedEntity ??= EntityRegistry.EntityPlacements[0]; PlacementNames ??= EntityRegistry.EntityPlacements.ConvertAll((p) => p.Name).OrderBy((p) => p).ToList(); if (ImGui.ListBoxHeader("EntitiesList", EntityRegistry.EntityPlacements.Count, MapEditor.Instance.ToolListWindow.VisibleItemsCount)) { WindowToolList.CreateSelectables(search, PlacementNames, (item) => { if (ImGui.Selectable(item, SelectedEntity.Name == item)) { SelectedEntity = EntityRegistry.EntityPlacements.Find((p) => p.Name == item); UpdateHeldEntity(); } }); } }