Age battle UI toward ancient tablets

This commit is contained in:
2026-06-19 03:20:34 +09:00
parent 6e243b0434
commit ce0ca3177f
3 changed files with 188 additions and 98 deletions

View File

@@ -53,11 +53,11 @@ const UNIT_ARROW_ATTACK_DURATION := 0.36
const UNIT_COMMAND_ATTACK_DURATION := 0.38
const UNIT_HEAVY_ATTACK_DURATION := 0.34
const UNIT_TACTIC_CAST_DURATION := 0.42
const DIALOGUE_PANEL_POSITION := Vector2(96, 424)
const DIALOGUE_PANEL_SIZE := Vector2(1040, 236)
const DIALOGUE_PORTRAIT_SIZE := Vector2(164, 208)
const DIALOGUE_COLUMN_SIZE := Vector2(820, 208)
const DIALOGUE_TEXT_SIZE := Vector2(800, 104)
const DIALOGUE_PANEL_POSITION := Vector2(72, 396)
const DIALOGUE_PANEL_SIZE := Vector2(1100, 260)
const DIALOGUE_PORTRAIT_SIZE := Vector2(184, 224)
const DIALOGUE_COLUMN_SIZE := Vector2(850, 226)
const DIALOGUE_TEXT_SIZE := Vector2(830, 112)
const BRIEFING_CAMP_THUMBNAIL_SIZE := Vector2(138, 72)
const CAMP_TALK_PORTRAIT_SIZE := Vector2(58, 58)
const SHOP_MERCHANT_BADGE_SIZE := Vector2(50, 50)
@@ -69,8 +69,8 @@ const POST_MOVE_PICKER_PANEL_SIZE := Vector2(320, 210)
const TARGETING_HINT_PANEL_SIZE := Vector2(240, 94)
const LOCAL_COMMAND_PANEL_GAP := 8.0
const LOCAL_COMMAND_PANEL_BOARD_PADDING := 4.0
const UI_RICE_PAPER := Color(0.66, 0.55, 0.36, 0.97)
const UI_RICE_PAPER_LIGHT := Color(0.76, 0.64, 0.43, 0.98)
const UI_RICE_PAPER := Color(0.61, 0.49, 0.30, 0.98)
const UI_RICE_PAPER_LIGHT := Color(0.74, 0.60, 0.36, 0.99)
const UI_RICE_PAPER_DARK := Color(0.34, 0.22, 0.11, 0.98)
const UI_AGED_INK := Color(0.09, 0.055, 0.032, 1.0)
const UI_DARK_LACQUER := Color(0.12, 0.045, 0.025, 0.98)
@@ -78,6 +78,7 @@ const UI_LACQUER_EDGE := Color(0.055, 0.025, 0.016, 1.0)
const UI_CINNABAR := Color(0.52, 0.045, 0.025, 1.0)
const UI_CINNABAR_DARK := Color(0.32, 0.025, 0.016, 1.0)
const UI_OLD_BRONZE := Color(0.78, 0.58, 0.27, 1.0)
const UI_TARNISHED_BRONZE := Color(0.50, 0.36, 0.16, 1.0)
const UI_BAMBOO := Color(0.43, 0.27, 0.10, 1.0)
const UI_BAMBOO_DARK := Color(0.20, 0.11, 0.045, 1.0)
const UI_MUTED_JADE := Color(0.16, 0.30, 0.23, 1.0)
@@ -85,6 +86,7 @@ const UI_PARCHMENT_TEXT := Color(0.95, 0.82, 0.55, 1.0)
const UI_DISABLED_TEXT := Color(0.48, 0.40, 0.29, 1.0)
const UI_SILK_WASH := Color(0.80, 0.64, 0.37, 1.0)
const UI_SILK_FIBER := Color(0.18, 0.10, 0.045, 1.0)
const UI_SOOT_EDGE := Color(0.035, 0.018, 0.012, 1.0)
const MAP_SCROLL_FRAME_PADDING := 12.0
var state: BattleState = BattleStateScript.new()
@@ -303,13 +305,35 @@ func _make_panel_style(fill: Color, border: Color, border_width: int, radius: in
style.content_margin_right = margin
style.content_margin_top = margin
style.content_margin_bottom = margin
style.anti_aliasing = false
if shadow_size > 0:
style.shadow_color = Color(0.0, 0.0, 0.0, 0.38)
style.shadow_offset = Vector2(2, 3)
style.shadow_color = Color(0.0, 0.0, 0.0, 0.48)
style.shadow_offset = Vector2(3, 4)
style.shadow_size = shadow_size
return style
func _age_panel_style(style: StyleBoxFlat, variant: String, border_width: int) -> void:
if style == null:
return
match variant:
"paper", "dialogue", "result_tablet":
style.set_border_width(SIDE_TOP, border_width + 4)
style.set_border_width(SIDE_BOTTOM, border_width + 4)
style.set_border_width(SIDE_LEFT, border_width + 1)
style.set_border_width(SIDE_RIGHT, border_width + 1)
style.content_margin_top += 2
style.content_margin_bottom += 2
"edict", "speech_scroll", "bamboo_slips":
style.set_border_width(SIDE_TOP, border_width + 2)
style.set_border_width(SIDE_BOTTOM, border_width + 2)
"seal", "speaker_seal", "caption":
style.set_border_width(SIDE_LEFT, border_width + 2)
style.set_border_width(SIDE_RIGHT, border_width + 2)
_:
pass
func _apply_panel_style(panel: PanelContainer, variant: String) -> void:
if panel == null:
return
@@ -321,79 +345,102 @@ func _apply_panel_style(panel: PanelContainer, variant: String) -> void:
var shadow_size := 6
match variant:
"paper":
fill = Color(0.58, 0.47, 0.29, 0.985)
border = UI_AGED_INK
border_width = 4
margin = 16
shadow_size = 10
fill = Color(0.49, 0.37, 0.21, 0.992)
border = UI_SOOT_EDGE
border_width = 5
margin = 18
shadow_size = 12
"edict":
fill = Color(0.73, 0.60, 0.38, 0.99)
border = UI_CINNABAR_DARK
border_width = 3
margin = 12
shadow_size = 5
"seal":
fill = UI_CINNABAR
border = UI_OLD_BRONZE
border_width = 2
margin = 8
"speaker_seal":
fill = UI_CINNABAR_DARK
border = UI_OLD_BRONZE
border_width = 2
margin = 8
"portrait":
fill = UI_LACQUER_EDGE
border = UI_OLD_BRONZE
border_width = 3
margin = 3
"dialogue":
fill = Color(0.075, 0.028, 0.017, 0.99)
border = UI_OLD_BRONZE
fill = Color(0.67, 0.53, 0.31, 0.995)
border = UI_SOOT_EDGE
border_width = 4
margin = 14
shadow_size = 12
shadow_size = 6
"seal":
fill = Color(0.42, 0.035, 0.020, 1.0)
border = UI_OLD_BRONZE
border_width = 3
margin = 9
"speaker_seal":
fill = Color(0.36, 0.030, 0.018, 1.0)
border = UI_OLD_BRONZE
border_width = 3
margin = 9
"portrait":
fill = UI_LACQUER_EDGE
border = UI_TARNISHED_BRONZE
border_width = 4
margin = 3
"dialogue":
fill = Color(0.052, 0.022, 0.014, 0.995)
border = UI_TARNISHED_BRONZE
border_width = 5
margin = 16
shadow_size = 14
"speech_scroll":
fill = Color(0.70, 0.58, 0.36, 0.99)
border = UI_AGED_INK
border_width = 3
margin = 12
shadow_size = 2
fill = Color(0.69, 0.55, 0.32, 0.995)
border = UI_SOOT_EDGE
border_width = 4
margin = 14
shadow_size = 3
"notice":
fill = Color(0.18, 0.065, 0.032, 0.97)
fill = Color(0.23, 0.048, 0.024, 0.98)
border = UI_CINNABAR
border_width = 2
margin = 8
"map":
fill = Color(0.12, 0.16, 0.11, 1.0)
border = UI_BAMBOO
border_width = 3
margin = 9
"map":
fill = Color(0.105, 0.12, 0.075, 1.0)
border = UI_BAMBOO_DARK
border_width = 4
margin = 3
"compact":
fill = Color(0.13, 0.065, 0.035, 0.97)
border = UI_OLD_BRONZE
border_width = 2
margin = 7
fill = Color(0.105, 0.046, 0.026, 0.982)
border = UI_TARNISHED_BRONZE
border_width = 3
margin = 8
shadow_size = 4
"bamboo_slips":
fill = Color(0.54, 0.40, 0.20, 0.985)
border = UI_BAMBOO_DARK
border_width = 3
margin = 10
shadow_size = 3
"caption":
fill = Color(0.21, 0.095, 0.040, 0.98)
border = UI_TARNISHED_BRONZE
border_width = 2
margin = 5
shadow_size = 2
"result_tablet":
fill = Color(0.45, 0.34, 0.20, 0.992)
border = UI_SOOT_EDGE
border_width = 5
margin = 18
shadow_size = 12
_:
pass
panel.add_theme_stylebox_override("panel", _make_panel_style(fill, border, border_width, radius, margin, shadow_size))
var style := _make_panel_style(fill, border, border_width, radius, margin, shadow_size)
_age_panel_style(style, variant, border_width)
panel.add_theme_stylebox_override("panel", style)
func _make_button_style(fill: Color, border: Color, border_width: int) -> StyleBoxFlat:
return _make_panel_style(fill, border, border_width, 0, 8, 0)
var style := _make_panel_style(fill, border, border_width, 0, 8, 0)
style.set_border_width(SIDE_TOP, border_width + 1)
style.set_border_width(SIDE_BOTTOM, border_width + 1)
return style
func _apply_button_style(button: Button, important: bool = false) -> void:
if button == null:
return
var normal_fill := UI_CINNABAR if important else Color(0.21, 0.075, 0.04, 0.98)
var hover_fill := Color(0.58, 0.12, 0.055, 1.0) if important else Color(0.32, 0.12, 0.055, 1.0)
var pressed_fill := Color(0.36, 0.045, 0.03, 1.0)
button.add_theme_stylebox_override("normal", _make_button_style(normal_fill, UI_OLD_BRONZE, 1))
button.add_theme_stylebox_override("hover", _make_button_style(hover_fill, UI_OLD_BRONZE, 1))
button.add_theme_stylebox_override("pressed", _make_button_style(pressed_fill, UI_OLD_BRONZE, 1))
button.add_theme_stylebox_override("focus", _make_button_style(Color(0.20, 0.36, 0.28, 0.95), UI_OLD_BRONZE, 2))
var normal_fill := UI_CINNABAR_DARK if important else Color(0.17, 0.068, 0.033, 0.985)
var hover_fill := Color(0.50, 0.090, 0.040, 1.0) if important else Color(0.28, 0.10, 0.045, 1.0)
var pressed_fill := Color(0.27, 0.034, 0.020, 1.0)
button.add_theme_stylebox_override("normal", _make_button_style(normal_fill, UI_TARNISHED_BRONZE, 2))
button.add_theme_stylebox_override("hover", _make_button_style(hover_fill, UI_OLD_BRONZE, 2))
button.add_theme_stylebox_override("pressed", _make_button_style(pressed_fill, UI_OLD_BRONZE, 2))
button.add_theme_stylebox_override("focus", _make_button_style(Color(0.12, 0.25, 0.18, 0.96), UI_OLD_BRONZE, 2))
button.add_theme_stylebox_override("disabled", _make_button_style(Color(0.13, 0.09, 0.065, 0.88), UI_RICE_PAPER_DARK, 1))
button.add_theme_color_override("font_color", UI_PARCHMENT_TEXT)
button.add_theme_color_override("font_hover_color", UI_PARCHMENT_TEXT)
@@ -455,14 +502,33 @@ func _make_scroll_rod(width: float = 0.0, height: float = 4.0) -> HBoxContainer:
return row
func _make_section_caption(text: String, width: float = 0.0) -> Label:
func _make_section_caption(text: String, width: float = 0.0) -> Control:
var panel := PanelContainer.new()
panel.custom_minimum_size = Vector2(width, 24)
panel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
_apply_panel_style(panel, "caption")
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 8)
panel.add_child(row)
row.add_child(_make_seal_tick())
var label := Label.new()
label.text = text
label.custom_minimum_size = Vector2(width, 20)
label.custom_minimum_size = Vector2(maxf(0.0, width - 68.0), 18)
label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
_apply_label_style(label, UI_AGED_INK, 13)
return label
_apply_label_style(label, UI_PARCHMENT_TEXT, 13)
row.add_child(label)
row.add_child(_make_seal_tick())
return panel
func _make_seal_tick() -> ColorRect:
var tick := ColorRect.new()
tick.color = UI_CINNABAR
tick.custom_minimum_size = Vector2(18, 18)
tick.mouse_filter = Control.MOUSE_FILTER_IGNORE
return tick
func _make_ornament_bar(width: float = 4.0, height: float = 0.0) -> ColorRect:
@@ -582,16 +648,29 @@ func _create_hud() -> void:
selected_row.add_child(selected_label)
mission_title_label = Label.new()
mission_title_label.text = "Imperial Mandate"
mission_title_label.text = "Bronze Mandate Tablet"
mission_title_label.add_theme_font_size_override("font_size", 14)
_apply_label_style(mission_title_label, UI_OLD_BRONZE)
side_column.add_child(mission_title_label)
var mission_detail_panel := PanelContainer.new()
mission_detail_panel.custom_minimum_size = Vector2(420, 134)
mission_detail_panel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
_apply_panel_style(mission_detail_panel, "bamboo_slips")
side_column.add_child(mission_detail_panel)
var mission_detail_row := HBoxContainer.new()
mission_detail_row.add_theme_constant_override("separation", 8)
mission_detail_panel.add_child(mission_detail_row)
mission_detail_row.add_child(_make_ornament_bar(5, 112))
mission_detail_label = Label.new()
mission_detail_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
mission_detail_label.custom_minimum_size = Vector2(420, 126)
mission_detail_label.custom_minimum_size = Vector2(384, 112)
mission_detail_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
_apply_label_style(mission_detail_label, UI_PARCHMENT_TEXT)
side_column.add_child(mission_detail_label)
mission_detail_row.add_child(mission_detail_label)
cell_info_label = Label.new()
cell_info_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
@@ -841,8 +920,8 @@ func _create_hud() -> void:
briefing_panel = PanelContainer.new()
briefing_panel.visible = false
briefing_panel.position = Vector2(280, 72)
briefing_panel.size = Vector2(720, 628)
briefing_panel.position = Vector2(248, 52)
briefing_panel.size = Vector2(784, 660)
_apply_panel_style(briefing_panel, "paper")
root.add_child(briefing_panel)
@@ -1245,9 +1324,9 @@ func _create_hud() -> void:
result_panel = PanelContainer.new()
result_panel.visible = false
result_panel.position = Vector2(280, 156)
result_panel.size = Vector2(560, 420)
_apply_panel_style(result_panel, "paper")
result_panel.position = Vector2(260, 132)
result_panel.size = Vector2(600, 452)
_apply_panel_style(result_panel, "result_tablet")
root.add_child(result_panel)
var result_column := VBoxContainer.new()
@@ -3041,10 +3120,16 @@ func _update_hud() -> void:
func _format_objective_hud_text() -> String:
var text := String(state.objectives.get("victory", "Defeat all enemies."))
if text.is_empty():
return "Imperial Mandate"
return "Imperial Mandate: %s" % text
var lines := []
var victory := String(state.objectives.get("victory", "Defeat all enemies."))
if not victory.is_empty():
lines.append("Bronze Edict: %s" % victory)
var defeat := String(state.objectives.get("defeat", ""))
if not defeat.is_empty():
lines.append("Black Omen: %s" % defeat)
if lines.is_empty():
return "Bronze Edict"
return _join_strings(lines, "\n")
func _format_unit_focus_text(unit: Dictionary, prefix: String) -> String:
@@ -3214,7 +3299,12 @@ func _format_mission_panel_text() -> String:
var lines := []
var victory := str(state.objectives.get("victory", ""))
if not victory.is_empty():
lines.append("Imperial Edict: %s" % victory)
lines.append("Bronze Edict:")
lines.append(" %s" % victory)
var defeat := str(state.objectives.get("defeat", ""))
if not defeat.is_empty():
lines.append("Black Omen:")
lines.append(" %s" % defeat)
var progress_lines := state.get_objective_progress_lines(false, false)
if not progress_lines.is_empty():
lines.append("Bamboo Register:")
@@ -3680,9 +3770,9 @@ func _format_log_entry_text(message: String) -> String:
func _on_objective_updated(victory: String, defeat: String) -> void:
var notice_lines := ["New Sealed Edict"]
if not victory.is_empty():
notice_lines.append("Imperial Mandate: %s" % victory)
notice_lines.append("Bronze Edict: %s" % victory)
if not defeat.is_empty():
notice_lines.append("Defeat Omen: %s" % defeat)
notice_lines.append("Black Omen: %s" % defeat)
if objective_notice_label != null:
objective_notice_label.text = "\n".join(notice_lines)
if objective_notice_panel != null:
@@ -4026,7 +4116,7 @@ func _render_dialogue_line() -> void:
func _update_dialogue_controls() -> void:
if dialogue_progress_label != null:
dialogue_progress_label.text = "Slip %d / %d" % [active_dialogue_index + 1, active_dialogue_lines.size()]
dialogue_progress_label.text = "Bamboo slip %d / %d" % [active_dialogue_index + 1, active_dialogue_lines.size()]
if dialogue_previous_button != null:
dialogue_previous_button.disabled = active_dialogue_index <= 0
dialogue_continue_button.text = "Seal Scroll" if active_dialogue_index >= active_dialogue_lines.size() - 1 else "Next Slip"