tooltip cleanup

This commit is contained in:
2024-01-28 13:49:48 +01:00
parent ca87c01104
commit d07b3fc4b2
9 changed files with 3 additions and 197 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=12 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]
@@ -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/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://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/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]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/icons/cog-64.svg" type="Texture" id=11] [ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/icons/cog-64.svg" type="Texture" id=11]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/video_player/video_player.tscn" type="PackedScene" id=12] [ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/video_player/video_player.tscn" type="PackedScene" id=12]
@@ -90,12 +89,6 @@ visible = false
[node name="tooltip_layer" type="CanvasLayer" parent="."] [node name="tooltip_layer" type="CanvasLayer" parent="."]
layer = 2 layer = 2
[node name="tooltip2" parent="tooltip_layer" instance=ExtResource( 10 )]
mouse_filter = 2
bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
offset_from_cursor = Vector2( 0, -10 )
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )] [node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )]
z_index = 10 z_index = 10
color = Color( 1, 1, 1, 1 ) color = Color( 1, 1, 1, 1 )

View File

@@ -35,7 +35,8 @@ func _process(_delta: float):
lastHighlightState = isHighlighted lastHighlightState = isHighlighted
func _input(event): func _input(event):
if(event.is_action_pressed("ui_show_hints")):
if(event.is_action_pressed("ui_show_hints")) and escoria.inputs_manager.input_mode == escoria.inputs_manager.INPUT_ALL:
highlight(true) highlight(true)
elif (event.is_action_released("ui_show_hints")): elif (event.is_action_released("ui_show_hints")):
highlight(false) highlight(false)

View File

@@ -1,22 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_left.png" type="Texture" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip-reworked/tooltip-reworked.gd" type="Script" id=3]
[node name="action1" type="Node2D"]
z_index = 500
script = ExtResource( 3 )
[node name="label" type="Label" parent="."]
margin_left = -1.0
margin_top = -16.0
margin_right = 83.0
margin_bottom = 14.0
theme = ExtResource( 2 )
text = "Prueba"
[node name="MouseLeft" type="Sprite" parent="."]
position = Vector2( 13, -2 )
scale = Vector2( 1.3125, 1.25 )
texture = ExtResource( 1 )

View File

@@ -1,22 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_right.png" type="Texture" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip-reworked/tooltip-reworked.gd" type="Script" id=3]
[node name="action2" type="Node2D"]
z_index = 500
script = ExtResource( 3 )
[node name="label" type="Label" parent="."]
margin_left = -1.0
margin_top = -16.0
margin_right = 83.0
margin_bottom = 14.0
theme = ExtResource( 2 )
text = "Prueba"
[node name="MouseRight" type="Sprite" parent="."]
position = Vector2( 11.5, -1 )
scale = Vector2( 1.3125, 1.25 )
texture = ExtResource( 1 )

View File

@@ -1,25 +0,0 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
self.visible = false;
func set_text(text: String) -> void:
$label.text = text
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_ESCItemWithTooltip_mouse_entered():
self.visible = true # Replace with function body.
func _on_ESCItemWithTooltip_mouse_exited():
self.visible = false # Replace with function body.

View File

@@ -1,13 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/tooltip_target.gd" type="Script" id=2]
[node name="tooltip" type="RichTextLabel"]
theme = ExtResource( 1 )
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,13 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/tooltip2_target.gd" type="Script" id=2]
[node name="tooltip" type="RichTextLabel"]
theme = ExtResource( 1 )
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,56 +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 = "";
#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 += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target
bbcode_text += "[/color]"
# 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

@@ -1,37 +0,0 @@
extends ESCTooltip
var id: int
func _init(tooltip_id = 0):
id = tooltip_id
signal tooltip_size_updated
# Update the tooltip size according to the text.
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()
# 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("tooltip_size_updated")
bbcode_text = "";
#bbcode_text = "[img]" + "res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_left.png" + "[/img]"
#bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target
bbcode_text += "[/color]"
# push_align(RichTextLabel.ALIGN_CENTER)
# push_color(color)
# append_bbcode(current_target)
# pop()
# pop()
func _on_room_ready():
escoria.main.current_scene.game.tooltip_node = self
_room_is_ready = true