public override void Construct() { Border = "border-thin"; var selectorPanel = AddChild(new Widget { AutoLayout = AutoLayout.DockLeft, MinimumSize = new Point(128, 0) }); ExplorationBox = selectorPanel.AddChild(new Gui.Widgets.CheckBox { AutoLayout = AutoLayout.DockTop, Text = "Exploration", OnCheckStateChange = (sender) => SetTickerSector() }) as Gui.Widgets.CheckBox; MilitaryBox = selectorPanel.AddChild(new Gui.Widgets.CheckBox { AutoLayout = AutoLayout.DockTop, Text = "Military", OnCheckStateChange = (sender) => SetTickerSector() }) as Gui.Widgets.CheckBox; ManufacturingBox = selectorPanel.AddChild(new Gui.Widgets.CheckBox { AutoLayout = AutoLayout.DockTop, Text = "Manufacturing", OnCheckStateChange = (sender) => SetTickerSector() }) as Gui.Widgets.CheckBox; MagicBox = selectorPanel.AddChild(new Gui.Widgets.CheckBox { AutoLayout = AutoLayout.DockTop, Text = "Magic", OnCheckStateChange = (sender) => SetTickerSector() }) as Gui.Widgets.CheckBox; FinanceBox = selectorPanel.AddChild(new Gui.Widgets.CheckBox { AutoLayout = AutoLayout.DockTop, Text = "Finance", OnCheckStateChange = (sender) => SetTickerSector() }) as Gui.Widgets.CheckBox; Ticker = AddChild(new StockTicker { AutoLayout = AutoLayout.DockFill, Economy = Economy, SelectedSectors = Company.Sector.None }) as StockTicker; }
public override void Construct() { //Set size and center on screen. Rect = new Rectangle(0, 0, 450, 300); Border = "border-fancy"; Text = Message == null || String.IsNullOrEmpty(Message.Title) ? "Tutorial" : Message.Title; Font = "font16"; InteriorMargin = new Margin(20, 0, 0, 0); AddChild(new Button { Text = "Dismiss", Font = "font16", TextHorizontalAlign = HorizontalAlign.Center, TextVerticalAlign = VerticalAlign.Center, Border = "border-button", OnClick = (sender, args) => { this.Close(); SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_window_close, 0.15f); }, AutoLayout = AutoLayout.FloatBottomRight, ChangeColorOnHover = true, }); DisableBox = AddChild(new Gui.Widgets.CheckBox { Text = "Disable tutorial", ChangeColorOnHover = true, Font = "font8", AutoLayout = AutoLayout.FloatBottomLeft }) as Gui.Widgets.CheckBox; AddChild(new Widget { Text = Message == null ? "" : Message.Text, Font = "font10", AutoLayout = AutoLayout.DockFill, OnLayout = (sender) => sender.Rect.Height -= 30 }); Layout(); }
public override void OnEnter() { if (SuppressEnter) { SuppressEnter = false; return; } DwarfGame.GumInputMapper.GetInputQueue(); #region Setup GUI GuiRoot = new Gui.Root(DwarfGame.GuiSkin); GuiRoot.MousePointer = new MousePointer("mouse", 15.0f, 16, 17, 18, 19, 20, 21, 22, 23); MainPanel = GuiRoot.RootItem.AddChild(new Gui.Widget { Rect = GuiRoot.RenderData.VirtualScreen, Border = "border-fancy", Text = Settings.Name, Font = "font16", TextColor = new Vector4(0, 0, 0, 1), Padding = new Margin(4, 4, 4, 4), InteriorMargin = new Margin(24, 0, 0, 0) }); var rightPanel = MainPanel.AddChild(new Widget { MinimumSize = new Point(256, 0), Padding = new Margin(2, 2, 2, 2), AutoLayout = AutoLayout.DockRight }); rightPanel.AddChild(new Gui.Widget { Text = "Back", Border = "border-button", ChangeColorOnHover = true, TextColor = new Vector4(0, 0, 0, 1), Font = "font16", AutoLayout = Gui.AutoLayout.DockTop, OnClick = (sender, args) => { GameStateManager.PopState(); } }); rightPanel.AddChild(new Widget { Text = "Factions", Border = "border-button", ChangeColorOnHover = true, TextColor = new Vector4(0, 0, 0, 1), Font = "font16", AutoLayout = AutoLayout.DockTop, OnClick = (sender, args) => { SuppressEnter = true; GameStateManager.PushState(new FactionViewState(GameState.Game, Settings)); } }); switch (PanelState) { case PanelStates.Generate: RightPanel = rightPanel.AddChild(new GenerationPanel(Game, Settings) { RestartGeneration = () => RestartGeneration(), GetGenerator = () => Generator, OnVerified = () => { SwitchToLaunchPanel(); }, AutoLayout = Gui.AutoLayout.DockFill, }); break; case PanelStates.Launch: RightPanel = rightPanel.AddChild(new LaunchPanel(Game, Generator, Settings, this) { AutoLayout = AutoLayout.DockFill, }); break; } GenerationProgress = MainPanel.AddChild(new Gui.Widgets.ProgressBar { AutoLayout = Gui.AutoLayout.DockBottom, TextHorizontalAlign = Gui.HorizontalAlign.Center, TextVerticalAlign = Gui.VerticalAlign.Center, Font = "font10", TextColor = new Vector4(1, 1, 1, 1) }) as Gui.Widgets.ProgressBar; PoliticsToggle = MainPanel.AddChild(new Gui.Widgets.CheckBox { Text = "Show Political Boundaries", Hidden = true, OnLayout = (sender) => { sender.Rect = GenerationProgress.Rect; }, OnCheckStateChange = (sender) => { Preview.ShowPolitics = (sender as Gui.Widgets.CheckBox).CheckState; } }) as Gui.Widgets.CheckBox; Preview = MainPanel.AddChild(new WorldGeneratorPreview(Game.GraphicsDevice) { Border = "border-thin", AutoLayout = Gui.AutoLayout.DockFill, Overworld = Settings, Hidden = true, OnLayout = (sender) => { //sender.Rect = new Rectangle(sender.Rect.X, sender.Rect.Y, sender.Rect.Width, GenerationProgress.Rect.Bottom - sender.Rect.Y); }, OnCellSelectionMade = () => { if (RightPanel is LaunchPanel launch) { launch.UpdateCellInfo(); } } }) as WorldGeneratorPreview;
public override void Construct() { //Set size and center on screen. Rect = new Rectangle(0, 0, 450, 300); Border = "border-fancy"; Text = Message == null || String.IsNullOrEmpty(Message.Title) ? "Tutorial" : Message.Title; Font = "font16"; InteriorMargin = new Margin(20, 0, 0, 0); if (!String.IsNullOrEmpty(Message.Name) && AssetManager.DoesTextureExist("newgui\\tutorials\\" + Message.Name)) { var asset = "newgui\\tutorials\\" + Message.Name; AddChild(new GameStates.TutorialIcon() { ImageSource = asset, MinimumSize = new Point(256, 128), MaximumSize = new Point(256, 128), AutoLayout = AutoLayout.DockTop }); Rect = new Rectangle(0, 0, 450, 450); InteriorMargin = new Margin(32, 0, 0, 0); } else if (Message.Icon != null) { AddChild(new Widget() { Background = Message.Icon, MinimumSize = new Point(128, 128), MaximumSize = new Point(128, 128), AutoLayout = AutoLayout.DockTop }); Rect = new Rectangle(0, 0, 450, 450); InteriorMargin = new Margin(32, 0, 0, 0); } AddChild(new Button { Text = "Dismiss", Font = "font16", TextHorizontalAlign = HorizontalAlign.Center, TextVerticalAlign = VerticalAlign.Center, Border = "border-button", OnClick = (sender, args) => { this.Close(); SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_window_close, 0.15f); }, AutoLayout = AutoLayout.FloatBottomRight, ChangeColorOnHover = true, }); DisableBox = AddChild(new Gui.Widgets.CheckBox { Text = "Disable tutorial", ChangeColorOnHover = true, Font = "font8", AutoLayout = AutoLayout.FloatBottomLeft }) as Gui.Widgets.CheckBox; AddChild(new Widget { Text = Message == null ? "" : "\n" + Message.Text, Font = "font10", AutoLayout = AutoLayout.DockTop }); Layout(); }