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,141 @@
|
||||
class_name DiagnosticDiveScreen
|
||||
extends Control
|
||||
|
||||
signal menu_requested
|
||||
|
||||
const DiveUpdate = preload("res://game/domain/dive/dive_update.gd")
|
||||
const DiveAlertLevel = preload("res://game/domain/dive/dive_alert_level.gd")
|
||||
const DiveTerminalReason = preload("res://game/domain/dive/dive_terminal_reason.gd")
|
||||
const ReturnEstimate = preload("res://game/domain/dive/return_estimate.gd")
|
||||
|
||||
@onready var _status_label: Label = %StatusLabel
|
||||
@onready var _tick_label: Label = %TickLabel
|
||||
@onready var _battery_label: Label = %BatteryLabel
|
||||
@onready var _oxygen_label: Label = %OxygenLabel
|
||||
@onready var _hull_label: Label = %HullLabel
|
||||
@onready var _depth_label: Label = %DepthLabel
|
||||
@onready var _return_label: Label = %ReturnLabel
|
||||
@onready var _alert_label: Label = %AlertLabel
|
||||
@onready var _event_label: Label = %EventLabel
|
||||
@onready var _menu_button: Button = %MenuButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_menu_button.pressed.connect(_on_menu_pressed)
|
||||
|
||||
|
||||
func present(update: DiveUpdate) -> void:
|
||||
if update == null or update.snapshot == null:
|
||||
present_setup_error("Mise à jour de plongée absente")
|
||||
return
|
||||
if not update.accepted:
|
||||
_status_label.text = "ÉTAT · PAS REFUSÉ · %s" % update.rejection_reason
|
||||
else:
|
||||
_status_label.text = "ÉTAT · SIMULATION DÉTERMINISTE · 60 HZ"
|
||||
|
||||
var snapshot = update.snapshot
|
||||
_tick_label.text = "SESSION %s · TICK %d" % [snapshot.session_id, snapshot.tick_sequence]
|
||||
_battery_label.text = (
|
||||
"BATTERIE %.2f / %.2f kWh · %.0f %% · %.1f kW"
|
||||
% [
|
||||
snapshot.battery.remaining_kwh,
|
||||
snapshot.battery.maximum_kwh,
|
||||
snapshot.battery.ratio * 100.0,
|
||||
snapshot.battery.current_power_kw,
|
||||
]
|
||||
)
|
||||
_oxygen_label.text = (
|
||||
"OXYGÈNE %.1f / %.1f L · %.0f %% · %.1f L/min · %.1f min"
|
||||
% [
|
||||
snapshot.oxygen.remaining_l,
|
||||
snapshot.oxygen.maximum_l,
|
||||
snapshot.oxygen.ratio * 100.0,
|
||||
snapshot.oxygen.consumption_l_per_min,
|
||||
snapshot.oxygen.endurance_minutes,
|
||||
]
|
||||
)
|
||||
_hull_label.text = (
|
||||
"COQUE %.1f / %.1f · %.0f %% · %.2f / %.2f bar recommandés"
|
||||
% [
|
||||
snapshot.hull.current_integrity,
|
||||
snapshot.hull.maximum_integrity,
|
||||
snapshot.hull.ratio * 100.0,
|
||||
snapshot.hull.exterior_pressure_bar,
|
||||
snapshot.hull.certified_pressure_bar,
|
||||
]
|
||||
)
|
||||
_depth_label.text = (
|
||||
"PROFONDEUR %.1f m · CERTIFIÉE %.1f m · CRITIQUE %.1f m"
|
||||
% [
|
||||
snapshot.depth.current_m,
|
||||
snapshot.depth.certified_m,
|
||||
snapshot.depth.critical_m,
|
||||
]
|
||||
)
|
||||
_return_label.text = _format_return_estimate(snapshot.return_estimate)
|
||||
_alert_label.text = "ALERTE MAXIMALE · %s" % _alert_level_text(snapshot.alerts.maximum)
|
||||
_event_label.text = (
|
||||
"TERMINAISON · %s · ÉVÉNEMENTS DU PAS · %d"
|
||||
% [_terminal_reason_text(snapshot.terminal_reason), update.events.size()]
|
||||
)
|
||||
|
||||
|
||||
func present_setup_error(message: String) -> void:
|
||||
_status_label.text = "ÉTAT · INITIALISATION IMPOSSIBLE"
|
||||
_tick_label.text = message
|
||||
|
||||
|
||||
func _on_menu_pressed() -> void:
|
||||
menu_requested.emit()
|
||||
|
||||
|
||||
func _format_return_estimate(estimate: ReturnEstimate) -> String:
|
||||
match estimate.status:
|
||||
ReturnEstimate.Status.UNKNOWN:
|
||||
return "RETOUR · ESTIMATION INCONNUE"
|
||||
ReturnEstimate.Status.SAFE:
|
||||
return "RETOUR %.2f kWh requis · MARGE %.2f kWh · SÛR" % [
|
||||
estimate.required_kwh,
|
||||
estimate.margin_kwh,
|
||||
]
|
||||
ReturnEstimate.Status.TIGHT:
|
||||
return "RETOUR %.2f kWh requis · MARGE %.2f kWh · SERRÉ" % [
|
||||
estimate.required_kwh,
|
||||
estimate.margin_kwh,
|
||||
]
|
||||
ReturnEstimate.Status.INSUFFICIENT:
|
||||
return "RETOUR %.2f kWh requis · MANQUE %.2f kWh" % [
|
||||
estimate.required_kwh,
|
||||
absf(estimate.margin_kwh),
|
||||
]
|
||||
return "RETOUR · ÉTAT INCONNU"
|
||||
|
||||
|
||||
func _alert_level_text(level: DiveAlertLevel.Value) -> String:
|
||||
match level:
|
||||
DiveAlertLevel.Value.NORMAL:
|
||||
return tr("NORMAL")
|
||||
DiveAlertLevel.Value.ATTENTION:
|
||||
return tr("ATTENTION")
|
||||
DiveAlertLevel.Value.RETURN:
|
||||
return tr("RETOUR")
|
||||
DiveAlertLevel.Value.CRITICAL:
|
||||
return tr("CRITIQUE")
|
||||
DiveAlertLevel.Value.FAILURE:
|
||||
return tr("DÉFAILLANCE")
|
||||
return tr("INCONNU")
|
||||
|
||||
|
||||
func _terminal_reason_text(reason: DiveTerminalReason.Value) -> String:
|
||||
match reason:
|
||||
DiveTerminalReason.Value.NONE:
|
||||
return tr("EN COURS")
|
||||
DiveTerminalReason.Value.RETURNED:
|
||||
return tr("RETOUR")
|
||||
DiveTerminalReason.Value.VOLUNTARY_EJECTION:
|
||||
return tr("ÉJECTION VOLONTAIRE")
|
||||
DiveTerminalReason.Value.OXYGEN_DEPLETED:
|
||||
return tr("OXYGÈNE ÉPUISÉ")
|
||||
DiveTerminalReason.Value.HULL_DESTROYED:
|
||||
return tr("COQUE DÉTRUITE")
|
||||
return tr("INCONNU")
|
||||
@@ -0,0 +1,119 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://game/presentation/diagnostic/diagnostic_dive_screen.gd" id="1_screen"]
|
||||
|
||||
[node name="DiagnosticDiveScreen" type="Control"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_screen")
|
||||
|
||||
[node name="Background" 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.0118, 0.0549, 0.0745, 1)
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 72.0
|
||||
offset_top = 56.0
|
||||
offset_right = -72.0
|
||||
offset_bottom = -56.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Rows" type="VBoxContainer" parent="Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 18
|
||||
|
||||
[node name="Title" type="Label" parent="Margin/Rows"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.4549, 0.8902, 0.898, 1)
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "RANSOM'S WAKE · DIAGNOSTIC DE PLONGÉE"
|
||||
|
||||
[node name="StatusLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.7647, 0.8157, 0.8275, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "ÉTAT · INITIALISATION"
|
||||
|
||||
[node name="Separator" type="HSeparator" parent="Margin/Rows"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TickLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "SESSION — · TICK —"
|
||||
|
||||
[node name="BatteryLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "BATTERIE —"
|
||||
|
||||
[node name="OxygenLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "OXYGÈNE —"
|
||||
|
||||
[node name="HullLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "COQUE —"
|
||||
|
||||
[node name="DepthLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "PROFONDEUR —"
|
||||
|
||||
[node name="ReturnLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.9098, 0.7686, 0.4039, 1)
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "RETOUR —"
|
||||
|
||||
[node name="AlertLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "ALERTE MAXIMALE —"
|
||||
|
||||
[node name="EventLabel" type="Label" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.7647, 0.8157, 0.8275, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "TERMINAISON — · ÉVÉNEMENTS —"
|
||||
|
||||
[node name="MenuButton" type="Button" parent="Margin/Rows"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(260, 44)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
text = "RETOUR AU MENU"
|
||||
|
||||
[node name="Note" type="Label" parent="Margin/Rows"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 10
|
||||
theme_override_colors/font_color = Color(0.4824, 0.5804, 0.6078, 1)
|
||||
text = "Écran technique temporaire · aucune règle de gameplay n'est calculée ici."
|
||||
vertical_alignment = 2
|
||||
Reference in new issue
Block a user