Beispiel #1
0
        /// <summary>
        /// Creates floating tool window for Lane Arrow controls and adds keyboard hints too.
        /// </summary>
        /// <param name="numLanes">How many groups of buttons.</param>
        private void CreateLaneArrowsWindow(int numLanes)
        {
            var parent = UIView.GetAView();

            ToolWindow = (LaneArrowToolWindow)parent.AddUIComponent(typeof(LaneArrowToolWindow));
            ToolWindow.SetOpacity(
                U.UOpacityValue.FromOpacity(0.01f * GlobalConfig.Instance.Main.GuiOpacity));

            RepositionWindowToNode(); // reposition 1st time to avoid visible window jump

            using (var builder = new U.UiBuilder <LaneArrowToolWindow>(ToolWindow)) {
                builder.ResizeFunction(r => { r.FitToChildren(); });
                builder.SetPadding(UConst.UIPADDING);

                ToolWindow.SetupControls(builder, numLanes);

                // On Delete being pressed
                ToolWindow.eventKeyDown += (component, param) => {
                    if (KeybindSettingsBase.LaneConnectorDelete.IsPressed(param))
                    {
                        OnResetToDefaultPressed();
                    }
                };

                // Resize everything correctly
                // builder.Control.SetTransparency(GlobalConfig.Instance.Main.GuiTransparency);
                builder.Done();
                RepositionWindowToNode(); // reposition again 2nd time now that size is known
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates floating tool window for Lane Arrow controls and adds keyboard hints too.
        /// </summary>
        /// <param name="numLanes">How many groups of buttons.</param>
        private void CreateLaneArrowsWindow(int numLanes)
        {
            var parent = UIView.GetAView();

            ToolWindow = (LaneArrowToolWindow)parent.AddUIComponent(typeof(LaneArrowToolWindow));
            ToolWindow.SetOpacity(
                U.UOpacityValue.FromOpacity(0.01f * GlobalConfig.Instance.Main.GuiOpacity));

            RepositionWindowToNode(); // reposition 1st time to avoid visible window jump

            using (var builder = new U.UiBuilder <LaneArrowToolWindow>(ToolWindow)) {
                builder.ResizeFunction(r => { r.FitToChildren(); });
                builder.SetPadding(UConst.UIPADDING);

                ToolWindow.SetupControls(builder, numLanes);

                // Resize everything correctly
                builder.Done();
                RepositionWindowToNode(); // reposition again 2nd time now that size is known
            }
        }