Now with subtitles
This commit is contained in:
@@ -62,11 +62,13 @@ signal tooltip_size_updated
|
||||
|
||||
# Connect relevant functions
|
||||
func _ready():
|
||||
if escoria.main.connect("room_ready", Callable(self, "_on_room_ready")) != 0:
|
||||
escoria.logger.error(self, "Error connecting room_ready with _on_room_ready")
|
||||
escoria.main.room_ready.connect(_on_room_ready)
|
||||
escoria.action_manager.action_changed.connect(_on_action_selected)
|
||||
#if escoria.main.connect("room_ready", Callable(self, "_on_room_ready")) != 0:
|
||||
# escoria.logger.error(self, "Error connecting room_ready with _on_room_ready")
|
||||
|
||||
if escoria.action_manager.connect("action_changed", Callable(self, "_on_action_selected")) != 0:
|
||||
escoria.logger.error(self, "Error connecting action_changed with _on_action_selected")
|
||||
#if escoria.action_manager.connect("action_changed", Callable(self, "_on_action_selected")) != 0:
|
||||
# escoria.logger.error(self, "Error connecting action_changed with _on_action_selected")
|
||||
|
||||
|
||||
# Set the color of the label
|
||||
@@ -112,7 +114,7 @@ func set_target_object(target: Object, needs_second_target: bool = false) -> voi
|
||||
if(target == null):
|
||||
hide()
|
||||
return
|
||||
# show()
|
||||
show()
|
||||
update_tooltip_text()
|
||||
|
||||
|
||||
@@ -163,11 +165,11 @@ func update_tooltip_text():
|
||||
|
||||
left_click_text = get_action_target_text(current_target_object.action3_target_texts) if waiting_for_target_item else get_tooltip_from_current_target("action3") if item_in_inventory else get_tooltip_from_current_target("action1")
|
||||
right_click_text = get_action_target_text(current_target_object.action4_target_texts) if waiting_for_target_item else get_tooltip_from_current_target("action4") if item_in_inventory else get_tooltip_from_current_target("action2")
|
||||
|
||||
$tooltip1/label.text = left_click_text
|
||||
$tooltip1.visible = !hidden and left_click_text != "";
|
||||
$tooltip2/label.text = right_click_text
|
||||
$tooltip2.visible = !hidden and right_click_text != "";
|
||||
|
||||
$tooltip1/label.text = tr(left_click_text)
|
||||
$tooltip1.visible = !hiddenTooltip and left_click_text != "";
|
||||
$tooltip2/label.text = tr(right_click_text)
|
||||
$tooltip2.visible = !hiddenTooltip and right_click_text != ""
|
||||
|
||||
func get_tooltip_from_current_target(verb):
|
||||
return gymkhana.tooltip_manager.getTooltip(current_target_object.global_id, verb)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d2kogebvoxy51"]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/esc_rich_tooltip.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_right.png" type="Texture2D" id=2]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_left.png" type="Texture2D" id=3]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=4]
|
||||
[ext_resource type="Script" path="res://addons/escoria-ui-return-monkey-island/esc_rich_tooltip.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://chjcs048ughsb" path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_right.png" id="2"]
|
||||
[ext_resource type="Texture2D" uid="uid://cn1fjp4q7b5e0" path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_left.png" id="3"]
|
||||
[ext_resource type="Theme" uid="uid://bf2eet52fueam" path="res://addons/escoria-ui-return-monkey-island/theme.tres" id="4"]
|
||||
|
||||
[node name="tooltipManager" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="tooltip1" type="Node2D" parent="."]
|
||||
auto_translate_mode = 1
|
||||
visible = false
|
||||
|
||||
[node name="label" type="Label" parent="tooltip1"]
|
||||
@@ -16,13 +17,13 @@ offset_left = 9.0
|
||||
offset_top = -6.0
|
||||
offset_right = 119.0
|
||||
offset_bottom = 8.0
|
||||
theme = ExtResource( 4 )
|
||||
theme = ExtResource("4")
|
||||
text = "Text place holder"
|
||||
|
||||
[node name="icon" type="Sprite2D" parent="tooltip1"]
|
||||
position = Vector2( 1, 8 )
|
||||
scale = Vector2( 0.583333, 0.583333 )
|
||||
texture = ExtResource( 3 )
|
||||
position = Vector2(1, 8)
|
||||
scale = Vector2(0.583333, 0.583333)
|
||||
texture = ExtResource("3")
|
||||
|
||||
[node name="tooltip2" type="Node2D" parent="."]
|
||||
visible = false
|
||||
@@ -32,10 +33,10 @@ offset_left = 9.0
|
||||
offset_top = 35.0
|
||||
offset_right = 144.0
|
||||
offset_bottom = 64.0
|
||||
theme = ExtResource( 4 )
|
||||
theme = ExtResource("4")
|
||||
text = "Text place holder"
|
||||
|
||||
[node name="icon" type="Sprite2D" parent="tooltip2"]
|
||||
position = Vector2( 1, 49.5 )
|
||||
scale = Vector2( 0.583333, 0.583333 )
|
||||
texture = ExtResource( 2 )
|
||||
position = Vector2(1, 49.5)
|
||||
scale = Vector2(0.583333, 0.583333)
|
||||
texture = ExtResource("2")
|
||||
|
||||
@@ -154,11 +154,11 @@ func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_show_room_selector"):
|
||||
toggle_room_selector_visibility()
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
#_current_mouse_pos = get_global_mouse_position() # Escoria core
|
||||
_current_mouse_pos = get_viewport().get_mouse_position()
|
||||
update_tooltip_following_mouse_position(tooltip_node)
|
||||
update_tooltip_following_mouse_position(tooltip2_node)
|
||||
if event is InputEventMouseMotion:
|
||||
#_current_mouse_pos = get_global_mouse_position() # Escoria core
|
||||
_current_mouse_pos = get_viewport().get_mouse_position()
|
||||
update_tooltip_following_mouse_position(tooltip_node)
|
||||
update_tooltip_following_mouse_position(tooltip2_node)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,62 +1,67 @@
|
||||
[gd_scene load_steps=17 format=2]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://cabos3cse6b71"]
|
||||
|
||||
[ext_resource path="res://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/camera_player/camera.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/esc_rich_tooltip.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" type="Texture2D" id=6]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=9]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64-hover.svg" type="Texture2D" id=10]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64.svg" type="Texture2D" id=11]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/video_player/video_player.tscn" type="PackedScene" id=12]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover.svg" type="Texture2D" id=13]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/MusicButton.gd" type="Script" id=14]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover-disabled.svg" type="Texture2D" id=15]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-disabled.svg" type="Texture2D" id=16]
|
||||
[ext_resource type="PackedScene" path="res://addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn" id="1"]
|
||||
[ext_resource type="Script" path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" id="2"]
|
||||
[ext_resource type="PackedScene" path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" id="3"]
|
||||
[ext_resource type="PackedScene" uid="uid://d2kogebvoxy51" path="res://addons/escoria-ui-return-monkey-island/esc_rich_tooltip.tscn" id="4"]
|
||||
[ext_resource type="Script" path="res://addons/escoria-ui-return-monkey-island/game.gd" id="5"]
|
||||
[ext_resource type="Texture2D" uid="uid://ce2rx8nm1s6gh" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" id="6"]
|
||||
[ext_resource type="PackedScene" path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn" id="7"]
|
||||
[ext_resource type="PackedScene" path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.tscn" id="8"]
|
||||
[ext_resource type="Theme" uid="uid://bf2eet52fueam" path="res://addons/escoria-ui-return-monkey-island/theme.tres" id="9"]
|
||||
[ext_resource type="Texture2D" uid="uid://doahvd61d05u8" path="res://addons/escoria-ui-return-monkey-island/icons/cog-64-hover.svg" id="10"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvxd4tjmdwj5l" path="res://addons/escoria-ui-return-monkey-island/icons/cog-64.svg" id="11"]
|
||||
[ext_resource type="PackedScene" path="res://addons/escoria-ui-return-monkey-island/video_player/video_player.tscn" id="12"]
|
||||
[ext_resource type="Texture2D" uid="uid://dghklsdy5nmcg" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover.svg" id="13"]
|
||||
[ext_resource type="Script" path="res://addons/escoria-ui-return-monkey-island/MusicButton.gd" id="14"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2sehci16hioi" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover-disabled.svg" id="15"]
|
||||
[ext_resource type="Texture2D" uid="uid://e2xk0aimdte" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-disabled.svg" id="16"]
|
||||
|
||||
[node name="game" type="Node2D"]
|
||||
script = ExtResource( 5 )
|
||||
script = ExtResource("5")
|
||||
main_menu = NodePath("CanvasLayer/main_menu")
|
||||
pause_menu = NodePath("CanvasLayer/pause_menu")
|
||||
mouse_tooltip_margin = 70.0
|
||||
editor_debug_mode = 1
|
||||
ui_parent_control_node = NodePath("CanvasLayer/ui")
|
||||
|
||||
[node name="camera" parent="." instance=ExtResource( 3 )]
|
||||
[node name="camera" parent="." instance=ExtResource("3")]
|
||||
|
||||
[node name="tooltip_layer" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
|
||||
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )]
|
||||
[node name="tooltip" parent="tooltip_layer" instance=ExtResource("4")]
|
||||
z_index = 10
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
offset_from_cursor_action1 = Vector2( 0, 30 )
|
||||
offset_from_cursor_action2 = Vector2( 0, -20 )
|
||||
offset_from_cursor_action3 = Vector2( 0, 30 )
|
||||
offset_from_cursor_action4 = Vector2( 0, -20 )
|
||||
color = Color(1, 1, 1, 1)
|
||||
offset_from_cursor_action1 = Vector2(0, 30)
|
||||
offset_from_cursor_action2 = Vector2(0, -20)
|
||||
offset_from_cursor_action3 = Vector2(0, 30)
|
||||
offset_from_cursor_action4 = Vector2(0, -20)
|
||||
debug_mode = true
|
||||
|
||||
[node name="dialog_layer" type="CanvasLayer" parent="."]
|
||||
layer = 3
|
||||
|
||||
[node name="ESCDialogsPlayer" type="Control" parent="dialog_layer"]
|
||||
theme = ExtResource( 9 )
|
||||
script = ExtResource( 2 )
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
theme = ExtResource("9")
|
||||
script = ExtResource("2")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ui" type="Control" parent="CanvasLayer"]
|
||||
layout_mode = 3
|
||||
anchor_top = 0.9
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -26.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource( 9 )
|
||||
theme = ExtResource("9")
|
||||
|
||||
[node name="menu_button" type="Control" parent="CanvasLayer/ui"]
|
||||
anchors_preset = 0
|
||||
offset_left = 1245.0
|
||||
offset_top = -643.0
|
||||
offset_right = 1245.0
|
||||
@@ -65,6 +70,7 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/ui/menu_button"]
|
||||
layout_mode = 0
|
||||
offset_left = -135.0
|
||||
offset_top = 6.0
|
||||
offset_right = 21.0
|
||||
@@ -72,23 +78,20 @@ offset_bottom = 76.0
|
||||
alignment = 1
|
||||
|
||||
[node name="MusicButton" type="TextureButton" parent="CanvasLayer/ui/menu_button/HBoxContainer"]
|
||||
offset_left = 44.0
|
||||
offset_right = 44.0
|
||||
offset_bottom = 70.0
|
||||
script = ExtResource( 14 )
|
||||
musicEnabledTexture = ExtResource( 6 )
|
||||
musicEnabledHoverTexture = ExtResource( 13 )
|
||||
musicDisabledTexture = ExtResource( 16 )
|
||||
musicDisabledHoverTexture = ExtResource( 15 )
|
||||
layout_mode = 2
|
||||
script = ExtResource("14")
|
||||
musicEnabledTexture = ExtResource("6")
|
||||
musicEnabledHoverTexture = ExtResource("13")
|
||||
musicDisabledTexture = ExtResource("16")
|
||||
musicDisabledHoverTexture = ExtResource("15")
|
||||
|
||||
[node name="MenuButton" type="TextureButton" parent="CanvasLayer/ui/menu_button/HBoxContainer"]
|
||||
offset_left = 48.0
|
||||
offset_right = 112.0
|
||||
offset_bottom = 70.0
|
||||
texture_normal = ExtResource( 11 )
|
||||
texture_hover = ExtResource( 10 )
|
||||
layout_mode = 2
|
||||
texture_normal = ExtResource("11")
|
||||
texture_hover = ExtResource("10")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/ui"]
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 18.0
|
||||
@@ -96,27 +99,31 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Spacer" type="Control" parent="CanvasLayer/ui/HBoxContainer"]
|
||||
offset_right = 1186.0
|
||||
offset_bottom = 90.0
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="inventory_ui" parent="CanvasLayer/ui/HBoxContainer" instance=ExtResource( 1 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = 1190.0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 90.0
|
||||
scale = Vector2( 1, 1 )
|
||||
[node name="inventory_ui" parent="CanvasLayer/ui/HBoxContainer" instance=ExtResource("1")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="pause_menu" parent="CanvasLayer" instance=ExtResource( 8 )]
|
||||
[node name="pause_menu" parent="CanvasLayer" instance=ExtResource("8")]
|
||||
visible = false
|
||||
theme = ExtResource( 9 )
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("9")
|
||||
|
||||
[node name="main_menu" parent="CanvasLayer" instance=ExtResource( 7 )]
|
||||
[node name="main_menu" parent="CanvasLayer" instance=ExtResource("7")]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="video_player" parent="CanvasLayer" instance=ExtResource( 12 )]
|
||||
[node name="video_player" parent="CanvasLayer" instance=ExtResource("12")]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/ui/menu_button/HBoxContainer/MusicButton" to="." method="_on_MusicButton_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/ui/menu_button/HBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
[gd_resource type="Theme" load_steps=5 format=2]
|
||||
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://bf2eet52fueam"]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="FontFile" id=1]
|
||||
[ext_resource type="FontFile" uid="uid://cne31d6e0513y" path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
[sub_resource type="StyleBoxFlat" id="1"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.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_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
expand_margin_left = 19.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
bg_color = Color( 0, 0, 0, 0.509804 )
|
||||
[sub_resource type="StyleBoxFlat" id="2"]
|
||||
bg_color = Color(0, 0, 0, 0.509804)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 0, 0, 0, 0.388235 )
|
||||
[sub_resource type="StyleBoxFlat" id="3"]
|
||||
bg_color = Color(0, 0, 0, 0.388235)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
expand_margin_left = 5.0
|
||||
expand_margin_right = 5.0
|
||||
expand_margin_top = 5.0
|
||||
expand_margin_right = 5.0
|
||||
expand_margin_bottom = 5.0
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource( 1 )
|
||||
Label/colors/font_color = Color( 1, 1, 1, 1 )
|
||||
Label/colors/font_color_shadow = Color( 0, 0, 0, 0 )
|
||||
Label/colors/font_outline_modulate = Color( 1, 0, 0, 1 )
|
||||
Label/colors/label_box_bg = Color( 0, 0, 0, 0.745098 )
|
||||
Label/styles/normal = SubResource( 1 )
|
||||
RichTextLabel/styles/focus = SubResource( 2 )
|
||||
RichTextLabel/styles/normal = SubResource( 3 )
|
||||
default_font = ExtResource("1")
|
||||
Label/colors/font_color = Color(1, 1, 1, 1)
|
||||
Label/colors/font_color_shadow = Color(0, 0, 0, 0)
|
||||
Label/colors/font_outline_modulate = Color(1, 0, 0, 1)
|
||||
Label/colors/label_box_bg = Color(0, 0, 0, 0.745098)
|
||||
Label/styles/normal = SubResource("1")
|
||||
RichTextLabel/styles/focus = SubResource("2")
|
||||
RichTextLabel/styles/normal = SubResource("3")
|
||||
|
||||
Reference in New Issue
Block a user