Class HotkeyBarLayout
Where a hotkey slot sits among the bars, and which bar a key press belongs to.
public static class HotkeyBarLayout
- Inheritance
-
HotkeyBarLayout
- Inherited Members
Remarks
One flat index. The character's hotkey list, the wire and the database all address a slot by one number and know nothing of bars; a bar is SlotsPerBar consecutive slots (see HotkeySlotsPerBar for why that makes the width, unlike the count, unsafe to change once characters have bindings). Only the client's drawing and its key routing ever think in bars, and both go through here.
Keys are positions, bars are modifiers. The first bar's keys — left and right mouse, then 1 to 0 — name a POSITION on a bar. Which bar a press lands on is decided by the bar modifiers held at the moment of the press: the second bar's (Ctrl by default), the third's (Alt), and so on; with none held, the press lands on the first bar, or on the page a paged hotbar is resting on. So exactly one slot answers any press — there is no binding for "Ctrl+1" that could fire alongside the one for "1" — and rebinding a position key moves it on every bar at once. The rule is ResolvePressBar(int, bool, int) and its press/release pairing is HotkeyPressRouter; both are pure so they can be tested without an input device.
Properties
BarCount
Number of bars the game gives every character.
public static int BarCount { get; }
Property Value
SlotsPerBar
Number of slots on each bar.
public static int SlotsPerBar { get; }
Property Value
Methods
BarOf(int)
The zero-based bar a flat slot index belongs to.
public static int BarOf(int slotIndex)
Parameters
slotIndexint
Returns
PositionOf(int)
The zero-based position on its bar of a flat slot index.
public static int PositionOf(int slotIndex)
Parameters
slotIndexint
Returns
ResolvePressBar(int, bool, int)
The bar a position key pressed now should fire on.
public static int ResolvePressBar(int heldModifierBar, bool paged, int restingPage)
Parameters
heldModifierBarintThe first bar (in bar order, from the second) whose modifier is held, or -1 for none. Bar order is the tie-break when a player holds two: the lower bar wins, deterministically, rather than whichever modifier happened to be pressed last.
pagedboolTrue when the hotbar shows one bar at a time.
restingPageintThe bar a paged hotbar shows while no modifier is held.
Returns
- int
The zero-based bar the press belongs to.
Remarks
A held modifier always wins, in either layout: Ctrl+1 is the second bar's first key whether or not that bar is the page on screen, so a player's hands do not have to know the layout. Without one, a stacked hotbar's unmodified keys are the first bar's — every bar is on screen and the first is the one they belong to — while a paged hotbar's are the resting page's, because that is the bar the player is looking at.
ResolvePressBar(int, bool, int, int)
ResolvePressBar(int, bool, int) for an explicit bar count, so the rule can be tested for several bars in a game that ships one.
public static int ResolvePressBar(int heldModifierBar, bool paged, int restingPage, int barCount)
Parameters
Returns
ResolveShownPage(int, int)
The bar a paged hotbar should show now: the held modifier's, else the resting page.
public static int ResolveShownPage(int heldModifierBar, int restingPage)
Parameters
Returns
Remarks
The same answer ResolvePressBar(int, bool, int) gives a paged hotbar, and deliberately so: the bar on screen is always the bar the next unmodified or modified press will fire.
ResolveShownPage(int, int, int)
ResolveShownPage(int, int) for an explicit bar count.
public static int ResolveShownPage(int heldModifierBar, int restingPage, int barCount)
Parameters
Returns
SlotIndex(int, int)
The flat slot index of a position on a bar.
public static int SlotIndex(int bar, int position)
Parameters
Returns
StepPage(int, int)
The next resting page when paging by delta, wrapping at either end.
public static int StepPage(int restingPage, int delta)
Parameters
Returns
StepPage(int, int, int)
StepPage(int, int) for an explicit bar count.
public static int StepPage(int restingPage, int delta, int barCount)