Fixed a bug where bottle in magical closet room 9 had wrong interaction position.

This commit is contained in:
Julian Murgia
2021-02-26 21:31:50 +01:00
parent f743d1089c
commit b8f668df0a
25 changed files with 298 additions and 350 deletions

View File

@@ -31,6 +31,8 @@ Implement methods to react to inputs.
- _on_event_done(event_name: String)
"""
func _ready():
ProjectSettings.set_setting("escoria/ui/tooltip_follows_mouse", false)
func _input(event):
if event.is_action_pressed("switch_action_verb"):
@@ -61,11 +63,16 @@ func left_double_click_on_bg(position : Vector2) -> void:
## ITEM FOCUS ##
func element_focused(element_id : String) -> void:
$ui/tooltip_layer/tooltip.set_target(escoria.esc_runner.get_object(element_id).tooltip_name)
var target_obj = escoria.esc_runner.get_object(element_id)
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
if escoria.esc_runner.current_action != "use" && escoria.esc_runner.current_tool == null:
if target_obj is ESCItem:
$ui/verbs_layer/verbs_menu.set_by_name(target_obj.default_action)
func element_unfocused() -> void:
$ui/tooltip_layer/tooltip.set_target("")
$ui/tooltip_layer/tooltip.clear()
$ui/verbs_layer/verbs_menu.unselect_actions()
## ITEMS ##
@@ -73,6 +80,7 @@ func left_click_on_item(item_global_id : String, event : InputEvent) -> void:
escoria.do("item_left_click", [item_global_id, event])
func right_click_on_item(item_global_id : String, event : InputEvent) -> void:
escoria.esc_runner.set_current_action($ui/verbs_layer/verbs_menu.selected_action)
escoria.do("item_right_click", [item_global_id, event])
func left_double_click_on_item(item_global_id : String, event : InputEvent) -> void:

View File

@@ -63,7 +63,9 @@ margin_left = 0.0272522
margin_top = 0.320557
margin_right = -0.252686
margin_bottom = -0.0794678
rect_min_size = Vector2( 0, 32 )
script = ExtResource( 8 )
color = Color( 1, 1, 1, 1 )
[node name="dialog_layer" type="CanvasLayer" parent="ui"]
layer = 3

View File

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

View File

@@ -6,6 +6,8 @@ This script is out of Escoria's scope. It controls the UI reaction to an
UI event (eg right click) to change the cursor accordingly.
"""
var selected_action
func _ready():
for but in $actions.get_children():
but.connect("pressed", self, "_on_action_selected", [but.name])
@@ -20,3 +22,10 @@ func _on_action_selected(action : String):
func unselect_actions():
for but in $actions.get_children():
but.set_pressed(false)
func set_by_name(action_name : String):
selected_action = action_name
for but in $actions.get_children():
but.set_pressed(but.get_name() == action_name)