51 lines
1.9 KiB
GDScript
51 lines
1.9 KiB
GDScript
# VERTICAL SLICE - NOT FOR PRODUCTION
|
||
# 实现 GDD:design/ux/battle.md(D 区扫雷图 ~760×548 容器〔底行 520→548——停点前移批 2026-09-23,
|
||
# 原 A 区顶栏空间并入〕——顶部 AP 条 44px〔左:点阵+停手;
|
||
# 右:图例+弃图刷新〕、棋盘主体居中、toast 槽上缘内侧、演出层)。
|
||
# Date: 2026-09-12
|
||
# 高内聚边界:容器组合 + 信号转发——动作意图全部信号外发到组合根,零核心写调用。
|
||
class_name BoardZoneView
|
||
extends PanelContainer
|
||
|
||
var ap_bar: ApBarView
|
||
var board_view: BoardView
|
||
var toast: ToastStack
|
||
var fx: BoardFxView
|
||
|
||
signal action_requested(cell: Vector2i, kind: String)
|
||
signal stop_pressed
|
||
signal refresh_confirmed
|
||
signal legend_toggled
|
||
signal hover_forbidden(cell: Vector2i)
|
||
signal chord_attempted(cell: Vector2i)
|
||
|
||
|
||
func _init() -> void:
|
||
size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||
var vb := VBoxContainer.new()
|
||
vb.add_theme_constant_override("separation", 4)
|
||
add_child(vb)
|
||
ap_bar = ApBarView.new()
|
||
vb.add_child(ap_bar)
|
||
var board_area := Control.new()
|
||
board_area.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||
board_area.clip_contents = true
|
||
vb.add_child(board_area)
|
||
board_area.resized.connect(func(): board_view.set_cell_area(board_area.size))
|
||
board_view = BoardView.new()
|
||
board_view.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||
board_area.add_child(board_view)
|
||
fx = BoardFxView.new()
|
||
board_area.add_child(fx)
|
||
toast = ToastStack.new()
|
||
board_area.add_child(toast)
|
||
# 信号转发(组合根只接线一处)
|
||
board_view.action_requested.connect(func(c: Vector2i, kind: String): action_requested.emit(c, kind))
|
||
board_view.hover_forbidden.connect(func(c: Vector2i): hover_forbidden.emit(c))
|
||
board_view.chord_attempted.connect(func(c: Vector2i): chord_attempted.emit(c))
|
||
ap_bar.stop_pressed.connect(func(): stop_pressed.emit())
|
||
ap_bar.refresh_confirmed.connect(func(): refresh_confirmed.emit())
|
||
ap_bar.legend_toggled.connect(func(): legend_toggled.emit())
|
||
|
||
|