public ActionMenuItem(ActionsUI actionsUI, ActionType action, Action <ActionMenuItem> onControlFocusExited) { _actionsUI = actionsUI; Action = action; _onControlFocusExited = onControlFocusExited; SetSize = (64, 64); VerticalAlignment = VAlignment.Top; _bigActionIcon = new TextureRect { HorizontalExpand = true, VerticalExpand = true, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _bigItemSpriteView = new SpriteView { HorizontalExpand = true, VerticalExpand = true, Scale = (2, 2), Visible = false, OverrideDirection = Direction.South, }; _smallActionIcon = new TextureRect { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _smallItemSpriteView = new SpriteView { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Visible = false, OverrideDirection = Direction.South, }; // padding to the left of the small icon var paddingBoxItemIcon = new BoxContainer { Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, VerticalExpand = true, MinSize = (64, 64) }; paddingBoxItemIcon.AddChild(new Control() { MinSize = (32, 32), });
public ActionMenu(ClientActionsComponent actionsComponent, ActionsUI actionsUI) { _actionsComponent = actionsComponent; _actionsUI = actionsUI; _actionManager = IoCManager.Resolve <ActionManager>(); _gameHud = IoCManager.Resolve <IGameHud>(); Title = Loc.GetString("ui-actionmenu-title"); MinSize = (300, 300); Contents.AddChild(new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = { new BoxContainer { Orientation = LayoutOrientation.Horizontal, Children = { (_searchBar = new LineEdit { StyleClasses ={ StyleNano.StyleClassActionSearchBox }, HorizontalExpand = true, PlaceHolder = Loc.GetString("ui-actionmenu-search-bar-placeholder-text") }), (_filterButton = new MultiselectOptionButton <string>() { Label = Loc.GetString("ui-actionmenu-filter-button") }) } }, (_clearButton = new Button { Text = Loc.GetString("ui-actionmenu-clear-button"), }), (_filterLabel = new Label()), new ScrollContainer { //TODO: needed? MinSize = new Vector2(200.0f, 0.0f), VerticalExpand = true, HorizontalExpand = true, Children = { (_resultsGrid = new GridContainer { MaxGridWidth = 300 }) } } } }); // populate filters from search tags var filterTags = new List <string>(); foreach (var action in _actionManager.EnumerateActions()) { filterTags.AddRange(action.Filters); } // special one to filter to only include item actions filterTags.Add(ItemTag); filterTags.Add(NotItemTag); filterTags.Add(InstantActionTag); filterTags.Add(ToggleActionTag); filterTags.Add(TargetActionTag); filterTags.Add(AllActionsTag); filterTags.Add(GrantedActionsTag); foreach (var tag in filterTags.Distinct().OrderBy(tag => tag)) { _filterButton.AddItem(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tag), tag); } UpdateFilterLabel(); _dragShadow = new TextureRect { MinSize = (64, 64), Stretch = TextureRect.StretchMode.Scale, Visible = false, SetSize = (64, 64) }; UserInterfaceManager.PopupRoot.AddChild(_dragShadow); _dragDropHelper = new DragDropHelper <ActionMenuItem>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag); }
public ActionMenu(ActionsUI actionsUI) { _actionsUI = actionsUI; _gameHud = IoCManager.Resolve <IGameHud>(); _entMan = IoCManager.Resolve <IEntityManager>(); Title = Loc.GetString("ui-actionmenu-title"); MinSize = (320, 300); Contents.AddChild(new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = { new BoxContainer { Orientation = LayoutOrientation.Horizontal, Children = { (_searchBar = new LineEdit { StyleClasses ={ StyleNano.StyleClassActionSearchBox }, HorizontalExpand = true, PlaceHolder = Loc.GetString("ui-actionmenu-search-bar-placeholder-text") }), (_filterButton = new MultiselectOptionButton <string>() { Label = Loc.GetString("ui-actionmenu-filter-button") }) } }, (_clearButton = new Button { Text = Loc.GetString("ui-actionmenu-clear-button"), }), (_filterLabel = new Label()), new ScrollContainer { //TODO: needed? MinSize = new Vector2(200.0f, 0.0f), VerticalExpand = true, HorizontalExpand = true, Children = { (_resultsGrid = new GridContainer { MaxGridWidth = 300 }) } } } }); foreach (var tag in _filters) { _filterButton.AddItem(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tag), tag); } // default to showing all actions. _filterButton.SelectKey(AllFilter); UpdateFilterLabel(); _dragShadow = new TextureRect { MinSize = (64, 64), Stretch = TextureRect.StretchMode.Scale, Visible = false, SetSize = (64, 64) }; UserInterfaceManager.PopupRoot.AddChild(_dragShadow); _dragDropHelper = new DragDropHelper <ActionMenuItem>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag); }
/// <summary> /// Creates an action slot for the specified number /// </summary> /// <param name="slotIndex">slot index this corresponds to, 0-9 (0 labeled as 1, 8, labeled "9", 9 labeled as "0".</param> public ActionSlot(ActionsUI actionsUI, ActionMenu actionMenu, byte slotIndex) { _actionsUI = actionsUI; _actionMenu = actionMenu; _gameTiming = IoCManager.Resolve <IGameTiming>(); SlotIndex = slotIndex; MouseFilter = MouseFilterMode.Stop; MinSize = (64, 64); VerticalAlignment = VAlignment.Top; TooltipDelay = CustomTooltipDelay; TooltipSupplier = SupplyTooltip; _number = new RichTextLabel { StyleClasses = { StyleNano.StyleClassHotbarSlotNumber } }; _number.SetMessage(SlotNumberLabel()); _bigActionIcon = new TextureRect { HorizontalExpand = true, VerticalExpand = true, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _bigItemSpriteView = new SpriteView { HorizontalExpand = true, VerticalExpand = true, Scale = (2, 2), Visible = false, OverrideDirection = Direction.South, }; _smallActionIcon = new TextureRect { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Stretch = TextureRect.StretchMode.Scale, Visible = false }; _smallItemSpriteView = new SpriteView { HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Visible = false, OverrideDirection = Direction.South, }; _cooldownGraphic = new CooldownGraphic { Progress = 0, Visible = false }; // padding to the left of the number to shift it right var paddingBox = new BoxContainer { Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, VerticalExpand = true, MinSize = (64, 64) }; paddingBox.AddChild(new Control() { MinSize = (4, 4), });