public override void OnEnter() { // Clear the input queue... cause other states aren't using it and it's been filling up. DwarfGame.GumInputMapper.GetInputQueue(); GuiRoot = new Gui.Root(DwarfGame.GuiSkin); GuiRoot.MousePointer = new Gui.MousePointer("mouse", 4, 0); MakeMenu(); Progress = GuiRoot.RootItem.AddChild(new Gui.Widgets.ProgressBar { Rect = new Rectangle(0, 0, GuiRoot.RenderData.VirtualScreen.Width, 32) }) as Gui.Widgets.ProgressBar; Dictionary <GameMaster.ToolMode, Gui.Widget> ToolbarItems = new Dictionary <GameMaster.ToolMode, Gui.Widget>(); //ToolbarItems[GameMaster.ToolMode.SelectUnits] = CreateIcon(5, GameMaster.ToolMode.SelectUnits); // ToolbarItems[GameMaster.ToolMode.Dig] = CreateIcon(0, GameMaster.ToolMode.Dig); // ToolbarItems[GameMaster.ToolMode.Build] = CreateIcon(2, GameMaster.ToolMode.Build); // ToolbarItems[GameMaster.ToolMode.Cook] = CreateIcon(3, GameMaster.ToolMode.Cook); // ToolbarItems[GameMaster.ToolMode.Farm] = CreateIcon(5, GameMaster.ToolMode.Farm); // ToolbarItems[GameMaster.ToolMode.Magic] = CreateIcon(6, GameMaster.ToolMode.Magic); // ToolbarItems[GameMaster.ToolMode.Gather] = CreateIcon(6, GameMaster.ToolMode.Gather); // ToolbarItems[GameMaster.ToolMode.Chop] = CreateIcon(1, GameMaster.ToolMode.Chop); // ToolbarItems[GameMaster.ToolMode.Guard] = CreateIcon(4, GameMaster.ToolMode.Guard); // ToolbarItems[GameMaster.ToolMode.Attack] = CreateIcon(3, GameMaster.ToolMode.Attack); var roomIcons = GuiRoot.GetTileSheet("rooms") as Gui.TileSheet; RoomLibrary.InitializeStatics(); var Tilesheet = AssetManager.GetContentTexture(ContentPaths.Terrain.terrain_tiles); VoxelLibrary.InitializeDefaultLibrary(Game.GraphicsDevice); var bottomRightTray = GuiRoot.RootItem.AddChild(new Gui.Widgets.ToolTray.Tray { IsRootTray = true, Corners = Gui.Scale9Corners.Left | Gui.Scale9Corners.Top, AutoLayout = Gui.AutoLayout.FloatBottom, ItemSource = new Gui.Widget[] { new Gui.Widgets.ToolTray.Icon { Icon = new TileReference("tool-icons", 5), KeepChildVisible = true, ExpansionChild = new Gui.Widgets.ToolTray.Tray { ItemSource = RoomLibrary.GetRoomTypes().Select(name => RoomLibrary.GetData(name)) .Select(data => new Gui.Widgets.ToolTray.Icon { Icon = data.NewIcon, ExpansionChild = new Gui.Widgets.BuildRoomInfo { Data = data, Rect = new Rectangle(0, 0, 256, 128) }, OnClick = (sender, args) => { (sender as Gui.Widgets.FramedIcon).Enabled = false; } }) } }, new Gui.Widgets.ToolTray.Icon { Icon = new TileReference("tool-icons", 6), KeepChildVisible = true, ExpansionChild = new Gui.Widgets.ToolTray.Tray { ItemSource = VoxelLibrary.GetTypes().Where(voxel => voxel.IsBuildable) .Select(data => new Gui.Widgets.ToolTray.Icon { Icon = new TileReference("rooms", 0), ExpansionChild = new Gui.Widgets.BuildWallInfo { Data = data, Rect = new Rectangle(0, 0, 256, 128) } }) } } } }); bottomRightTray.Hidden = false; GuiRoot.RootItem.Layout(); IsInitialized = true; base.OnEnter(); }