private void MakeMenuItem(Gum.Widget Menu, string Name, string Tooltip, Action <Gum.Widget, Gum.InputEventArgs> OnClick) { Menu.AddChild(new Gum.Widget { AutoLayout = Gum.AutoLayout.DockTop, Border = "border-thin", Text = Name, OnClick = OnClick, Tooltip = Tooltip, TextHorizontalAlign = Gum.HorizontalAlign.Center, TextVerticalAlign = Gum.VerticalAlign.Center }); }
public override void Construct() { Border = "border-dark"; MinimumSize = new Point(128, 40); Padding = new Gum.Margin(2, 2, 4, 4); Font = "font2x"; TimeLabel = AddChild(new Gum.Widget { AutoLayout = Gum.AutoLayout.DockLeft, MinimumSize = new Point(16, 0), Text = "1x", Tooltip = "Current Game Speed", TextVerticalAlign = Gum.VerticalAlign.Center, TextColor = new Vector4(1, 1, 1, 1) }); PlayPauseButton = AddChild(new Gum.Widget { AutoLayout = Gum.AutoLayout.DockLeft, Border = "border-thin", Text = "||", Tooltip = "Pause", OnClick = (sender, args) => { if (CurrentSpeed == 0) { if (PlaySpeed == 0) { PlaySpeed = 1; } CurrentSpeed = PlaySpeed; } else { PlaySpeed = CurrentSpeed; CurrentSpeed = 0; } }, TextVerticalAlign = Gum.VerticalAlign.Center }); AddChild(new Gum.Widget { AutoLayout = Gum.AutoLayout.DockLeft, Text = ">>", Border = "border-thin", Tooltip = "Increase Speed", OnClick = (sender, args) => { CurrentSpeed += 1; }, TextVerticalAlign = Gum.VerticalAlign.Center }); AddChild(new Gum.Widget { AutoLayout = Gum.AutoLayout.DockLeft, Text = "<<", Border = "border-thin", Tooltip = "Decrease Speed", OnClick = (sender, args) => { CurrentSpeed -= 1; }, TextVerticalAlign = Gum.VerticalAlign.Center }); base.Construct(); }
public override void OnEnter() { IsInitialized = true; IndicatorManager.SetupStandards(); // TODO: Had to copy static state over from DwarfGame here. Shouldn't be necessary. // instead these functions should be instantiated inside LoadState. World = new WorldManager(Game) { WorldOrigin = Settings.WorldOrigin, WorldScale = Settings.WorldScale, WorldSize = Settings.ColonySize, InitialEmbark = Settings.InitalEmbarkment, ExistingFile = Settings.ExistingFile, SeaLevel = Settings.SeaLevel, Natives = Settings.Natives }; World.WorldScale = Settings.WorldScale; World.WorldGenerationOrigin = Settings.WorldGenerationOrigin; World.OnLoadedEvent += World_OnLoadedEvent; // Todo - Save gui creation for play state. We're only creating it here so we can give it to // the world class. The world doesn't need it until after loading. GUI = new DwarfGUI(Game, Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input); GUI.ToolTipManager.InfoLocation = new Point(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height); GUI.MouseMode = GUISkin.MousePointer.Pointer; World.Setup(GUI); DwarfGame.GumInputMapper.GetInputQueue(); GuiRoot = new Gum.Root(new Point(640, 480), DwarfGame.GumSkin); Tip = GuiRoot.RootItem.AddChild(new Gum.Widget { Font = "outline-font", TextColor = new Vector4(1, 1, 1, 1), MinimumSize = new Point(0, 128), TextHorizontalAlign = Gum.HorizontalAlign.Center, TextVerticalAlign = Gum.VerticalAlign.Center, Text = "Press any key to jump!", AutoLayout = Gum.AutoLayout.DockBottom }); LoadTicker = GuiRoot.RootItem.AddChild(new NewGui.InfoTicker { Font = "outline-font", AutoLayout = Gum.AutoLayout.DockFill, TextColor = new Vector4(1, 1, 1, 1) }) as NewGui.InfoTicker; World.OnSetLoadingMessage = (s) => LoadTicker.AddMessage(s); GuiRoot.RootItem.Layout(); base.OnEnter(); }