Implement production vertical slice foundation
This commit is contained in:
1 parent
9d4a89f355
commit
a18e82eb44
104 files changed
+10595
-268
No files matched your search
@@ -0,0 +1,67 @@
|
||||
class_name ControlsSettingsScreen
|
||||
extends Control
|
||||
|
||||
signal rebind_requested(action_id: StringName)
|
||||
signal restore_defaults_requested
|
||||
signal conflict_resolution_requested(swap_bindings: bool)
|
||||
signal back_requested
|
||||
|
||||
const InputBindingSnapshot = preload(
|
||||
"res://game/application/input/input_binding_snapshot.gd"
|
||||
)
|
||||
const RebindResult = preload("res://game/application/input/rebind_result.gd")
|
||||
|
||||
@onready var _rows: VBoxContainer = %Rows
|
||||
@onready var _status_label: Label = %StatusLabel
|
||||
@onready var _conflict_panel: PanelContainer = %ConflictPanel
|
||||
@onready var _conflict_label: Label = %ConflictLabel
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
%RestoreButton.pressed.connect(func() -> void: restore_defaults_requested.emit())
|
||||
%BackButton.pressed.connect(func() -> void: back_requested.emit())
|
||||
%SwapButton.pressed.connect(func() -> void: conflict_resolution_requested.emit(true))
|
||||
%CancelConflictButton.pressed.connect(
|
||||
func() -> void: conflict_resolution_requested.emit(false)
|
||||
)
|
||||
_conflict_panel.visible = false
|
||||
|
||||
|
||||
func present_bindings(bindings: Array[InputBindingSnapshot]) -> void:
|
||||
for child: Node in _rows.get_children():
|
||||
child.queue_free()
|
||||
for binding: InputBindingSnapshot in bindings:
|
||||
var row := HBoxContainer.new()
|
||||
row.custom_minimum_size.y = 42.0
|
||||
var label := Label.new()
|
||||
label.text = binding.label
|
||||
label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
var button := Button.new()
|
||||
button.custom_minimum_size.x = 180.0
|
||||
button.text = binding.binding_text
|
||||
button.pressed.connect(_on_binding_button_pressed.bind(binding.action_id))
|
||||
row.add_child(label)
|
||||
row.add_child(button)
|
||||
_rows.add_child(row)
|
||||
|
||||
|
||||
func _on_binding_button_pressed(action_id: StringName) -> void:
|
||||
rebind_requested.emit(action_id)
|
||||
|
||||
|
||||
func present_rebind_result(result: RebindResult) -> void:
|
||||
_status_label.text = result.message
|
||||
if result.conflicting_action_id.is_empty():
|
||||
_conflict_panel.visible = false
|
||||
return
|
||||
_conflict_label.text = (
|
||||
"La touche %s est déjà utilisée. Permuter les deux commandes ?"
|
||||
% result.binding_text
|
||||
)
|
||||
_conflict_panel.visible = true
|
||||
|
||||
|
||||
func show_waiting_for_key() -> void:
|
||||
_status_label.text = "Appuyez sur une touche · Échap pour annuler"
|
||||
_conflict_panel.visible = false
|
||||
@@ -0,0 +1,108 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://game/presentation/settings/controls_settings_screen.gd" id="1_controls"]
|
||||
|
||||
[node name="ControlsSettingsScreen" type="Control"]
|
||||
process_mode = 3
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_controls")
|
||||
|
||||
[node name="Dim" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.01, 0.025, 0.04, 0.96)
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 190.0
|
||||
offset_top = 42.0
|
||||
offset_right = -190.0
|
||||
offset_bottom = -42.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Layout" type="VBoxContainer" parent="Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="Title" type="Label" parent="Margin/Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.45, 0.89, 0.9, 1)
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "RÉGLAGES · COMMANDES"
|
||||
|
||||
[node name="Description" type="Label" parent="Margin/Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.65, 0.73, 0.75, 1)
|
||||
text = "Le clavier oriente le sous-marin. La souris déplace uniquement le regard."
|
||||
|
||||
[node name="Rows" type="VBoxContainer" parent="Margin/Layout"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 5
|
||||
|
||||
[node name="StatusLabel" type="Label" parent="Margin/Layout"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 30)
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.91, 0.77, 0.4, 1)
|
||||
text = "Sélectionnez une commande à remapper."
|
||||
|
||||
[node name="ConflictPanel" type="PanelContainer" parent="Margin/Layout"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ConflictLayout" type="VBoxContainer" parent="Margin/Layout/ConflictPanel"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ConflictLabel" type="Label" parent="Margin/Layout/ConflictPanel/ConflictLayout"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Cette touche est déjà utilisée."
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Actions" type="HBoxContainer" parent="Margin/Layout/ConflictPanel/ConflictLayout"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="CancelConflictButton" type="Button" parent="Margin/Layout/ConflictPanel/ConflictLayout/Actions"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(150, 42)
|
||||
layout_mode = 2
|
||||
text = "ANNULER"
|
||||
|
||||
[node name="SwapButton" type="Button" parent="Margin/Layout/ConflictPanel/ConflictLayout/Actions"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(150, 42)
|
||||
layout_mode = 2
|
||||
text = "PERMUTER"
|
||||
|
||||
[node name="Footer" type="HBoxContainer" parent="Margin/Layout"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="RestoreButton" type="Button" parent="Margin/Layout/Footer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(220, 44)
|
||||
layout_mode = 2
|
||||
text = "VALEURS PAR DÉFAUT"
|
||||
|
||||
[node name="BackButton" type="Button" parent="Margin/Layout/Footer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(160, 44)
|
||||
layout_mode = 2
|
||||
text = "RETOUR"
|
||||
Reference in new issue
Block a user