From eb8b8ff04d866e4aeb82ff5de3594573e165c97c Mon Sep 17 00:00:00 2001 From: oier Date: Fri, 24 Feb 2023 18:29:09 +0100 Subject: [PATCH] prueba tooltip wrapper --- gymkhana.tres | 3 +++ .../tooltip/ESCTooltipWithIcon.gd | 26 +++++++++++++++++++ .../tooltip/ESCTooltipWithIcon.tscn | 22 ++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 gymkhana.tres create mode 100644 gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.gd create mode 100644 gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.tscn diff --git a/gymkhana.tres b/gymkhana.tres new file mode 100644 index 00000000..8a446294 --- /dev/null +++ b/gymkhana.tres @@ -0,0 +1,3 @@ +[gd_resource type="Theme" format=2] + +[resource] diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.gd b/gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.gd new file mode 100644 index 00000000..b5a85837 --- /dev/null +++ b/gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.gd @@ -0,0 +1,26 @@ +extends HBoxContainer + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +#func _ready(): + #if $label.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") +signal tooltip_size_updated +# Called when the node enters the scene tree for the first time. + + +func set_target(target: String, needs_second_target: bool = false): + $label.set_target(target, needs_second_target) + + +func set_target2(target: String, needs_second_target: bool = false): + $label.set_target2(target, needs_second_target) +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass +func update_tooltip_text(): + $label.update_tooltip_text() diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.tscn b/gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.tscn new file mode 100644 index 00000000..1cb1a206 --- /dev/null +++ b/gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/target_tooltip.tscn" type="PackedScene" id=1] +[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.gd" type="Script" id=2] +[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_left.png" type="Texture" id=3] + +[node name="tooltip" type="HBoxContainer"] +margin_right = 40.0 +margin_bottom = 40.0 +alignment = 1 +script = ExtResource( 2 ) + +[node name="icon" type="TextureRect" parent="."] +margin_left = 10.0 +margin_right = 26.0 +margin_bottom = 40.0 +texture = ExtResource( 3 ) + +[node name="label" parent="." instance=ExtResource( 1 )] +margin_left = 30.0 +margin_right = 30.0 +margin_bottom = 40.0