tooltip rework
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -6,47 +6,10 @@ class_name ESCItemWithTooltip, "res://addons/escoria-core/design/esc_item.svg"
|
|||||||
export(String) var action1_text = ""
|
export(String) var action1_text = ""
|
||||||
# Action 2 Label text
|
# Action 2 Label text
|
||||||
export(String) var action2_text = ""
|
export(String) var action2_text = ""
|
||||||
|
# Action 3 tooltip text in inventory
|
||||||
# Action 1 X
|
export(String) var action3_text = ""
|
||||||
export(int) var action1_x = 0
|
# Action 3 tooltip text in inventory
|
||||||
# Action 1 Y
|
export(String) var action4_text = ""
|
||||||
export(int) var action1_y = 0
|
|
||||||
|
|
||||||
# The text for the tooltip of action2
|
# The text for the tooltip of action2
|
||||||
export(String) var tooltip2_name
|
export(String) var tooltip2_name
|
||||||
|
|
||||||
# Action1 tooltip text in inventory
|
|
||||||
export(String) var action3_text
|
|
||||||
|
|
||||||
# Action2 tooltip text in inventory
|
|
||||||
export(String) var action4_text
|
|
||||||
|
|
||||||
#$tooltips.visible = true;
|
|
||||||
var action1Tooltip: Object
|
|
||||||
var action2Tooltip: Object
|
|
||||||
|
|
||||||
var tooltips = []
|
|
||||||
func _ready():
|
|
||||||
._ready()
|
|
||||||
_detect_labels()
|
|
||||||
if(action1Tooltip != null):
|
|
||||||
action1Tooltip.set_text(action1_text)
|
|
||||||
if(action2Tooltip != null):
|
|
||||||
action2Tooltip.set_text(action2_text)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _detect_labels() -> void:
|
|
||||||
# Initialize collision variable.
|
|
||||||
for c in get_children():
|
|
||||||
if c is Node2D:
|
|
||||||
if c.name == "action1":
|
|
||||||
action1Tooltip = c
|
|
||||||
if c.name =="action2":
|
|
||||||
action2Tooltip = c
|
|
||||||
if c.name == "action1" or c.name =="action2":
|
|
||||||
print("TOOL LOOP " + c.name)
|
|
||||||
#var node = c.get
|
|
||||||
#c.set_text("AAAAAAA")
|
|
||||||
tooltips.append(c)
|
|
||||||
#tooltipsLayer = c
|
|
||||||
|
|||||||
@@ -18,3 +18,4 @@ func _ready():
|
|||||||
._ready()
|
._ready()
|
||||||
else:
|
else:
|
||||||
tooltip_name = ""
|
tooltip_name = ""
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ const ONE_LINE_HEIGHT = 16
|
|||||||
export(Color) var color setget set_color
|
export(Color) var color setget set_color
|
||||||
|
|
||||||
# Vector2 defining the offset from the cursor
|
# Vector2 defining the offset from the cursor
|
||||||
export(Vector2) var offset_from_cursor = Vector2(10,0)
|
export(Vector2) var offset_from_cursor_action1 = Vector2(5,5)
|
||||||
|
|
||||||
|
export(Vector2) var offset_from_cursor_action2 = Vector2(5,-5)
|
||||||
|
|
||||||
# Activates debug mode. If enabled, shows the label with a white background.
|
# Activates debug mode. If enabled, shows the label with a white background.
|
||||||
export(bool) var debug_mode = false setget set_debug_mode
|
export(bool) var debug_mode = false setget set_debug_mode
|
||||||
@@ -33,12 +35,16 @@ var current_action: String
|
|||||||
# Target item/hotspot
|
# Target item/hotspot
|
||||||
var current_target: String setget set_target
|
var current_target: String setget set_target
|
||||||
|
|
||||||
|
var current_target_object: Object = null setget set_target_object
|
||||||
|
|
||||||
# Preposition: on, with...
|
# Preposition: on, with...
|
||||||
var current_prep: String = "with"
|
var current_prep: String = "with"
|
||||||
|
|
||||||
# Target 2 item/hotspot
|
# Target 2 item/hotspot
|
||||||
var current_target2: String
|
var current_target2: String
|
||||||
|
|
||||||
|
var current_size: Vector2 = Vector2(0,0) setget _set_current_size
|
||||||
|
|
||||||
# True if tooltip is waiting for a click on second target (use x with y)
|
# True if tooltip is waiting for a click on second target (use x with y)
|
||||||
var waiting_for_target2 = false
|
var waiting_for_target2 = false
|
||||||
|
|
||||||
@@ -48,6 +54,7 @@ var debug_texturerect_node: TextureRect
|
|||||||
# Indicates whether the current room is loaded and ready
|
# Indicates whether the current room is loaded and ready
|
||||||
var _room_is_ready: bool = false
|
var _room_is_ready: bool = false
|
||||||
|
|
||||||
|
signal tooltip_size_updated
|
||||||
|
|
||||||
# Connect relevant functions
|
# Connect relevant functions
|
||||||
func _ready():
|
func _ready():
|
||||||
@@ -80,7 +87,7 @@ func set_debug_mode(p_debug_mode: bool):
|
|||||||
debug_texturerect_node.expand = true
|
debug_texturerect_node.expand = true
|
||||||
debug_texturerect_node.stretch_mode = TextureRect.STRETCH_TILE
|
debug_texturerect_node.stretch_mode = TextureRect.STRETCH_TILE
|
||||||
#debug_texturerect_node.size_flags_horizontal = SIZE_EXPAND_FILL
|
#debug_texturerect_node.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||||
debug_texturerect_node.size_flags_vertical = SIZE_EXPAND_FILL
|
#debug_texturerect_node.size_flags_vertical = SIZE_EXPAND_FILL
|
||||||
debug_texturerect_node.show_behind_parent = true
|
debug_texturerect_node.show_behind_parent = true
|
||||||
debug_texturerect_node.anchor_right = 1.0
|
debug_texturerect_node.anchor_right = 1.0
|
||||||
debug_texturerect_node.anchor_bottom = 1.0
|
debug_texturerect_node.anchor_bottom = 1.0
|
||||||
@@ -91,6 +98,16 @@ func set_debug_mode(p_debug_mode: bool):
|
|||||||
remove_child(debug_texturerect_node)
|
remove_child(debug_texturerect_node)
|
||||||
debug_texturerect_node.queue_free()
|
debug_texturerect_node.queue_free()
|
||||||
|
|
||||||
|
func set_target_object(target: Object, needs_second_target: bool = false) -> void:
|
||||||
|
current_target_object = target
|
||||||
|
waiting_for_target2 = needs_second_target
|
||||||
|
if _room_is_ready:
|
||||||
|
update_tooltip_text()
|
||||||
|
if(target == null):
|
||||||
|
hide()
|
||||||
|
return
|
||||||
|
show()
|
||||||
|
|
||||||
|
|
||||||
# Set the first target of the label.
|
# Set the first target of the label.
|
||||||
#
|
#
|
||||||
@@ -102,6 +119,10 @@ func set_target(target: String, needs_second_target: bool = false) -> void:
|
|||||||
waiting_for_target2 = needs_second_target
|
waiting_for_target2 = needs_second_target
|
||||||
if _room_is_ready:
|
if _room_is_ready:
|
||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
if(target == ""):
|
||||||
|
hide()
|
||||||
|
return
|
||||||
|
show()
|
||||||
|
|
||||||
|
|
||||||
# Set the second target of the label
|
# Set the second target of the label
|
||||||
@@ -112,14 +133,27 @@ func set_target2(target2: String) -> void:
|
|||||||
current_target2 = target2
|
current_target2 = target2
|
||||||
if _room_is_ready:
|
if _room_is_ready:
|
||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
if(target2 == ""):
|
||||||
|
hide()
|
||||||
|
return
|
||||||
|
show()
|
||||||
|
|
||||||
|
|
||||||
# Update the tooltip text.
|
# Update the tooltip text.
|
||||||
func update_tooltip_text():
|
func update_tooltip_text():
|
||||||
"""
|
if(current_target_object == null):
|
||||||
Overriden method. Should not be called directly.
|
return
|
||||||
"""
|
hide()
|
||||||
pass
|
if(current_target_object.action1_text != ""):
|
||||||
|
$tooltip1.visible = true;
|
||||||
|
|
||||||
|
$tooltip1/label.text = current_target_object.action1_text
|
||||||
|
|
||||||
|
if(current_target_object.action2_text != ""):
|
||||||
|
$tooltip1.visible = true;
|
||||||
|
|
||||||
|
$tooltip2/label.text = current_target_object.action2_text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Update the tooltip size according to the text.
|
# Update the tooltip size according to the text.
|
||||||
@@ -127,8 +161,20 @@ func update_size():
|
|||||||
if not get_tree():
|
if not get_tree():
|
||||||
# We're not in the tree anymore. Return
|
# We're not in the tree anymore. Return
|
||||||
return
|
return
|
||||||
rect_size = get_font("normal_font").get_string_size(current_target)
|
current_size = $tooltip1/label.get_font("normal_font").get_string_size(current_target)
|
||||||
|
|
||||||
|
func get_tooltip1_size():
|
||||||
|
if not get_tree():
|
||||||
|
# We're not in the tree anymore. Return
|
||||||
|
return
|
||||||
|
escoria.logger.info(self, "get_string_size: " + String($tooltip1/label.get_font("normal_font").get_string_size(current_target)))
|
||||||
|
return $tooltip1/label.get_font("normal_font").get_string_size(current_target)
|
||||||
|
|
||||||
|
func get_tooltip2_size():
|
||||||
|
if not get_tree():
|
||||||
|
# We're not in the tree anymore. Return
|
||||||
|
return
|
||||||
|
return $tooltip2/label.get_font("normal_font").get_string_size(current_target)
|
||||||
|
|
||||||
# Calculate the offset of the label depending on its position.
|
# Calculate the offset of the label depending on its position.
|
||||||
#
|
#
|
||||||
@@ -138,7 +184,7 @@ func update_size():
|
|||||||
# **Return**
|
# **Return**
|
||||||
# The calculated offset
|
# The calculated offset
|
||||||
func _offset(position: Vector2) -> Vector2:
|
func _offset(position: Vector2) -> Vector2:
|
||||||
var center_offset_x = rect_size.x / 2
|
var center_offset_x = current_size.x / 2
|
||||||
var offset_y = 5
|
var offset_y = 5
|
||||||
|
|
||||||
position.x -= center_offset_x
|
position.x -= center_offset_x
|
||||||
@@ -190,6 +236,21 @@ func tooltip_distance_to_edge_left(position: Vector2):
|
|||||||
func tooltip_distance_to_edge_right(position: Vector2):
|
func tooltip_distance_to_edge_right(position: Vector2):
|
||||||
return escoria.game_size.x - position.x
|
return escoria.game_size.x - position.x
|
||||||
|
|
||||||
|
func show():
|
||||||
|
if _room_is_ready:
|
||||||
|
$tooltip1.visible = true;
|
||||||
|
$tooltip2.visible = true;
|
||||||
|
#$icon.visible = true;
|
||||||
|
#$label.visible = true;
|
||||||
|
#$background.visible = true;
|
||||||
|
|
||||||
|
func hide():
|
||||||
|
if _room_is_ready:
|
||||||
|
$tooltip1.visible = false;
|
||||||
|
$tooltip2.visible = false;
|
||||||
|
#$icon.visible = false;
|
||||||
|
#$label.visible = false;
|
||||||
|
#$background.visible = false;
|
||||||
|
|
||||||
# Clear the tooltip targets texts
|
# Clear the tooltip targets texts
|
||||||
func clear():
|
func clear():
|
||||||
@@ -197,7 +258,9 @@ func clear():
|
|||||||
set_target("")
|
set_target("")
|
||||||
set_target2("")
|
set_target2("")
|
||||||
|
|
||||||
|
func _set_current_size(size: Vector2):
|
||||||
|
current_size = size
|
||||||
|
|
||||||
# Called when the room is loaded to setup the label.
|
# Called when the room is loaded to setup the label.
|
||||||
func _on_room_ready():
|
func _on_room_ready():
|
||||||
escoria.main.current_scene.game.tooltip_node = self
|
escoria.main.current_scene.game.tooltip_node = self
|
||||||
@@ -210,3 +273,4 @@ func _on_action_selected() -> void:
|
|||||||
|
|
||||||
if _room_is_ready:
|
if _room_is_ready:
|
||||||
update_tooltip_text()
|
update_tooltip_text()
|
||||||
|
hide()
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_rich_tooltip.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_right.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_left.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=4]
|
||||||
|
|
||||||
|
[node name="tooltipManager" type="Node2D"]
|
||||||
|
position = Vector2( -1, -10 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="tooltip1" type="Node2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="label" type="Label" parent="tooltip1"]
|
||||||
|
margin_left = 9.0
|
||||||
|
margin_top = -6.0
|
||||||
|
margin_right = 119.0
|
||||||
|
margin_bottom = 8.0
|
||||||
|
theme = ExtResource( 4 )
|
||||||
|
text = "Text place holder"
|
||||||
|
|
||||||
|
[node name="icon" type="Sprite" parent="tooltip1"]
|
||||||
|
position = Vector2( 1, 8 )
|
||||||
|
scale = Vector2( 0.583333, 0.583333 )
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="tooltip2" type="Node2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="label" type="Label" parent="tooltip2"]
|
||||||
|
margin_left = 9.0
|
||||||
|
margin_top = 35.0
|
||||||
|
margin_right = 144.0
|
||||||
|
margin_bottom = 64.0
|
||||||
|
theme = ExtResource( 4 )
|
||||||
|
text = "Text place holder"
|
||||||
|
|
||||||
|
[node name="icon" type="Sprite" parent="tooltip2"]
|
||||||
|
position = Vector2( 1, 49.5 )
|
||||||
|
scale = Vector2( 0.583333, 0.583333 )
|
||||||
|
texture = ExtResource( 2 )
|
||||||
@@ -84,8 +84,8 @@ var tooltip2_node: Object
|
|||||||
func _ready():
|
func _ready():
|
||||||
if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0:
|
if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0:
|
||||||
escoria.logger.error(self, "Error connecting tooltip_size_updated")
|
escoria.logger.error(self, "Error connecting tooltip_size_updated")
|
||||||
if $tooltip_layer/tooltip2.connect("tooltip2_size_updated", self, "update_tooltip_following_mouse_position", [tooltip2_node]) != 0:
|
#if $tooltip_layer/tooltip2.connect("tooltip2_size_updated", self, "update_tooltip_following_mouse_position", [tooltip2_node]) != 0:
|
||||||
escoria.logger.error(self, "Error connecting tooltip2_size_updated")
|
# escoria.logger.error(self, "Error connecting tooltip2_size_updated")
|
||||||
|
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
@@ -227,11 +227,13 @@ func element_focused(element_id: String) -> void:
|
|||||||
var target_obj = escoria.object_manager.get_object(element_id).node
|
var target_obj = escoria.object_manager.get_object(element_id).node
|
||||||
if target_obj is ESCItem or ESCItemWithTooltip:
|
if target_obj is ESCItem or ESCItemWithTooltip:
|
||||||
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||||
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
|
$tooltip_layer/tooltip.set_target_object(target_obj)
|
||||||
|
#$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
|
||||||
|
|
||||||
func element_unfocused() -> void:
|
func element_unfocused() -> void:
|
||||||
$tooltip_layer/tooltip.set_target("")
|
$tooltip_layer/tooltip.set_target("")
|
||||||
$tooltip_layer/tooltip2.set_target("")
|
$tooltip_layer/tooltip.set_target_object(null)
|
||||||
|
#$tooltip_layer/tooltip2.set_target("")
|
||||||
|
|
||||||
|
|
||||||
## ITEMS ##
|
## ITEMS ##
|
||||||
@@ -262,7 +264,7 @@ func click_on_item(item_global_id: String, event: InputEvent, action: String) ->
|
|||||||
|
|
||||||
if (action == ACTION1 && target_obj.tooltip_name != "") || (action == ACTION2 && target_obj is ESCItemWithTooltip && target_obj.tooltip2_name != ""):
|
if (action == ACTION1 && target_obj.tooltip_name != "") || (action == ACTION2 && target_obj is ESCItemWithTooltip && target_obj.tooltip2_name != ""):
|
||||||
$tooltip_layer/tooltip.hide()
|
$tooltip_layer/tooltip.hide()
|
||||||
$tooltip_layer/tooltip2.hide()
|
#$tooltip_layer/tooltip2.hide()
|
||||||
|
|
||||||
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||||
click_on_item(item_global_id, event, ACTION1)
|
click_on_item(item_global_id, event, ACTION1)
|
||||||
@@ -305,7 +307,7 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
|
|||||||
|
|
||||||
if (target_obj is ESCItemWithTooltip) && (action == ACTION3 && target_obj.action3_text != "") || (action == ACTION4 && target_obj.action4_text != ""):
|
if (target_obj is ESCItemWithTooltip) && (action == ACTION3 && target_obj.action3_text != "") || (action == ACTION4 && target_obj.action4_text != ""):
|
||||||
$tooltip_layer/tooltip.hide()
|
$tooltip_layer/tooltip.hide()
|
||||||
$tooltip_layer/tooltip2.hide()
|
#$tooltip_layer/tooltip2.hide()
|
||||||
|
|
||||||
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||||
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
||||||
@@ -323,7 +325,7 @@ func inventory_item_focused(inventory_item_global_id: String) -> void:
|
|||||||
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
||||||
if target_obj is ESCItemWithTooltip:
|
if target_obj is ESCItemWithTooltip:
|
||||||
$tooltip_layer/tooltip.set_target(target_obj.action3_text)
|
$tooltip_layer/tooltip.set_target(target_obj.action3_text)
|
||||||
$tooltip_layer/tooltip2.set_target(target_obj.action4_text)
|
$tooltip_layer/tooltip.set_target_object(target_obj)
|
||||||
|
|
||||||
|
|
||||||
func inventory_item_unfocused() -> void:
|
func inventory_item_unfocused() -> void:
|
||||||
@@ -391,33 +393,46 @@ func get_custom_data() -> Dictionary:
|
|||||||
|
|
||||||
|
|
||||||
# Update the tooltip position
|
# Update the tooltip position
|
||||||
func update_tooltip_following_mouse_position(tooltip: Object):
|
func update_tooltip_following_mouse_position(tooltip: ESCRichTooltip):
|
||||||
if tooltip == null:
|
if tooltip == null:
|
||||||
return
|
return
|
||||||
|
set_tooltip_position("tooltip1", tooltip, tooltip.get_tooltip1_size(), tooltip.offset_from_cursor_action1)
|
||||||
|
set_tooltip_position("tooltip2", tooltip, tooltip.get_tooltip2_size(), tooltip.offset_from_cursor_action2)
|
||||||
|
|
||||||
var corrected_position = _current_mouse_pos \
|
|
||||||
- Vector2(
|
func set_tooltip_position(nodeId: String, tooltip: ESCRichTooltip, size: Vector2, offset: Vector2):
|
||||||
tooltip.rect_size.x / 2,
|
var mouse_position = calculateMousePosition(size)
|
||||||
tooltip.rect_size.y / 2
|
var corrected_position = correctPosition(tooltip, size, mouse_position, offset)
|
||||||
)
|
tooltip.get_node(nodeId).position = corrected_position
|
||||||
|
|
||||||
|
|
||||||
|
func calculateMousePosition(size: Vector2):
|
||||||
|
size.x / 2
|
||||||
|
size.y / 2
|
||||||
|
#escoria.logger.info(self, "_current_mouse_pos" + String(_current_mouse_pos.x) + " gameSize: " + escoria.game_size.x)
|
||||||
|
|
||||||
|
return _current_mouse_pos - size
|
||||||
|
|
||||||
|
func correctPosition(tooltip: ESCRichTooltip, size: Vector2, mouse_position: Vector2, offset: Vector2):
|
||||||
|
|
||||||
# clamp TOP
|
# clamp TOP
|
||||||
if tooltip.tooltip_distance_to_edge_top(_current_mouse_pos) <= mouse_tooltip_margin:
|
if tooltip.tooltip_distance_to_edge_top(_current_mouse_pos) <= mouse_tooltip_margin:
|
||||||
corrected_position.y = mouse_tooltip_margin
|
mouse_position.y = mouse_tooltip_margin
|
||||||
|
|
||||||
# clamp BOTTOM
|
# clamp BOTTOM
|
||||||
if tooltip.tooltip_distance_to_edge_bottom(_current_mouse_pos + tooltip.rect_size) <= mouse_tooltip_margin:
|
if tooltip.tooltip_distance_to_edge_bottom(_current_mouse_pos + size) <= mouse_tooltip_margin:
|
||||||
corrected_position.y = escoria.game_size.y - mouse_tooltip_margin - tooltip.rect_size.y
|
mouse_position.y = escoria.game_size.y - mouse_tooltip_margin - size.y
|
||||||
|
|
||||||
# clamp LEFT
|
# clamp LEFT
|
||||||
if tooltip.tooltip_distance_to_edge_left(_current_mouse_pos - tooltip.rect_size/2) <= mouse_tooltip_margin:
|
if tooltip.tooltip_distance_to_edge_left(_current_mouse_pos - size/2) <= mouse_tooltip_margin:
|
||||||
corrected_position.x = mouse_tooltip_margin
|
mouse_position.x = mouse_tooltip_margin
|
||||||
|
|
||||||
# clamp RIGHT
|
# clamp RIGHT
|
||||||
if tooltip.tooltip_distance_to_edge_right(_current_mouse_pos + tooltip.rect_size/2) <= mouse_tooltip_margin:
|
if tooltip.tooltip_distance_to_edge_right(_current_mouse_pos + size/2) <= mouse_tooltip_margin:
|
||||||
corrected_position.x = escoria.game_size.x - mouse_tooltip_margin - tooltip.rect_size.x
|
mouse_position.x = escoria.game_size.x - mouse_tooltip_margin - size.x
|
||||||
|
|
||||||
tooltip.rect_position = corrected_position + tooltip.offset_from_cursor
|
|
||||||
|
return mouse_position - offset
|
||||||
|
|
||||||
func _on_event_done(return_code: int, _event_name: String):
|
func _on_event_done(return_code: int, _event_name: String):
|
||||||
escoria.logger.info(self, "EVENT DONE! code=" + String(return_code))
|
escoria.logger.info(self, "EVENT DONE! code=" + String(return_code))
|
||||||
@@ -425,7 +440,7 @@ func _on_event_done(return_code: int, _event_name: String):
|
|||||||
# escoria.action_manager.clear_current_action()
|
# escoria.action_manager.clear_current_action()
|
||||||
# Show tooltips, they were hiddeen while performing action
|
# Show tooltips, they were hiddeen while performing action
|
||||||
$tooltip_layer/tooltip.show()
|
$tooltip_layer/tooltip.show()
|
||||||
$tooltip_layer/tooltip2.show()
|
#$tooltip_layer/tooltip2.show()
|
||||||
# Reset mouse cursor to (perhaps we were using an inventory item)
|
# Reset mouse cursor to (perhaps we were using an inventory item)
|
||||||
Input.set_custom_mouse_cursor(null)
|
Input.set_custom_mouse_cursor(null)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=11 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" type="Script" id=2]
|
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=3]
|
||||||
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_rich_tooltip.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/target_tooltip.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/target_tooltip.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
|
||||||
@@ -76,16 +77,23 @@ visible = false
|
|||||||
[node name="tooltip_layer" type="CanvasLayer" parent="."]
|
[node name="tooltip_layer" type="CanvasLayer" parent="."]
|
||||||
layer = 2
|
layer = 2
|
||||||
|
|
||||||
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 6 )]
|
[node name="tooltipOld" parent="tooltip_layer" instance=ExtResource( 6 )]
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
bbcode_text = "[center][color=#000000][/color][/center]"
|
bbcode_text = "[center][color=#000000][/color][/center]"
|
||||||
fit_content_height = true
|
fit_content_height = true
|
||||||
offset_from_cursor = Vector2( -10, -50 )
|
offset_from_cursor = Vector2( -5, -50 )
|
||||||
|
|
||||||
|
|
||||||
[node name="tooltip2" parent="tooltip_layer" instance=ExtResource( 10 )]
|
[node name="tooltip2" parent="tooltip_layer" instance=ExtResource( 10 )]
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
bbcode_text = "[center][color=#000000][/color][/center]"
|
bbcode_text = "[center][color=#000000][/color][/center]"
|
||||||
fit_content_height = true
|
fit_content_height = true
|
||||||
offset_from_cursor = Vector2( -10, 50 )
|
offset_from_cursor = Vector2( -5, 50 )
|
||||||
|
|
||||||
|
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )]
|
||||||
|
z_index = 10
|
||||||
|
color = Color( 1, 1, 1, 1 )
|
||||||
|
offset_from_cursor_action1 = Vector2( 0, 50 )
|
||||||
|
offset_from_cursor_action2 = Vector2( 0, -50 )
|
||||||
|
|
||||||
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||||
|
|||||||
@@ -3,15 +3,14 @@
|
|||||||
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
content_margin_left = 28.0
|
content_margin_left = 4.0
|
||||||
content_margin_right = 3.0
|
content_margin_right = 4.0
|
||||||
content_margin_top = 6.0
|
content_margin_top = 4.0
|
||||||
content_margin_bottom = 3.0
|
content_margin_bottom = 4.0
|
||||||
bg_color = Color( 0, 0, 0, 0.462745 )
|
bg_color = Color( 0, 0, 0, 0.462745 )
|
||||||
corner_radius_top_left = 5
|
|
||||||
corner_radius_top_right = 5
|
corner_radius_top_right = 5
|
||||||
corner_radius_bottom_right = 5
|
corner_radius_bottom_right = 5
|
||||||
corner_radius_bottom_left = 5
|
expand_margin_left = 19.0
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=2]
|
[sub_resource type="StyleBoxFlat" id=2]
|
||||||
bg_color = Color( 0, 0, 0, 0.509804 )
|
bg_color = Color( 0, 0, 0, 0.509804 )
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
:ready
|
||||||
|
camera_set_target 0 player
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=15 format=2]
|
[gd_scene load_steps=17 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=1]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_background.gd" type="Script" id=2]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_background.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=3]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_terrain.gd" type="Script" id=4]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_terrain.gd" type="Script" id=4]
|
||||||
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/background trasera cocina-1500x577-noItems.jpg" type="Texture" id=6]
|
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/background trasera cocina-1500x577-noItems.jpg" type="Texture" id=6]
|
||||||
[ext_resource path="res://gymkhana/characters/oier/oier.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://gymkhana/characters/oier/oier.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/columna.png" type="Texture" id=25]
|
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/columna.png" type="Texture" id=25]
|
||||||
@@ -19,6 +20,13 @@ vertices = PoolVector2Array( 155, 425, 129, 383, 242, 376, 1511, 445, 1512, 574,
|
|||||||
polygons = [ PoolIntArray( 0, 1, 2 ), PoolIntArray( 3, 4, 5, 6 ), PoolIntArray( 5, 0, 2, 7, 8, 9 ), PoolIntArray( 9, 10, 11, 5 ), PoolIntArray( 5, 11, 12 ), PoolIntArray( 13, 14, 15, 16, 5 ), PoolIntArray( 17, 18, 19, 3 ), PoolIntArray( 13, 20, 14 ), PoolIntArray( 5, 12, 21 ), PoolIntArray( 22, 17, 3 ), PoolIntArray( 5, 21, 13 ), PoolIntArray( 6, 22, 3 ), PoolIntArray( 23, 6, 5 ), PoolIntArray( 5, 16, 23 ) ]
|
polygons = [ PoolIntArray( 0, 1, 2 ), PoolIntArray( 3, 4, 5, 6 ), PoolIntArray( 5, 0, 2, 7, 8, 9 ), PoolIntArray( 9, 10, 11, 5 ), PoolIntArray( 5, 11, 12 ), PoolIntArray( 13, 14, 15, 16, 5 ), PoolIntArray( 17, 18, 19, 3 ), PoolIntArray( 13, 20, 14 ), PoolIntArray( 5, 12, 21 ), PoolIntArray( 22, 17, 3 ), PoolIntArray( 5, 21, 13 ), PoolIntArray( 6, 22, 3 ), PoolIntArray( 23, 6, 5 ), PoolIntArray( 5, 16, 23 ) ]
|
||||||
outlines = [ PoolVector2Array( 263, 374, 359, 376, 385, 397, 442, 395, 464, 432, 506, 457, 584, 468, 725, 472, 749, 460, 794, 462, 846, 467, 864, 482, 981, 480, 1133, 474, 1249, 454, 1318, 435, 1367, 411, 1425, 417, 1511, 445, 1512, 574, 193, 574, 155, 425, 129, 383, 242, 376 ) ]
|
outlines = [ PoolVector2Array( 263, 374, 359, 376, 385, 397, 442, 395, 464, 432, 506, 457, 584, 468, 725, 472, 749, 460, 794, 462, 846, 467, 864, 482, 981, 480, 1133, 474, 1249, 454, 1318, 435, 1367, 411, 1425, 417, 1511, 445, 1512, 574, 193, 574, 155, 425, 129, 383, 242, 376 ) ]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id=2]
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
dir_angles = [ ]
|
||||||
|
directions = [ ]
|
||||||
|
idles = [ ]
|
||||||
|
speaks = [ ]
|
||||||
|
|
||||||
[node name="ESCRoom" type="Node2D"]
|
[node name="ESCRoom" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
global_id = "trasera_cocina"
|
global_id = "trasera_cocina"
|
||||||
@@ -28,10 +36,8 @@ camera_limits = [ Rect2( 0, 0, 1500, 577 ) ]
|
|||||||
editor_debug_mode = 1
|
editor_debug_mode = 1
|
||||||
|
|
||||||
[node name="ESCBackground" type="TextureRect" parent="."]
|
[node name="ESCBackground" type="TextureRect" parent="."]
|
||||||
margin_left = 17.0
|
margin_right = 1500.0
|
||||||
margin_top = 4.0
|
margin_bottom = 755.0
|
||||||
margin_right = 1517.0
|
|
||||||
margin_bottom = 581.0
|
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
texture = ExtResource( 6 )
|
texture = ExtResource( 6 )
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
@@ -45,7 +51,7 @@ scale_min = 0.5
|
|||||||
navpoly = SubResource( 1 )
|
navpoly = SubResource( 1 )
|
||||||
|
|
||||||
[node name="ESCLocation" type="Position2D" parent="."]
|
[node name="ESCLocation" type="Position2D" parent="."]
|
||||||
position = Vector2( 796, 480 )
|
position = Vector2( 802, 470 )
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
global_id = "trasera_cocina_start"
|
global_id = "trasera_cocina_start"
|
||||||
is_start_location = true
|
is_start_location = true
|
||||||
@@ -61,11 +67,13 @@ is_exit = true
|
|||||||
tooltip_name = "Esto es una puerta y tiene una descripcion mu larga"
|
tooltip_name = "Esto es una puerta y tiene una descripcion mu larga"
|
||||||
combine_when_selected_action_is_in = [ ]
|
combine_when_selected_action_is_in = [ ]
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
|
action1_text = "Esto es una puerta y tiene una descripcion mu larga"
|
||||||
|
action2_text = "Entrar! con descricion..."
|
||||||
tooltip2_name = "Entrar! con descricion..."
|
tooltip2_name = "Entrar! con descricion..."
|
||||||
animations = null
|
animations = SubResource( 2 )
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/entrada_cocina"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/entrada_cocina"]
|
||||||
position = Vector2( 740.494, -123.8 )
|
position = Vector2( 725, -125 )
|
||||||
scale = Vector2( 0.963362, 0.9875 )
|
scale = Vector2( 0.963362, 0.9875 )
|
||||||
polygon = PoolVector2Array( 21, 575, 22, 331, 135, 339, 137, 581 )
|
polygon = PoolVector2Array( 21, 575, 22, 331, 135, 339, 137, 581 )
|
||||||
|
|
||||||
@@ -82,13 +90,15 @@ tooltip_name = "TT Mirar bombona"
|
|||||||
combine_when_selected_action_is_in = [ ]
|
combine_when_selected_action_is_in = [ ]
|
||||||
inventory_texture = ExtResource( 29 )
|
inventory_texture = ExtResource( 29 )
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
tooltip2_name = "TT2 Coger bombona"
|
action1_text = "TT Mirar bombona"
|
||||||
|
action2_text = "TT2 Coger bombona"
|
||||||
action3_text = "¿Cómo ha entrado en mi bolsillo?"
|
action3_text = "¿Cómo ha entrado en mi bolsillo?"
|
||||||
action4_text = "¿Por qué es una llave inglesa?"
|
action4_text = "¿Por qué es una llave inglesa?"
|
||||||
|
tooltip2_name = "TT2 Coger bombona"
|
||||||
animations = null
|
animations = null
|
||||||
|
|
||||||
[node name="bombona2" parent="Hotspots" instance=ExtResource( 27 )]
|
[node name="bombona2" parent="Hotspots" instance=ExtResource( 27 )]
|
||||||
position = Vector2( 357, 408 )
|
position = Vector2( 355, 409 )
|
||||||
script = ExtResource( 28 )
|
script = ExtResource( 28 )
|
||||||
global_id = "i_bombona2"
|
global_id = "i_bombona2"
|
||||||
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona2.esc"
|
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona2.esc"
|
||||||
@@ -97,30 +107,19 @@ combine_when_selected_action_is_in = [ "action1", "action3" ]
|
|||||||
use_from_inventory_only = true
|
use_from_inventory_only = true
|
||||||
inventory_texture = ExtResource( 29 )
|
inventory_texture = ExtResource( 29 )
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
tooltip2_name = "TT2 Coger bombona"
|
action1_text = "TT Mirar bombona"
|
||||||
|
action2_text = "TT2 Coger bombona"
|
||||||
action3_text = "Usar"
|
action3_text = "Usar"
|
||||||
action4_text = "¿Por qué es una llave inglesa?"
|
action4_text = "¿Por qué es una llave inglesa?"
|
||||||
|
tooltip2_name = "TT Mirar bombona"
|
||||||
animations = null
|
animations = null
|
||||||
|
|
||||||
[node name="Columna" type="Sprite" parent="."]
|
[node name="Columna" type="Sprite" parent="."]
|
||||||
position = Vector2( 253.25, 294.5 )
|
position = Vector2( 235, 294.5 )
|
||||||
scale = Vector2( 0.973684, 1.02358 )
|
scale = Vector2( 0.973684, 1.02358 )
|
||||||
z_index = 400
|
z_index = 400
|
||||||
texture = ExtResource( 25 )
|
texture = ExtResource( 25 )
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="."]
|
|
||||||
margin_left = 598.0
|
|
||||||
margin_top = 283.0
|
|
||||||
margin_right = 692.0
|
|
||||||
margin_bottom = 464.0
|
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
|
||||||
position = Vector2( 598, 283 )
|
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="Area2D"]
|
|
||||||
margin_right = 40.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
|
|
||||||
[node name="EnekoSmoking" parent="." instance=ExtResource( 30 )]
|
[node name="EnekoSmoking" parent="." instance=ExtResource( 30 )]
|
||||||
position = Vector2( 959, 413 )
|
position = Vector2( 959, 413 )
|
||||||
tooltip_name = "Objervar sujeto"
|
tooltip_name = "Objervar sujeto"
|
||||||
@@ -136,12 +135,14 @@ script = ExtResource( 3 )
|
|||||||
global_id = "eneko_smoking"
|
global_id = "eneko_smoking"
|
||||||
|
|
||||||
[node name="ESCItemWithTooltip" parent="." instance=ExtResource( 31 )]
|
[node name="ESCItemWithTooltip" parent="." instance=ExtResource( 31 )]
|
||||||
position = Vector2( 728, 424 )
|
position = Vector2( 707, 422 )
|
||||||
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_caja_herramientas.esc"
|
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_caja_herramientas.esc"
|
||||||
tooltip_name = "¿Que es esto?"
|
tooltip_name = "¿Que es esto?"
|
||||||
tooltip2_name = "Coger"
|
action1_text = "¿Que es esto?"
|
||||||
|
action2_text = "Coger"
|
||||||
action3_text = "Mirar dentro"
|
action3_text = "Mirar dentro"
|
||||||
action4_text = "Usar"
|
action4_text = "Usar"
|
||||||
|
tooltip2_name = "Coger"
|
||||||
|
|
||||||
[node name="ESCLocation" type="Position2D" parent="ESCItemWithTooltip"]
|
[node name="ESCLocation" type="Position2D" parent="ESCItemWithTooltip"]
|
||||||
position = Vector2( -51, 69 )
|
position = Vector2( -51, 69 )
|
||||||
|
|||||||
Reference in New Issue
Block a user