menu icon, F3 key to show room selector

This commit is contained in:
2023-09-16 21:02:31 +02:00
parent 8674ffffa4
commit 5f15bca474
4 changed files with 49 additions and 28 deletions

View File

@@ -90,7 +90,7 @@ func _ready():
escoria.logger.error(self, "Error connecting tooltip_size_updated with update_tooltip_following_mouse_position")
func _enter_tree():
var room_selector_parent = $CanvasLayer/menu_button/VBoxContainer
var room_selector_parent = $CanvasLayer/ui/menu_button/VBoxContainer
if ESCProjectSettingsManager.get_setting(ESCProjectSettingsManager.ENABLE_ROOM_SELECTOR) \
and room_selector_parent.get_node_or_null("room_select") == null:
@@ -101,6 +101,10 @@ func _enter_tree():
"/room_select.tscn"
).instance()
)
var room_selector = room_selector_parent.get_node_or_null("room_select")
if(room_selector != null):
room_selector.visible = false
var input_handler = funcref(self, "_process_input")
escoria.inputs_manager.register_custom_input_handler(input_handler)
@@ -120,8 +124,18 @@ func _exit_tree():
_on_gamepad_disconnected()
func toggle_room_selector_visibility():
var room_selector_parent = $CanvasLayer/ui/menu_button/VBoxContainer
var room_selector = room_selector_parent.get_node_or_null("room_select")
if(room_selector != null):
room_selector.visible = !room_selector.visible
func _input(event: InputEvent) -> void:
if escoria.get_escoria().is_ready_for_inputs():
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()

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=12 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]
@@ -10,6 +10,7 @@
[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/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]
[node name="game" type="Node2D"]
script = ExtResource( 5 )
@@ -38,6 +39,24 @@ size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource( 9 )
[node name="menu_button" type="Control" parent="CanvasLayer/ui"]
margin_left = 1245.0
margin_top = -644.0
margin_right = 1322.0
margin_bottom = -606.0
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/ui/menu_button"]
margin_left = -52.0
margin_top = 6.0
margin_right = 24.0
margin_bottom = 80.0
[node name="MenuButton" type="Button" parent="CanvasLayer/ui/menu_button/VBoxContainer"]
margin_right = 76.0
margin_bottom = 70.0
icon = ExtResource( 11 )
flat = true
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/ui"]
anchor_right = 1.0
anchor_bottom = 1.0
@@ -65,23 +84,6 @@ theme = ExtResource( 9 )
[node name="main_menu" parent="CanvasLayer" instance=ExtResource( 7 )]
visible = false
[node name="menu_button" type="Control" parent="CanvasLayer"]
margin_left = 1191.0
margin_top = 7.0
margin_right = 1268.0
margin_bottom = 45.0
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/menu_button"]
margin_left = -52.0
margin_top = 6.0
margin_right = 76.0
margin_bottom = 80.0
[node name="MenuButton" type="Button" parent="CanvasLayer/menu_button/VBoxContainer"]
margin_right = 128.0
margin_bottom = 20.0
text = "Menu"
[node name="tooltip_layer" type="CanvasLayer" parent="."]
layer = 2
@@ -103,4 +105,4 @@ color = Color( 1, 1, 1, 1 )
offset_from_cursor_action1 = Vector2( 0, 30 )
offset_from_cursor_action2 = Vector2( 0, -20 )
[connection signal="pressed" from="CanvasLayer/menu_button/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
[connection signal="pressed" from="CanvasLayer/ui/menu_button/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]

View File

@@ -6,15 +6,15 @@ export(Color) var OutLine = Color(0,0,0) setget set_outline_color
export(float) var Width = 2.0 setget set_outline_width
func _draw():
var poly = get_polygon()
for i in range(1 , poly.size()):
draw_line(poly[i-1] , poly[i], OutLine , Width)
draw_line(poly[poly.size() - 1] , poly[0], OutLine , Width)
var poly = get_polygon()
for i in range(1 , poly.size()):
draw_line(poly[i-1] , poly[i], OutLine , Width)
draw_line(poly[poly.size() - 1] , poly[0], OutLine , Width)
func set_outline_color(color):
OutLine = color
update()
OutLine = color
update()
func set_outline_width(new_width):
Width = new_width
update()
Width = new_width
update()

View File

@@ -939,6 +939,11 @@ ui_show_hints={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777237,"unicode":0,"echo":false,"script":null)
]
}
ui_show_room_selector={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777246,"unicode":0,"echo":false,"script":null)
]
}
[locale]