public void MakeMenu() { GuiRoot.RootItem.Clear(); var frame = MakeMenuFrame("GUI DEBUG"); MakeMenuItem(frame, "View Atlas \u00DF", "", (sender, args) => { var pane = GuiRoot.ConstructWidget(new ShowTextureDialog()); GuiRoot.ShowDialog(pane); GuiRoot.RootItem.Layout(); }); MakeMenuItem(frame, "BACK", "Goodbye.", (sender, args) => StateManager.PopState()); }
public override void OnEnter() { DwarfGame.GumInputMapper.GetInputQueue(); World.Tutorial("trade_screen"); GuiRoot = new Gui.Root(DwarfGame.GuiSkin); GuiRoot.MousePointer = new Gui.MousePointer("mouse", 4, 0); GuiRoot.RootItem.Font = "font8"; TradePanel = GuiRoot.ConstructWidget(new Gui.Widgets.TradePanel { Rect = GuiRoot.RenderData.VirtualScreen, Envoy = new Trade.EnvoyTradeEntity(Envoy), Player = new Trade.PlayerTradeEntity(PlayerFaction), }) as Gui.Widgets.TradePanel; TradePanel.Layout(); GuiRoot.ShowDialog(TradePanel); IsInitialized = true; base.OnEnter(); }
private void CreateGameplayTab() { var panel = TabPanel.AddTab("GAMEPLAY", new Widget { Border = "border-thin", Padding = new Margin(4, 4, 0, 0) }); panel.AddChild(new Widget { Text = "Restore default settings", MinimumSize = new Point(0, 20), AutoLayout = AutoLayout.DockTop, Padding = new Margin(0, 0, 4, 4), Border = "border-button", ChangeColorOnHover = true, OnClick = (sender, args) => { var prompt = GuiRoot.ConstructWidget(new Gui.Widgets.Confirm { Text = "Set all settings to their default?", OnClose = (confirm) => { if ((confirm as Gui.Widgets.Confirm).DialogResult == Gui.Widgets.Confirm.Result.OKAY) { GameSettings.Default = new GameSettings.Settings(); RebuildGui(); ConfirmSettings(); } } }); GuiRoot.ShowDialog(prompt); } }); // Todo: Display actual value beside slider. MoveSpeed = panel.AddChild(LabelAndDockWidget("Camera Move Speed", new HorizontalFloatSlider { ScrollArea = 20, OnSliderChanged = OnItemChanged, Tooltip = "Sensitivity of the camera to the movement keys" })).GetChild(1) as HorizontalFloatSlider; ZoomSpeed = panel.AddChild(LabelAndDockWidget("Camera Zoom Speed", new HorizontalFloatSlider { ScrollArea = 2, OnSliderChanged = OnItemChanged, Tooltip = "Sensitivity of the camera to zooming" })).GetChild(1) as HorizontalFloatSlider; InvertZoom = panel.AddChild(new CheckBox { Text = "Invert Zoom", Tooltip = "When checked, zooming in/out with the scroll wheel will be inverted", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; ZoomTowardMouse = panel.AddChild(new CheckBox { Text = "Zoom to Mouse", Tooltip = "When checked, when you zoom in, you will zoom toward the mouse.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; EdgeScrolling = panel.AddChild(new CheckBox { Text = "Edge Scrolling", Tooltip = "When checked, moving the cursor to the edge of the screen will move the camera.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; FollowSurface = panel.AddChild(new CheckBox { Text = "Camera Follows Surface Height", Tooltip = "When checked, the camera will follow the ground surface height when moving.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; PlayIntro = panel.AddChild(new CheckBox { Text = "Play Intro", Tooltip = "When checked, the intro animation will play at the beginning of the game.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; FogOfWar = panel.AddChild(new CheckBox { Text = "Fog Of War", Tooltip = "When checked, unexplored tiles underground will be invisible.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; var guiScaleItems = new List <String>(); for (int i = 1; i < 10; ++i) { if (i * 480 <= GameSettings.Default.ResolutionY) { guiScaleItems.Add(i.ToString()); } } GuiScale = panel.AddChild(LabelAndDockWidget("Gui Scale", new ComboBox { Items = guiScaleItems })).GetChild(1) as ComboBox; GuiAutoScale = panel.AddChild(new CheckBox { Text = "Autoscale GUI", Tooltip = "When checked, the GUI will get scaled up on high resolution screens", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; DisableTutorialForAllGames = panel.AddChild(new CheckBox { Text = "Disable the tutorial for all new games", Tooltip = "When checked, the tutorial will not open in new games.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; if (World != null) { EnableTutorial = panel.AddChild(new CheckBox { Text = "Enable Tutorial", Tooltip = "When checked, tutorial will be displayed.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; panel.AddChild(new Widget { Text = "Reset tutorial", MinimumSize = new Point(0, 20), AutoLayout = AutoLayout.DockTop, Padding = new Margin(0, 0, 4, 4), Border = "border-button", ChangeColorOnHover = true, OnClick = (sender, args) => World.TutorialManager.ResetTutorials() }); } Autosave = panel.AddChild(new CheckBox { Text = "Enable Autosave", Tooltip = "When checked, game will auto save.", OnCheckStateChange = OnItemChanged, AutoLayout = AutoLayout.DockTop }) as CheckBox; AutoSaveFrequency = panel.AddChild(LabelAndDockWidget("Autosave Frequency ", new HorizontalSlider { ScrollArea = 115, OnSliderChanged = (widget) => { AutoSaveFrequency.GetChild(0).Text = String.Format("Autosave Frequency ({0})", (widget as HorizontalSlider).ScrollPosition + 5); this.OnItemChanged(widget); }, Tooltip = "Minutes between auto saves" })); SaveLocation = panel.AddChild(LabelAndDockWidget("Save Location", new EditableTextField { Tooltip = "Where to look for save games. Leave blank to use default location.", Text = "", OnTextChange = this.OnItemChanged })).GetChild(1) as EditableTextField; }