From 1b379928272cafed74a7941bf695763a66d8240c Mon Sep 17 00:00:00 2001 From: Eneko Nieto Date: Mon, 13 Feb 2023 23:30:39 +0100 Subject: [PATCH] Delete unused mouse verbs --- .../escoria-ui-return-monkey-island/game.gd | 55 ----------- .../escoria-ui-return-monkey-island/game.tscn | 13 --- .../verbs_mouseicons.gd | 53 ----------- .../verbs_mouseicons.tscn | 91 ------------------- gymkhana/rooms/home/room01.tscn | 7 +- 5 files changed, 1 insertion(+), 218 deletions(-) delete mode 100644 gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd delete mode 100644 gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.tscn diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/game.gd b/gymkhana/addons/escoria-ui-return-monkey-island/game.gd index a0a5e66a..9edcd843 100644 --- a/gymkhana/addons/escoria-ui-return-monkey-island/game.gd +++ b/gymkhana/addons/escoria-ui-return-monkey-island/game.gd @@ -199,8 +199,6 @@ func click_on_bg(position: Vector2) -> void: [escoria.main.current_scene.player.global_id, position], true ) - $mouse_layer/verbs_menu.set_by_name(VERB_WALK) - $mouse_layer/verbs_menu.clear_tool_texture() func left_click_on_bg(position: Vector2) -> void: click_on_bg(position) @@ -215,8 +213,6 @@ func left_double_click_on_bg(position: Vector2) -> void: [escoria.main.current_scene.player.global_id, position, true], true ) - $mouse_layer/verbs_menu.set_by_name(VERB_WALK) - $mouse_layer/verbs_menu.clear_tool_texture() ## ITEM/HOTSPOT FOCUS ## @@ -225,14 +221,6 @@ func element_focused(element_id: String) -> void: $tooltip_layer/tooltip.set_target(target_obj.tooltip_name) $tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name) - if escoria.action_manager.current_action != VERB_USE \ - and escoria.action_manager.current_tool == null \ - and target_obj is ESCItem: - - $mouse_layer/verbs_menu.set_by_name( - target_obj.default_action - ) - func element_unfocused() -> void: $tooltip_layer/tooltip.set_target("") $tooltip_layer/tooltip2.set_target("") @@ -244,14 +232,6 @@ func click_on_item(item_global_id: String, event: InputEvent, action: String) -> var target_obj = escoria.object_manager.get_object(item_global_id).node - # current_action will be empty if an event completes between when you stop - # moving the mouse and when you click. - if escoria.action_manager.current_action == "": - if target_obj is ESCItem: - $mouse_layer/verbs_menu.set_by_name( - target_obj.default_action - ) - escoria.action_manager.do( escoria.action_manager.ACTION.ITEM_LEFT_CLICK, [item_global_id, event], @@ -283,26 +263,6 @@ func left_click_on_inventory_item(inventory_item_global_id: String, event: Input [inventory_item_global_id, event] ) - if escoria.action_manager.current_action == VERB_USE: - var item = escoria.object_manager.get_object( - inventory_item_global_id - ).node - if item.has_method("get_sprite") and item.get_sprite().texture: - $mouse_layer/verbs_menu.set_tool_texture( - item.get_sprite().texture - ) - elif item.inventory_item.texture_normal: - $mouse_layer/verbs_menu.set_tool_texture( - item.inventory_item.texture_normal - ) - -# func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void: -# mousewheel_action(1) - - -# func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void: -# pass - func inventory_item_focused(inventory_item_global_id: String) -> void: $tooltip_layer/tooltip.set_target( @@ -316,24 +276,16 @@ 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() - func close_inventory(): $CanvasLayer/ui/HBoxContainer/inventory_ui.hide_inventory() - -# func mousewheel_action(direction: int): -# $mouse_layer/verbs_menu.iterate_actions_cursor(direction) - - func hide_ui(): $CanvasLayer/ui/HBoxContainer/inventory_ui.hide() $CanvasLayer/ui.hide() - func show_ui(): $CanvasLayer/ui/HBoxContainer/inventory_ui.show() $CanvasLayer/ui.show() @@ -437,16 +389,9 @@ func update_tooltip2_following_mouse_position(): tooltip2_node.rect_position = corrected_position + tooltip2_node.offset_from_cursor - -func _on_action_finished(): - $mouse_layer/verbs_menu.clear_tool_texture() - $mouse_layer/verbs_menu.iterate_actions_cursor(0) - - func _on_event_done(return_code: int, _event_name: String): if return_code == ESCExecution.RC_OK: escoria.action_manager.clear_current_action() - $mouse_layer/verbs_menu.clear_tool_texture() $tooltip_layer/tooltip.show() $tooltip_layer/tooltip2.show() diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/game.tscn b/gymkhana/addons/escoria-ui-return-monkey-island/game.tscn index 71721122..82943f16 100644 --- a/gymkhana/addons/escoria-ui-return-monkey-island/game.tscn +++ b/gymkhana/addons/escoria-ui-return-monkey-island/game.tscn @@ -3,7 +3,6 @@ [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/verbs_mouseicons.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] @@ -95,16 +94,4 @@ fit_content_height = true [node name="mouse_layer" type="CanvasLayer" parent="."] layer = 2 -[node name="verbs_menu" parent="mouse_layer" instance=ExtResource( 4 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 156.0 -margin_top = 810.0 -margin_right = 156.0 -margin_bottom = 900.0 -grow_horizontal = 0 -size_flags_horizontal = 2 -size_flags_vertical = 3 -size_flags_stretch_ratio = 3.0 - [connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"] diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd b/gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd deleted file mode 100644 index 0e050e28..00000000 --- a/gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd +++ /dev/null @@ -1,53 +0,0 @@ -extends Control - - -var current_cursor_id: int = 0 -onready var cursors: Array = $actions.get_children() - - -""" -This script is out of Escoria's scope. It controls the UI reaction to an -UI event (eg right click) to change the cursor accordingly. -""" -enum UI_ACTIONS_DIRECTION { - UP = 1, - DOWN = -1 -} - -func _ready(): - if !Engine.is_editor_hint(): - current_cursor_id = cursors.size() - iterate_actions_cursor(UI_ACTIONS_DIRECTION.UP) - -func _process(delta): - $mouse_position.rect_global_position = get_global_mouse_position() - - -func iterate_actions_cursor(direction: int): - current_cursor_id += direction - if current_cursor_id > cursors.size() - 1: - current_cursor_id = 0 - elif current_cursor_id < 0: - current_cursor_id = cursors.size() - 1 - - # Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture) - escoria.action_manager.set_current_action(cursors[current_cursor_id].name) - if $mouse_position/tool.texture != null: - clear_tool_texture() - -func set_by_name(name: String) -> void: - for i in cursors.size(): - if cursors[i].name == name: - current_cursor_id = i - break - - # Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture) - escoria.action_manager.set_current_action(cursors[current_cursor_id].name) - -func set_tool_texture(texture: Texture): - set_process(true) - $mouse_position/tool.texture = texture - -func clear_tool_texture(): - $mouse_position/tool.texture = null - set_process(false) diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.tscn b/gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.tscn deleted file mode 100644 index 3dec0e54..00000000 --- a/gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.tscn +++ /dev/null @@ -1,91 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd" type="Script" id=1] -[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_examine.png" type="Texture" id=2] -[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_tool.png" type="Texture" id=3] -[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_dialog.png" type="Texture" id=4] -[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_foot.png" type="Texture" id=5] -[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/cursors/cursor_hand.png" type="Texture" id=6] - -[node name="verbs_menu" type="Control"] -anchor_right = 1.0 -anchor_bottom = 1.0 -script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="actions" type="HBoxContainer" parent="."] -visible = false -anchor_right = 1.0 -anchor_bottom = 1.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="walk" type="TextureRect" parent="actions"] -margin_left = 94.0 -margin_top = 418.0 -margin_right = 158.0 -margin_bottom = 482.0 -size_flags_horizontal = 6 -size_flags_vertical = 6 -texture = ExtResource( 5 ) - -[node name="look" type="TextureRect" parent="actions"] -margin_left = 350.0 -margin_top = 418.0 -margin_right = 414.0 -margin_bottom = 482.0 -size_flags_horizontal = 6 -size_flags_vertical = 6 -texture = ExtResource( 2 ) - -[node name="pickup" type="TextureRect" parent="actions"] -margin_left = 607.0 -margin_top = 418.0 -margin_right = 671.0 -margin_bottom = 482.0 -size_flags_horizontal = 6 -size_flags_vertical = 6 -texture = ExtResource( 6 ) - -[node name="use" type="TextureRect" parent="actions"] -margin_left = 864.0 -margin_top = 418.0 -margin_right = 928.0 -margin_bottom = 482.0 -size_flags_horizontal = 6 -size_flags_vertical = 6 -texture = ExtResource( 3 ) - -[node name="talk" type="TextureRect" parent="actions"] -margin_left = 1121.0 -margin_top = 418.0 -margin_right = 1185.0 -margin_bottom = 482.0 -size_flags_horizontal = 6 -size_flags_vertical = 6 -texture = ExtResource( 4 ) - -[node name="mouse_position" type="Control" parent="."] -margin_left = 546.519 -margin_top = 524.76 -margin_right = 546.519 -margin_bottom = 524.76 -mouse_filter = 2 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="tool" type="TextureRect" parent="mouse_position"] -margin_left = 46.4475 -margin_top = 45.6984 -margin_right = 86.4475 -margin_bottom = 85.6984 -mouse_filter = 2 -__meta__ = { -"_edit_use_anchors_": false -} diff --git a/gymkhana/rooms/home/room01.tscn b/gymkhana/rooms/home/room01.tscn index 74221af6..92274bef 100644 --- a/gymkhana/rooms/home/room01.tscn +++ b/gymkhana/rooms/home/room01.tscn @@ -92,7 +92,6 @@ tooltip_name = "Exit to room 2" default_action = "walk" combine_when_selected_action_is_in = [ ] dialog_color = Color( 1, 1, 1, 1 ) -animations = null [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door"] polygon = PoolVector2Array( 1173, 63, 1278, 106, 1278, 420, 1172, 356 ) @@ -107,11 +106,10 @@ script = ExtResource( 5 ) global_id = "r1_wall_item1" esc_script = "res://gymkhana/rooms/home/esc/wall_item.esc" tooltip_name = "This is action1" -tooltip2_name = "This is action2" combine_when_selected_action_is_in = [ ] inventory_texture = ExtResource( 10 ) dialog_color = Color( 1, 1, 1, 1 ) -animations = null +tooltip2_name = "This is action2" [node name="Art1" type="Sprite" parent="Hotspots/artwork1"] position = Vector2( 470, 140 ) @@ -134,7 +132,6 @@ custom_fonts/font = ExtResource( 3 ) text = "If you look at this object, the character's speech will appear above his head" __meta__ = { -"_edit_use_anchors_": false, "_editor_description_": "" } @@ -148,7 +145,6 @@ default_action = "action2" combine_when_selected_action_is_in = [ ] inventory_texture = ExtResource( 9 ) dialog_color = Color( 1, 1, 1, 1 ) -animations = null [node name="Art12" type="Sprite" parent="Hotspots/artwork2"] position = Vector2( 830, 140 ) @@ -184,7 +180,6 @@ is_trigger = true player_orients_on_arrival = false combine_when_selected_action_is_in = [ ] dialog_color = Color( 1, 1, 1, 1 ) -animations = null [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/trigger_talk"] polygon = PoolVector2Array( 1027, 352, 1187, 502, 1249.67, 445.131, 1123, 351 )