Deleted tooltip2

This commit is contained in:
2023-02-15 15:55:25 +01:00
parent 5943b7e4db
commit f1f9bf7a69
7 changed files with 7 additions and 89 deletions

View File

@@ -72,14 +72,9 @@ var _is_gamepad_connected = false
# Tracks the mouse's current position onscreen.
var _current_mouse_pos = Vector2.ZERO
# A reference to the node handling tooltip2
var tooltip2_node: Object
func _ready():
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")
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")
func _enter_tree():
@@ -118,7 +113,6 @@ func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
_current_mouse_pos = get_global_mouse_position()
update_tooltip_following_mouse_position(tooltip_node)
update_tooltip_following_mouse_position(tooltip2_node)
# https://github.com/godotengine/godot-demo-projects/blob/3.4-585455e/misc/joypads/joypads.gd
@@ -220,11 +214,9 @@ func left_double_click_on_bg(position: Vector2) -> void:
func element_focused(element_id: String) -> void:
var target_obj = escoria.object_manager.get_object(element_id).node
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
func element_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")
$tooltip_layer/tooltip2.set_target("")
## ITEMS ##
@@ -239,9 +231,8 @@ func click_on_item(item_global_id: String, event: InputEvent, action: String) ->
true
)
if (action == ACTION1 && target_obj.tooltip_name != "") || (action == ACTION2 && target_obj.tooltip2_name != ""):
if (action == ACTION1 && target_obj.tooltip_name != ""):
$tooltip_layer/tooltip.hide()
$tooltip_layer/tooltip2.hide()
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
click_on_item(item_global_id, event, ACTION1)
@@ -275,7 +266,6 @@ func inventory_item_focused(inventory_item_global_id: String) -> void:
func inventory_item_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")
$tooltip_layer/tooltip2.set_target("")
func open_inventory():
$CanvasLayer/ui/HBoxContainer/inventory_ui.show_inventory()
@@ -371,7 +361,6 @@ func _on_event_done(return_code: int, _event_name: String):
if return_code == ESCExecution.RC_OK:
escoria.action_manager.clear_current_action()
$tooltip_layer/tooltip.show()
$tooltip_layer/tooltip2.show()
func _on_MenuButton_pressed() -> void:

View File

@@ -8,7 +8,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/pause_menu/pause_menu.tscn" type="PackedScene" id=8]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=9]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/target_tooltip2.tscn" type="PackedScene" id=10]
[node name="game" type="Node2D"]
script = ExtResource( 5 )
@@ -85,10 +84,4 @@ theme = ExtResource( 9 )
bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
[node name="tooltip2" parent="tooltip_layer" instance=ExtResource( 10 )]
mouse_filter = 2
theme = ExtResource( 9 )
bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]

View File

@@ -1,11 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/tooltip2_target.gd" type="Script" id=2]
[node name="tooltip" type="RichTextLabel"]
bbcode_enabled = true
bbcode_text = "[center][color=#ffffff][/color][/center]"
scroll_active = false
script = ExtResource( 2 )
color = Color( 1, 1, 1, 1 )
offset_from_cursor = Vector2( 0, 50 )

View File

@@ -1,57 +0,0 @@
extends ESCTooltip
var id: int
export(Texture) var iconTexture: Texture = null \
setget ,_get_icon_texture
func _init(tooltip_id = 0):
id = tooltip_id
#$icon.texture = iconTexture
signal tooltip2_size_updated
func update_tooltip_text():
# Need to update size of bbcode rect before updating the text itself otherwise on the
# first frame the text is wider than the default of 0 and ends up being really tall
# and setting the wrong vertical margin for the tooltip
update_size()
#var texturePath = get_constant()
var texturePath = null
# We signal this here since the processing in this class happens AFTER input
# processing. We signal here to avoid "lagging" behind a frame since
# tooltips are presently dependent on the size of the bounding box around
# the rendered string.
emit_signal("tooltip2_size_updated")
bbcode_text = "[center]"
#if(texturePath != null):
bbcode_text += "[img]" + "res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_right.png" + "[/img]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target
bbcode_text += "[/color]"
bbcode_text += "[/center]"
# push_align(RichTextLabel.ALIGN_CENTER)
# push_color(color)
# append_bbcode(current_target)
# pop()
# pop()
func _on_room_ready():
escoria.main.current_scene.game.tooltip2_node = self
_room_is_ready = true
func _get_icon_texture() -> Texture:
if iconTexture == null:
for c in get_children():
if c is TextureRect or c is Sprite:
return c.texture
return null
else:
return iconTexture

View File

@@ -109,7 +109,6 @@ tooltip_name = "This is action1"
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 10 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "This is action2"
[node name="Art1" type="Sprite" parent="Hotspots/artwork1"]
position = Vector2( 470, 140 )

View File

@@ -99,7 +99,6 @@ global_id = "l_exit"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/entrada_cocina.esc"
is_exit = true
tooltip_name = "Esto es una puerta"
tooltip2_name = "Entrar!"
default_action = "action2"
combine_when_selected_action_is_in = [ ]
dialog_color = Color( 1, 1, 1, 1 )

View File

@@ -319,6 +319,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://addons/escoria-core/game/core-scripts/esc_item.gd"
}, {
"base": "ESCItem",
"class": "ESCItemWithTooltip",
"language": "GDScript",
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/item.gd"
}, {
"base": "Position2D",
"class": "ESCLocation",
"language": "GDScript",
@@ -747,6 +752,7 @@ _global_script_class_icons={
"ESCInventoryItem": "",
"ESCInventoryManager": "",
"ESCItem": "res://addons/escoria-core/design/esc_item.svg",
"ESCItemWithTooltip": "res://addons/escoria-core/design/esc_item.svg",
"ESCLocation": "res://addons/escoria-core/design/esc_location.svg",
"ESCMain": "",
"ESCMigration": "",