Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI logic: systems and event handlers #25
UI logic: systems and event handlers #25
Changes from 13 commits
aea9b24
d38773e
f2b24a0
d113006
f2ab84e
97c9da8
c8a0ae9
675d262
165a7c8
a3051e7
0112851
34ae054
693ad78
d9e6288
e53922f
53e8c6a
400423b
da1a1dc
0899b24
5583da4
d275b47
53a177a
115be99
5054d93
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generalizing behavior
gives the example of an ability task bar to show how this will scale to more complicated UIs that can't be defined at compile time.I don't know if I agree with this section because the actual list of behavior I expect from a task bar is something like the following list:
There is not a 1:1 relationship to abilities and slots in the task bar. At lower levels, the player may have fewer abilities than slots. Slots will need to support being "unassigned". At higher levels, the player may have more abilities than slots.
An ability doesn't need to be in the task bar. It should work correctly even when not assigned to a slot.
It's possible for the player to reassign abilities and slots, e.g. by drag'n'dropping. The same slot does not always correspond to the same ability. It may be possible for a player to assign the same ability to multiple slots, or attempting to do that may result in the first assignment being replaced by subsequent assignments.
The player can press a hot key associated with the slot (usually a number key 0-9), or they can click the slot. Either will activate the ability. It may be possible for the number keys to be remapped to other user-defined keys. It may be possible for the player to assign a key directly to an ability without requiring the ability to be in a task bar.
If the ability isn't ready, there will be some audio & visual feedback in response to trying to activate the ability.
There will be visual feedback when an ability is ready to use, on cooldown, and in progress (e.g. wind-up or other animation delays, or backswing on casting). This should work regardless of activation method -- by clicking the task bar, by pressing a hot key for that slot, by pressing an assigned key for the ability, or by selecting the ability out of the player's full list of abilities.
It may be possible to cancel out of the ability after starting it. Cancelling an ability has visual feedback.
The visual feedback for cooldown shows the time remaining in some intuitive way, e.g. a horizontal or radial wipe, or even just seconds counting down until usable again.
Mousing over a slot should show a tool tip displaying the ability description. This may also display contextual information, e.g. if it's on cooldown or if the player character has some status effect preventing the use of the ability. The tool tip does not pop up immediately but only after some time hovering the slot.
Right clicking a slot should bring up a context menu, possibly related to the ability.
The player may be allowed to maintain separate task bar configurations and swap between them (maybe with F1, F2, and so on).
The size of the task bar may change to only show slots that have abilities assigned to them.
The size of the task bar may change because the player can expand it or shrink it in some fashion. As an example, it might normally be one row but the player can optionally make it more than one row. The player's configuration for other task bar configurations should be remembered between configuration changes.
The ability in the slot will determine the visual look of the slot. This is normally just an icon, but in some games this may include additional visual information tied a specific ability -- e.g. an ability that power ups with subsequent kills may show, on the slot itself, the current number of kills.
Sometimes the task bar will show the name of the ability under each slot. The ability name may need to be localized.
Sometimes a game allows the player to drag the task bar to another orientation, e.g. vertical instead of horizontal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool: this sounds like a fun challenge. I'll try mocking this out, and see how it might look. Some of this may be a bit hand-wavey (e.g. layout and animation), and I'll try to note which systems I expect would just be part of the engine (or a 3rd party crate).
It will absolutely be complex, but that's the nature of tacking on a ton of features :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I add to this example widget focus / indirect UI navigation.
The task bar can also have a "focused" ability. Pressing
Tab
will set the focused ability to the next one in the current task bar. PressingShift+Tab
will set the focused ability to the previous one in the task bar. PressingSpace
will (attempt to) activate the focused ability (if one is focused). The actions done byTab
,Shift+Tab
andSpace
may be able to be re-bound to other keys (or key combinations).