public VerbCategoryButton(VerbSystem system, VerbCategory category, IEnumerable <Verb> verbs, VerbType type, EntityUid target, bool?drawOnlyIcons = null) : base() { _system = system; _drawOnlyIcons = drawOnlyIcons ?? category.IconsOnly; MouseFilter = MouseFilterMode.Stop; // Contents of the button stored in this box container var box = new BoxContainer() { Orientation = LayoutOrientation.Horizontal }; // First we add the icon for the verb group var icon = new TextureRect { MinSize = (ContextMenuPopup.ButtonHeight, ContextMenuPopup.ButtonHeight), TextureScale = (0.5f, 0.5f), Stretch = TextureRect.StretchMode.KeepCentered, }; if (category.Icon != null) { icon.Texture = category.Icon.Frame0(); } box.AddChild(icon); // Some padding before the text box.AddChild(new Control { MinSize = (4, ContextMenuPopup.ButtonHeight) });
public ContextMenuPresenter(VerbSystem verbSystem) { IoCManager.InjectDependencies(this); _verbSystem = verbSystem; _contextMenuView = new ContextMenuView(); _contextMenuView.OnKeyBindDownSingle += OnKeyBindDownSingle; _contextMenuView.OnMouseEnteredSingle += OnMouseEnteredSingle; _contextMenuView.OnMouseExitedSingle += OnMouseExitedSingle; _contextMenuView.OnMouseHoveringSingle += OnMouseHoveringSingle; _contextMenuView.OnKeyBindDownStack += OnKeyBindDownStack; _contextMenuView.OnMouseEnteredStack += OnMouseEnteredStack; _contextMenuView.OnExitedTree += OnExitedTree; _contextMenuView.OnCloseRootMenu += OnCloseRootMenu; _contextMenuView.OnCloseChildMenu += OnCloseChildMenu; _cfg.OnValueChanged(CCVars.ContextMenuGroupingType, _contextMenuView.OnGroupingContextMenuChanged, true); CommandBinds.Builder .Bind(ContentKeyFunctions.OpenContextMenu, new PointerInputCmdHandler(HandleOpenContextMenu)) .Register <ContextMenuPresenter>(); }
public ContextMenuPresenter(VerbSystem verbSystem) { IoCManager.InjectDependencies(this); _verbSystem = verbSystem; _verbSystem.ToggleContextMenu += SystemOnToggleContextMenu; _verbSystem.ToggleContainerVisibility += SystemOnToggleContainerVisibility; _contextMenuView = new ContextMenuView(); _contextMenuView.OnKeyBindDownSingle += OnKeyBindDownSingle; _contextMenuView.OnMouseEnteredSingle += OnMouseEnteredSingle; _contextMenuView.OnMouseExitedSingle += OnMouseExitedSingle; _contextMenuView.OnMouseHoveringSingle += OnMouseHoveringSingle; _contextMenuView.OnKeyBindDownStack += OnKeyBindDownStack; _contextMenuView.OnMouseEnteredStack += OnMouseEnteredStack; _contextMenuView.OnExitedTree += OnExitedTree; _contextMenuView.OnCloseRootMenu += OnCloseRootMenu; _contextMenuView.OnCloseChildMenu += OnCloseChildMenu; _cfg.OnValueChanged(CCVars.ContextMenuGroupingType, _contextMenuView.OnGroupingContextMenuChanged, true); }