4 using Vintagestory.API.Client;
5 using Vintagestory.API.Common;
9 public class AutomapGUIDialog : GuiDialog
11 public const string _automapControlPanelKey = "automapControlPanelKey";
13 private ILogger Logger;
14 private AutomapSystem _automapSystem;
16 public override string ToggleKeyCombinationCode {
19 return _automapControlPanelKey;
23 public AutomapGUIDialog(ICoreClientAPI capi,AutomapSystem ams) : base(capi)
30 //Event for GUI status display
32 private void SetupDialog( )
34 ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog.WithAlignment(EnumDialogArea.CenterMiddle);
36 ElementBounds textBounds = ElementBounds.Fixed(0, 40, 500, 300);
38 ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);
39 bgBounds.BothSizing = ElementSizing.FitToChildren;
40 bgBounds.WithChildren(textBounds);
42 ElementBounds toggleBounds = textBounds.CopyOffsetedSibling(3, 26, 5, 2);
43 toggleBounds.fixedHeight = 24;
44 toggleBounds.fixedWidth = 64;
46 ElementBounds txtStatusBounds = textBounds.CopyOffsetedSibling(0, 20, 2, 4);
47 txtStatusBounds.fixedHeight = 16;
48 txtStatusBounds.percentWidth = 1;
51 this.SingleComposer = capi.Gui.CreateCompo("automapControlPanel", dialogBounds)
52 .AddShadedDialogBG(bgBounds)
53 .AddDialogTitleBar("Automap Controls", OnTitleBarCloseClicked)
54 .AddStaticText("Configure Automap settings:", CairoFont.WhiteDetailText( ), textBounds)
55 .AddToggleButton("Run", CairoFont.ButtonText( ), RunToggle, toggleBounds, "btnRun")
56 .AddStaticText("Idle.", CairoFont.WhiteSmallText( ).WithFontSize(12), txtStatusBounds, "txtStatus")
59 //Controls for ALL Block & Entity Designators (Enable/Disable)
60 //_automapSystem.BlockID_Designators
61 //_automapSystem.Entity_Designators
63 //Message verbosity? Speed?
65 //A Button to add POI - notes manually (when AM running)
69 private void OnTitleBarCloseClicked( )
75 /// Toggle Automap from/to RUN state
77 /// <returns>The toggle.</returns>
78 /// <param name="t1">T1.</param>
79 internal void RunToggle(bool toggle)
81 _automapSystem.Enabled = toggle;
82 Logger.VerboseDebug("Dialog Changed; [ Automap Enabled: {0} ]", toggle);
83 var statusText = this.SingleComposer.GetStaticText("txtStatus");
84 statusText.SetValue($"Running: {this._automapSystem.Enabled}, Total: {this._automapSystem.updatedChunksTotal}, Nulls: {this._automapSystem.nullChunkCount} " );