Merge branch 'gymkhana/main' of git.fosil.eu:gymkhana/gymkhana into gymkhana/main

This commit is contained in:
2023-02-24 18:20:42 +01:00
29 changed files with 136 additions and 229 deletions

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/escoria-dialog-simple/chooser/simple.gd" type="Script" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=2]
[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 1, 0, 0, 1, 1, 0, 0, 1 )
@@ -11,6 +12,9 @@ gradient = SubResource( 1 )
[node name="text_dialog_choice" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 547.0
margin_right = 7.0
theme = ExtResource( 2 )
script = ExtResource( 1 )
[node name="MarginContainer" type="MarginContainer" parent="."]
@@ -21,9 +25,6 @@ margin_bottom = 900.0
mouse_filter = 2
custom_constants/margin_top = 20
custom_constants/margin_left = 20
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"]
margin_left = 20.0
@@ -53,9 +54,6 @@ anchor_right = 1.0
rect_min_size = Vector2( 0, 20 )
texture_progress = SubResource( 2 )
nine_patch_stretch = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AvatarContainer" type="Node2D" parent="."]
position = Vector2( 94, 68 )

View File

@@ -16,3 +16,4 @@ corner_radius_bottom_left = 8
[resource]
default_font = ExtResource( 1 )
RichTextLabel/styles/normal = SubResource( 1 )
VBoxContainer/constants/separation = 1

View File

@@ -9,7 +9,7 @@ margin_bottom = 97.0
theme = ExtResource( 2 )
bbcode_enabled = true
bbcode_text = "[center]Here be some text.[/center]"
text = "Here be some text."
text = "[center]Here be some text.[/center]"
fit_content_height = true
script = ExtResource( 1 )

View File

@@ -16,10 +16,10 @@ export(int) var action1_y = 0
export(String) var tooltip2_name
# Action1 tooltip text in inventory
export(String) var inventory_action1_text
export(String) var action3_text
# Action2 tooltip text in inventory
export(String) var inventory_action2_text
export(String) var action4_text
#$tooltips.visible = true;
var action1Tooltip: Object

View File

@@ -1,7 +1,13 @@
extends ESCGame
# Left mouse button on item
const ACTION1 = "action1"
# Right mouse button on item
const ACTION2 = "action2"
# Left mouse button on inventory item
const ACTION3 = "action3"
# Right mouse button on inventory item
const ACTION4 = "action4"
const VERB_USE = "use"
const VERB_WALK = "walk"
@@ -219,10 +225,11 @@ 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
if target_obj is ESCItem:
if target_obj is ESCItem or ESCItemWithTooltip:
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
#$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
if target_obj is ESCPlayer:
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
if target_obj is ESCItemWithTooltip:
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
func element_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")
@@ -272,25 +279,36 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
true
)
if (target_obj is ESCItemWithTooltip) && (action == ACTION1 && target_obj.inventory_action1_text != "") || (action == ACTION2 && target_obj.inventory_action2_text != ""):
if (target_obj is ESCItemWithTooltip) && (action == ACTION3 && target_obj.action3_text != "") || (action == ACTION4 && target_obj.action4_text != ""):
$tooltip_layer/tooltip.hide()
$tooltip_layer/tooltip2.hide()
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
if ACTION1 in target_obj.combine_when_selected_action_is_in:
if ACTION3 in target_obj.combine_when_selected_action_is_in:
Input.set_custom_mouse_cursor(target_obj.inventory_texture)
click_on_inventory_item(inventory_item_global_id, event, ACTION1)
click_on_inventory_item(inventory_item_global_id, event, ACTION3)
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
click_on_inventory_item(inventory_item_global_id, event, ACTION2)
<<<<<<< Updated upstream
click_on_inventory_item(inventory_item_global_id, event, ACTION4)
=======
click_on_inventory_item(inventory_item_global_id, event, VERB_USE)
>>>>>>> Stashed changes
func inventory_item_focused(inventory_item_global_id: String) -> void:
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
if target_obj is ESCItemWithTooltip:
<<<<<<< Updated upstream
$tooltip_layer/tooltip.set_target(target_obj.action3_text)
$tooltip_layer/tooltip2.set_target(target_obj.action4_text)
=======
$tooltip_layer/tooltip.set_target(target_obj.inventory_action1_text)
$tooltip_layer/tooltip2.set_target(target_obj.inventory_action2_text)
if target_obj is ESCPlayer:
$tooltip_layer/tooltip.set_target(target_obj.inventory_action1_text)
>>>>>>> Stashed changes
func inventory_item_unfocused() -> void:

View File

@@ -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://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://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.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/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]
@@ -25,9 +26,6 @@ layer = 3
[node name="ESCDialogsPlayer" type="Control" parent="dialog_layer"]
theme = ExtResource( 9 )
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CanvasLayer" type="CanvasLayer" parent="."]
@@ -48,7 +46,7 @@ size_flags_vertical = 3
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/ui/HBoxContainer"]
margin_right = 58.0
margin_bottom = 90.0
margin_bottom = 101.0
[node name="MenuButton" type="Button" parent="CanvasLayer/ui/HBoxContainer/VBoxContainer"]
margin_right = 58.0
@@ -57,8 +55,8 @@ text = "Menu"
[node name="Spacer" type="Control" parent="CanvasLayer/ui/HBoxContainer"]
margin_left = 62.0
margin_right = 1186.0
margin_bottom = 90.0
margin_right = 1280.0
margin_bottom = 101.0
size_flags_horizontal = 3
[node name="inventory_ui" parent="CanvasLayer/ui/HBoxContainer" instance=ExtResource( 1 )]
@@ -79,16 +77,18 @@ visible = false
[node name="tooltip_layer" type="CanvasLayer" parent="."]
layer = 2
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 6 )]
[node name="tooltipOld" parent="tooltip_layer" instance=ExtResource( 6 )]
mouse_filter = 2
theme = ExtResource( 9 )
bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
offset_from_cursor = Vector2( -10, -50 )
[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
offset_from_cursor = Vector2( -10, 50 )
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )]
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]

View File

@@ -26,6 +26,10 @@ 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_bottom = 5.0
[resource]
default_font = ExtResource( 1 )

View File

@@ -1,8 +1,10 @@
[gd_scene load_steps=2 format=2]
[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

View File

@@ -1,8 +1,10 @@
[gd_scene load_steps=2 format=2]
[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

View File

@@ -29,13 +29,12 @@ func update_tooltip_text():
# 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 = "";
#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]"
bbcode_text += "[/center]"
# push_align(RichTextLabel.ALIGN_CENTER)
# push_color(color)
# append_bbcode(current_target)

View File

@@ -6,7 +6,7 @@ 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
@@ -19,14 +19,12 @@ func update_tooltip_text():
# tooltips are presently dependent on the size of the bounding box around
# the rendered string.
emit_signal("tooltip_size_updated")
bbcode_text = "[center]"
bbcode_text = "[center]"
bbcode_text += "[img]" + "res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/mouse_left.png" + "[/img]"
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]"
bbcode_text += "[/center]"
# push_align(RichTextLabel.ALIGN_CENTER)
# push_color(color)
# append_bbcode(current_target)