feat: introduce escoria-ui-keyboard-9verbs to verify register_custom_input_handler() API

This commit was started by copying `addons/escoria-ui-9verbs` as the
basis for `addons/escoria-ui-keyboard-9verbs`. It was then amended to
wire up keyboard shortcuts for each verb using the new
`register_custom_input_handler()` API.

Note that `addons/escoria-ui-keyboard-9verbs/input_map.gd` introduces
one action per verb and provides a `add_actions_to_input_map()`
function to add the actions to the `InputMap`. The `_process_input()`
function in `game.gd` is responsible for mapping each action to the
appropriate call to `verbs_menu.on_action_selected()`.
This commit is contained in:
Michael Bolin
2022-02-23 09:40:01 -08:00
committed by Julian Murgia
parent 14cf1327fe
commit 5a77bd6fdc
13 changed files with 897 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/escoria-ui-keyboard-9verbs/tooltip/tooltip_action_target.gd" type="Script" id=1]
[node name="tooltip" type="RichTextLabel"]
anchor_right = 1.0
anchor_bottom = 1.0
bbcode_enabled = true
bbcode_text = "[center][/center]"
scroll_active = false
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

View File

@@ -0,0 +1,31 @@
extends ESCTooltip
func update_tooltip_text():
bbcode_text = "[center]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
if !current_action.empty():
bbcode_text += current_action + "\t"
bbcode_text += current_target
if waiting_for_target2 and current_target2.empty():
bbcode_text += "\t" + current_prep
if !current_target2.empty():
bbcode_text += "\t" + current_prep + "\t" + current_target2
bbcode_text += "[/color]"
bbcode_text += "[/center]"
# push_align(RichTextLabel.ALIGN_CENTER)
# if !current_action.empty():
# add_text(current_action + "\t")
#
# add_text(current_target)
#
# if waiting_for_target2 and current_target2.empty():
# add_text("\t" + current_prep)
#
# if !current_target2.empty():
# add_text("\t" + current_prep + "\t" + current_target2)
#
# pop()