Quickbar Views

NOTE: Quickbar views are an alpha feature. Implementation and recommended usage may change as it moves into beta.

Overview

A follow-up addition to the inventory system was the introduction of the "fractional view" of an underlying "quickbar", allowing us to have different tabs of the same underlying equipment. Consider e.g. where we want two different equipment quickbars we can switch between, each containing 8 slots, or having 3 different types of equipment quickbars, for different types of use item (e.g. emotes, potions, or admin tools). For each of these, we can achieve them by making "views" of the underlying JM_EquipmentComponent's slots, assigning each tab to be a certain number of them (slots 1-8 being for tab 1, 9-16 being for tab 2 and so on). This gives us flexibility to customize how the equipment component is used, without modifying the underlying equipment logic.

The views all extend the M2_InventoryViewComponent, and have a QuickbarClass of the quickbar they are a sub-view of (e.g. JM_EquipmentComponent). They are created via the M2_InventoryViewManagerComponent, present on your morpheus character.

Integration

Live config

The following flags are important for controlling usage of this new system, vs the old approach of using e.g. your quickbar directly:

  • Inventory.Quickbar.UsingEquipmentTabs: If true, the fractional views will be created and used to subdivide the underlying equipment. (The name of this flag is controlled by the ViewsEnabledConfig variable in your InventoryViewManagerComponent)

  • Each tab has a MaxSlotsOverrideConfigName which is used to modify how many slots each tab can have. E.g.

    • Inventory.Quickbar.GadgetTabSlots: The number of slots for the "Equip" tab (BPC_EquipmentQuickbarTab)

    • Inventory.Quickbar.EmoteTabSlots: The number of slots for the "React" tab (BPC_EquipmentQuickbarTab_Emotes)

    • Inventory.Quickbar.DirectTabSlots: The number of slots for the "Direct" tab (BPC_EquipmentQuickbarTab_Director)

Make sure underlying quickbar has enough slots to contain all your views.

E.g. for equipment views, you will need to make sure your Inventory.MaxEquipmentSlots value is at least as large as the combined values of e.g. GadgetTabSlots, DirectTabSlots and EmoteTabSlots

Making new quickbar views

If you want to make a new view, you can do the following:

  • Create a new class extending at least M2_InventoryViewComponent

    • If the view is of your equipment (i.e. you are using "use items"/"gadgets"), you can use BPC_EquipmentQuickbarTab as a base with some sensible defaults as a starting point.

  • Configure its important methods and properties:

    • QuickbarClass - the class of the quickbar we're wanting to view, e.g. JM_EquipmentComponent.

    • DesiredMaxSlots - how many slots you want your tab to have.

    • MaxSlotsOverrideConfigName - if you want to override the above using live config.

    • CanAutoAssignToView - if the Inventory.AutoEquipItems live config flag is true, then items can be automatically added to this view/tab once added to your inventory.

      • If the same item can be added to multiple tabs/views, it will add them in the order of the views in the M2_InventoryViewManagerComponent)

    • IsItemValidForQuickbar - a method to override if you want your quickbar to use a specific type of item.

NOTE: Currently you can only obtain information about the item that can be obtained before loading the item, e.g. its name and what custom details it has. (The actual values of the custom details would require loading, so aren't accessible).

E.g. we have the BPC_EquipmentQuickbarTab_Emotes, which is a sub-view of our equipment (JM_EquipmentComponent), but modifies the IsValidForQuickbar method to only support item gadgets

Adding your new view

  • Add your view to the InventoryViewClasses list, in your M2_InventoryViewManagerComponent

    • (The order they are added will be the order that the slots take on the underlying quickbar component, and will affect e.g. which slots are being auto-equipped to.

NOTE: If you have more slots than are available in the underlying quickbar component, the quickbar will fail to be added.

  • Make a tab that uses your view, and add it to your tab manager

    • Set the QuickbarViewClass to be the new view you added

How to use Quickbar Views

How to get the relevant quickbar views

  • To get a quickbar view, the best approach is to go through the quickbar manager.

    • You can listen to when the views have all been set up using the WaitForViewManager

      • (This takes the Actor we expect the view manager to be on)

      • This handles any race conditions with respect to the views being created.

  • Then you can search for the relevant views using the following helpers:

    • GetViewByClass - takes the exact view class (e.g. BPC_EquipmentQuickbarTab_Emotes), and finds the relevant view component that matches exactly

    • GetViewsByParentClass - takes a view class, and finds all classes that extend from that. (e.g. you can provide M2_EquipmentViewComponent to return all the equipment views)

    • GetViewsOfQuickbar - takes an underlying quickbar class (e.g. JM_EquipmentComponent) and returns all views of that quickbar

Setting tab-specific starting items

  • When adding entries to the map, the key is the class, e.g. BPC_EquipmentQuickbarTab_Director

  • Each entry has an ItemList, of items that we want to be added to that view.

    • (If the item isn't valid for that specific view, it will fail to be added)

  • The entry also has a AddIfViewsDisabled flag. If true, then if views are disabled (via the Inventory.Quickbar.UsingEquipmentTabs flag), the item will still be added, and will be equipped to the underlying quickbar (e.g. JM_EquipmentComponent). Otherwise, the items will be ignored if not using views.

Auto-equipping to tabs

Outside of the role starting items, if you want items to be automatically equipped to tabs once added to your inventory or not, you can use the CanAutoAssignToView property.

This requires the Inventory.AutoEquipItems live config flag to be true.

If the same item can be added to multiple tabs/views, it will add them in the order of the views in the M2_InventoryViewManagerComponent)

Last updated