/// <summary>Populate the window using UIBuilder of the window panel.</summary> /// <param name="builder">The root builder of this window.</param> public void SetupControls(UBuilder builder, SpeedLimitsTool parentTool) { this.parentTool_ = parentTool; // "Speed Limits - Kilometers per Hour" // "Showing speed limit overrides per road segment." // [ Lane/Segment ] [ 10 20 30 40 50 ... 120 130 140 Max Reset] // [ Edit Default ] | | | | | | | | | | | | // [_MPH/KM_______] [___+__+__+__+__+...+___+___+___+___+_____] // Goes first on top of the window SetupControls_TitleBar(builder); // Vertical panel goes under the titlebar SetupControls_ModeButtons(builder); // Text below for "Current mode: " and "Hold Alt, hold Shift, etc..." modeDescriptionWrapPanel_ = builder.Panel <ModeDescriptionPanel>( parent: this, stack: UStackMode.None); modeDescriptionWrapPanel_.SetupControls(window: this, builder, parentTool); // Palette: Goes right of the modebuttons panel palettePanel_ = builder.Panel <PalettePanel>( parent: this, stack: UStackMode.None); palettePanel_.SetupControls(window: this, builder, parentTool); // palette was built for the current configured MPH/KM display this.DisplaySpeedLimitsMph = GlobalConfig.Instance.Main.DisplaySpeedLimitsMph; cursorTooltip_ = builder.Label <UFloatingTooltip>( parent: this, t: string.Empty, stack: UStackMode.None); // this will hide it, and update it after setup is done cursorTooltip_.SetTooltip(t: null, show: false); this.gameObject.AddComponent <CustomKeyHandler>(); // Force buttons resize and show the current speed limit on the palette this.UpdatePaletteButtonsOnClick(); this.FocusWindow(); }
/// <summary>Create mode buttons panel on the left side.</summary> /// <param name="builder">The UI builder to use.</param> private void SetupControls_ModeButtons(UBuilder builder) { modeButtonsPanel_ = builder.Panel <ModeButtonsPanel>(parent: this); modeButtonsPanel_.SetupControls(window: this, builder); }