Currently after clicking Host or Join, the UI does not give any feedback what the application state is:
Requesting a session host code.
Requesting to join a session.
Whether the session server is actually contacted.
Ability to cancel the Host / Join request.
Solution Design:
The functionality that both of these use can be commonized to a dialog box ItemComponent, and the dialog box button entities may have an InputReactionsHandle attached to them to send the relevant events when clicked.
UiDialog is an ItemComponent, and dialogs are part of UiDefinition. Buttons on the dialog are optional, and need to receive UiEvents and turn that into the correct app event. We do this by attaching an InputReactionsHandle<InputReaction<IRR>>.
Steps:
ui_dialogue_model provides UiDialogItemComponent.
Call IrsLoader::load or input_reactions_loaded_handle (make it pub). See asset_sequence_component_loader_ui.rs:263
Attach that to the button entities created by the UiDialog.
When creating the UiDialog, we need to have the InputReactionsHandle already, and pass it in to the constructor. Then the ItemComponent implementation will attach it when the entities are created.
Store the common dialog texture in Theme, and UiDialog can ReadExpect<'s, Theme> to get the texture handle.
In GitLab by @azriel91 on Mar 4, 2020, 11:43
Currently after clicking
Host
orJoin
, the UI does not give any feedback what the application state is:Solution Design:
The functionality that both of these use can be commonized to a dialog box
ItemComponent
, and the dialog box button entities may have anInputReactionsHandle
attached to them to send the relevant events when clicked.UiDialog
is anItemComponent
, and dialogs are part ofUiDefinition
. Buttons on the dialog are optional, and need to receiveUiEvent
s and turn that into the correct app event. We do this by attaching anInputReactionsHandle<InputReaction<IRR>>
.Steps:
ui_dialogue_model
providesUiDialog
ItemComponent
.Call
IrsLoader::load
orinput_reactions_loaded_handle
(make itpub
). See asset_sequence_component_loader_ui.rs:263Attach that to the button entities created by the
UiDialog
.When creating the
UiDialog
, we need to have theInputReactionsHandle
already, and pass it in to the constructor. Then theItemComponent
implementation will attach it when the entities are created.Store the common dialog texture in
Theme
, andUiDialog
canReadExpect<'s, Theme>
to get the texture handle.Send event to open dialog.