Issue 320 (#396) - Mobile fixes
Co-authored-by: Dennis Ploeger <develop@dieploegers.de> Co-authored-by: dploeger <dploeger@users.noreply.github.com>
This commit is contained in:
@@ -30,18 +30,22 @@ Implement methods to react to inputs.
|
||||
- _on_event_done(event_name: String)
|
||||
"""
|
||||
|
||||
onready var verbs_menu = $ui/panel_down/verbs_layer/verbs_menu
|
||||
onready var tooltip = $ui/panel_down/tooltip_layer/tooltip
|
||||
onready var verbs_menu = $ui/Control/panel_down/VBoxContainer/HBoxContainer\
|
||||
/VerbsMargin/verbs_menu
|
||||
onready var tooltip = $ui/Control/panel_down/VBoxContainer/tooltip
|
||||
onready var room_select = $ui/Control/panel_down/VBoxContainer/HBoxContainer\
|
||||
/MainMargin/VBoxContainer/room_select
|
||||
onready var pause_menu = $ui/pause_menu
|
||||
onready var inventory_ui = $ui/Control/panel_down/VBoxContainer/HBoxContainer\
|
||||
/InventoryMargin/inventory_ui
|
||||
|
||||
func _ready():
|
||||
ProjectSettings.set_setting("escoria/ui/tooltip_follows_mouse", false)
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("switch_action_verb"):
|
||||
if event.button_index == BUTTON_WHEEL_UP:
|
||||
escoria.inputs_manager._on_mousewheel_action(-1)
|
||||
elif event.button_index == BUTTON_WHEEL_DOWN:
|
||||
escoria.inputs_manager._on_mousewheel_action(1)
|
||||
escoria.action_manager.connect(
|
||||
"action_finished",
|
||||
self,
|
||||
"_on_action_finished"
|
||||
)
|
||||
|
||||
|
||||
## BACKGROUND ##
|
||||
@@ -90,7 +94,6 @@ func element_focused(element_id: String) -> void:
|
||||
|
||||
func element_unfocused() -> void:
|
||||
tooltip.clear()
|
||||
verbs_menu.unselect_actions()
|
||||
|
||||
|
||||
## ITEMS ##
|
||||
@@ -151,18 +154,18 @@ func mousewheel_action(_direction: int):
|
||||
|
||||
|
||||
func hide_ui():
|
||||
$ui/panel_down.hide()
|
||||
$ui/Control.hide()
|
||||
verbs_menu.hide()
|
||||
$ui/panel_down/verbs_layer/room_select.hide()
|
||||
$ui/panel_down/inventory_layer/inventory_ui.hide()
|
||||
room_select.hide()
|
||||
inventory_ui.hide()
|
||||
tooltip.hide()
|
||||
|
||||
|
||||
func show_ui():
|
||||
$ui/panel_down.show()
|
||||
$ui/Control.show()
|
||||
verbs_menu.show()
|
||||
$ui/panel_down/verbs_layer/room_select.show()
|
||||
$ui/panel_down/inventory_layer/inventory_ui.show()
|
||||
room_select.show()
|
||||
inventory_ui.show()
|
||||
tooltip.show()
|
||||
|
||||
func _on_event_done(_event_name: String):
|
||||
@@ -171,16 +174,24 @@ func _on_event_done(_event_name: String):
|
||||
|
||||
|
||||
func pause_game():
|
||||
if $ui/pause_menu.visible:
|
||||
$ui/pause_menu.hide()
|
||||
if pause_menu.visible:
|
||||
pause_menu.hide()
|
||||
escoria.main.current_scene.game.get_node("camera").current = true
|
||||
escoria.main.current_scene.game.show_ui()
|
||||
escoria.main.current_scene.show()
|
||||
escoria.set_game_paused(false)
|
||||
else:
|
||||
$ui/pause_menu.set_save_enabled(escoria.save_manager.save_enabled)
|
||||
$ui/pause_menu.show()
|
||||
pause_menu.set_save_enabled(escoria.save_manager.save_enabled)
|
||||
pause_menu.show()
|
||||
escoria.main.current_scene.game.get_node("camera").current = false
|
||||
escoria.main.current_scene.game.hide_ui()
|
||||
escoria.main.current_scene.hide()
|
||||
escoria.set_game_paused(true)
|
||||
|
||||
|
||||
func _on_MenuButton_pressed() -> void:
|
||||
pause_game()
|
||||
|
||||
|
||||
func _on_action_finished() -> void:
|
||||
verbs_menu.unselect_actions()
|
||||
|
||||
@@ -18,62 +18,120 @@ script = ExtResource( 5 )
|
||||
|
||||
[node name="ui" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="panel_down" type="PanelContainer" parent="ui"]
|
||||
anchor_top = 0.714
|
||||
[node name="Control" type="Control" parent="ui"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -0.200012
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="panel_down" type="PanelContainer" parent="ui/Control"]
|
||||
anchor_top = 0.7
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 3
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="verbs_layer" type="CanvasLayer" parent="ui/panel_down"]
|
||||
layer = 2
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ui/Control/panel_down"]
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 270.0
|
||||
|
||||
[node name="verbs_menu" parent="ui/panel_down/verbs_layer" instance=ExtResource( 3 )]
|
||||
anchor_top = 0.715
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 52.0
|
||||
margin_top = 38.5
|
||||
margin_right = -959.0
|
||||
margin_bottom = -63.0
|
||||
|
||||
[node name="room_select" parent="ui/panel_down/verbs_layer" instance=ExtResource( 7 )]
|
||||
margin_left = 503.504
|
||||
margin_top = 820.091
|
||||
margin_right = 686.504
|
||||
margin_bottom = 840.091
|
||||
|
||||
[node name="inventory_layer" type="CanvasLayer" parent="ui/panel_down"]
|
||||
layer = 2
|
||||
|
||||
[node name="inventory_ui" parent="ui/panel_down/inventory_layer" instance=ExtResource( 2 )]
|
||||
anchor_top = 0.722
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 752.0
|
||||
margin_top = 31.2
|
||||
margin_right = -63.0
|
||||
margin_bottom = -61.0
|
||||
|
||||
[node name="tooltip_layer" type="CanvasLayer" parent="ui/panel_down"]
|
||||
layer = 2
|
||||
|
||||
[node name="tooltip" parent="ui/panel_down/tooltip_layer" instance=ExtResource( 1 )]
|
||||
anchor_left = 0.132
|
||||
anchor_top = 0.719
|
||||
anchor_right = 0.832
|
||||
anchor_bottom = 0.767
|
||||
margin_left = 0.0272522
|
||||
margin_top = 0.320557
|
||||
margin_right = -0.252686
|
||||
margin_bottom = -0.0794678
|
||||
[node name="tooltip" parent="ui/Control/panel_down/VBoxContainer" instance=ExtResource( 1 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 0.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 0, 32 )
|
||||
script = ExtResource( 8 )
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="ui/Control/panel_down/VBoxContainer"]
|
||||
margin_top = 36.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 46.0
|
||||
custom_constants/separation = 10
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="ui/Control/panel_down/VBoxContainer"]
|
||||
margin_top = 50.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 270.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VerbsMargin" type="MarginContainer" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 424.0
|
||||
margin_bottom = 220.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
custom_constants/margin_bottom = 20
|
||||
|
||||
[node name="verbs_menu" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer/VerbsMargin" instance=ExtResource( 3 )]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 200.0
|
||||
|
||||
[node name="MainMargin" type="MarginContainer" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 428.0
|
||||
margin_right = 852.0
|
||||
margin_bottom = 220.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
custom_constants/margin_bottom = 20
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer/MainMargin"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 200.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer/MainMargin/VBoxContainer"]
|
||||
margin_left = 142.0
|
||||
margin_top = 58.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 98.0
|
||||
rect_min_size = Vector2( 100, 40 )
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 6
|
||||
|
||||
[node name="MenuButton" type="Button" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer/MainMargin/VBoxContainer/MarginContainer"]
|
||||
margin_right = 100.0
|
||||
margin_bottom = 40.0
|
||||
text = "Menu"
|
||||
|
||||
[node name="room_select" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer/MainMargin/VBoxContainer" instance=ExtResource( 7 )]
|
||||
margin_top = 160.0
|
||||
margin_right = 384.0
|
||||
margin_bottom = 180.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="InventoryMargin" type="MarginContainer" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 856.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 220.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
custom_constants/margin_bottom = 20
|
||||
|
||||
[node name="inventory_ui" parent="ui/Control/panel_down/VBoxContainer/HBoxContainer/InventoryMargin" instance=ExtResource( 2 )]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 200.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="dialog_layer" type="CanvasLayer" parent="ui"]
|
||||
layer = 3
|
||||
|
||||
@@ -92,3 +150,5 @@ __meta__ = {
|
||||
visible = false
|
||||
|
||||
[node name="camera" parent="." instance=ExtResource( 6 )]
|
||||
|
||||
[connection signal="pressed" from="ui/Control/panel_down/VBoxContainer/HBoxContainer/MainMargin/VBoxContainer/MarginContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user