public void ConfigureGUI(WorkbenchPane pane) { pane.SetRecipes(bench.proto.def.recipes, recipe => { AddOrder(recipe); ConfigureGUI(pane); }); pane.ShowOrders(orders.Count); for (int i = 0; i < orders.Count; ++i) { Order order = orders[i]; pane.ConfigureButton(i, order.recipe.description, $"x{order.amtOrdered}", () => { order.amtOrdered++; ConfigureGUI(pane); }); } }
public GameUI(GameController ctrl) { this.ctrl = ctrl; root = new GameObject("GUI").transform; canvas = CreateCanvas(root.transform, new Vec2I(1920, 1080)); CreateInputSink(); dragOutline = ctrl.assets.CreateLine( root.transform, "Drag Outline", RenderLayer.Highlight.Layer(1), Color.white, 1, true, true); dragOutline.enabled = false; Color color = ToolbarButton.offColor; toolbarContainer = Gui.CreateObject(canvas, "Toolbar"); toolbarContainer.SetFill(); buildButton = CreateToolbarButton( "Build Button", new Vec2(420, 0)); buildButton.Configure( () => ctrl.OnBuildMenu(), GetSprite("BB:BuildIcon"), "Build", true); orderButton = CreateToolbarButton( "Orders Button", new Vec2(420, 110)); orderButton.Configure( () => ctrl.OnOrdersMenu(), GetSprite("BB:MineIcon"), "Orders", true); Font font = ctrl.assets.fonts.Get("Arial.ttf"); infoPane = new InfoPane(canvas, font); playButtonContainer = Gui.CreateObject(canvas, "Speed Controls"); playButtonContainer.SetFill(); pauseButton = new ToolbarButton( playButtonContainer, "Pause", Anchor.TopLeft, new Vec2(10, 10), new Vec2(38, 38), 4, font); pauseButton.Configure( () => ctrl.OnSpeedChange(PlaySpeed.Paused), GetSprite("BB:PauseIcon")); playButton = new ToolbarButton( playButtonContainer, "Play", Anchor.TopLeft, new Vec2(52, 10), new Vec2(38, 38), 6, font); playButton.Configure( () => ctrl.OnSpeedChange(PlaySpeed.Normal), GetSprite("BB:PlayIcon")); playFFButton = new ToolbarButton( playButtonContainer, "Fast", Anchor.TopLeft, new Vec2(94, 10), new Vec2(51, 38), 6, font); playFFButton.Configure( () => ctrl.OnSpeedChange(PlaySpeed.Fast), GetSprite("BB:PlayFFIcon")); playSFFButton = new ToolbarButton( playButtonContainer, "Super Fast", Anchor.TopLeft, new Vec2(149, 10), new Vec2(77, 38), 6, font); playSFFButton.Configure( () => ctrl.OnSpeedChange(PlaySpeed.SuperFast), GetSprite("BB:PlaySFFIcon")); ctxtMenu = new ContextMenu(canvas, font); workbench = new WorkbenchPane(canvas, font); /* * CreatePane(canvas, "bl", Color.blue, new Vec2(100, 100), Anchor.BottomLeft, new Vec2(20, 20)); * CreatePane(canvas, "bc", Color.blue, new Vec2(100, 100), Anchor.Bottom, new Vec2(20, 20)); * CreatePane(canvas, "br", Color.blue, new Vec2(100, 100), Anchor.BottomRight, new Vec2(20, 20)); * CreatePane(canvas, "cl", Color.blue, new Vec2(100, 100), Anchor.Left, new Vec2(20, 20)); * CreatePane(canvas, "cc", Color.blue, new Vec2(100, 100), Anchor.Center, new Vec2(20, 20)); * CreatePane(canvas, "cr", Color.blue, new Vec2(100, 100), Anchor.Right, new Vec2(20, 20)); * CreatePane(canvas, "tl", Color.blue, new Vec2(100, 100), Anchor.TopLeft, new Vec2(20, 20)); * CreatePane(canvas, "tc", Color.blue, new Vec2(100, 100), Anchor.Top, new Vec2(20, 20)); * CreatePane(canvas, "tr", Color.blue, new Vec2(100, 100), Anchor.TopRight, new Vec2(20, 20));*/ }