UI improvements ++
This commit is contained in:
@@ -72,6 +72,11 @@ var _current_tab : Tab = Tab.GLOBAL
|
||||
var _active_channel : String = "" # channel_id used by the input bar
|
||||
var _active_dm : String = "" # channel_id of the open DM conversation
|
||||
|
||||
const _BUBBLE_DEFAULT_LEFT := -58.0
|
||||
const _BUBBLE_DEFAULT_TOP := -219.0
|
||||
const _BUBBLE_DEFAULT_RIGHT := 2.0
|
||||
const _BUBBLE_DEFAULT_BOTTOM := -159.0
|
||||
|
||||
var _nicknames : Dictionary = {} # account_id → custom display name
|
||||
var _muted : Dictionary = {} # account_id → true
|
||||
|
||||
@@ -109,6 +114,45 @@ func _ready() -> void:
|
||||
_show_tab(Tab.GLOBAL)
|
||||
|
||||
|
||||
func set_overlay_visible(v: bool) -> void:
|
||||
visible = v
|
||||
var bubble := get_node_or_null("ChatBubble") as Control
|
||||
if is_instance_valid(bubble):
|
||||
bubble.visible = v
|
||||
if not v:
|
||||
var panel := get_node_or_null("ChatPanel") as Control
|
||||
if is_instance_valid(panel):
|
||||
panel.visible = false
|
||||
|
||||
|
||||
func set_bubble_host(host: Control) -> void:
|
||||
var bubble := get_node_or_null("ChatBubble") as Control
|
||||
if not is_instance_valid(bubble):
|
||||
return
|
||||
|
||||
var target: Node = self
|
||||
if is_instance_valid(host):
|
||||
target = host
|
||||
|
||||
if bubble.get_parent() != target:
|
||||
bubble.reparent(target)
|
||||
|
||||
if target == self:
|
||||
bubble.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
bubble.offset_left = _BUBBLE_DEFAULT_LEFT
|
||||
bubble.offset_top = _BUBBLE_DEFAULT_TOP
|
||||
bubble.offset_right = _BUBBLE_DEFAULT_RIGHT
|
||||
bubble.offset_bottom = _BUBBLE_DEFAULT_BOTTOM
|
||||
bubble.custom_minimum_size = Vector2.ZERO
|
||||
else:
|
||||
bubble.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
bubble.offset_left = 0.0
|
||||
bubble.offset_top = 0.0
|
||||
bubble.offset_right = 0.0
|
||||
bubble.offset_bottom = 0.0
|
||||
bubble.custom_minimum_size = Vector2(0, 36)
|
||||
|
||||
|
||||
func _connect_chat_signals() -> void:
|
||||
Chat.channels_updated.connect(_on_channels_updated)
|
||||
Chat.message_received.connect(_on_message_received)
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://b17evi1hw4dqu"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://b17evi1hw4dqu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b8x84lb58h6gx" path="res://scenes/game/game_screen.gd" id="1_gscr"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvmripj4jux0b" path="res://icons/SP-Symbol-White.png" id="2_056su"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/game/InGameSettings.tscn" id="2_igs"]
|
||||
[ext_resource type="Texture2D" uid="uid://csvmdo2kwnh7c" path="res://icons/ST-Symbol-White.png" id="3_wukpb"]
|
||||
[ext_resource type="Texture2D" uid="uid://beyeu0y34m3v4" path="res://ui/icons/Deck Icon.png" id="4_ld7sk"]
|
||||
[ext_resource type="Texture2D" uid="uid://c65s8sn4p7s37" path="res://ui/icons/Discard Icon.png" id="5_pryjh"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wukpb"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_056su"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ld7sk"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xjmfi"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pryjh"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pnc6c"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2dkum"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7me7j"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_msfbn"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ld7sk"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8asym"]
|
||||
|
||||
[node name="GameScreen" type="Node3D"]
|
||||
script = ExtResource("1_gscr")
|
||||
|
||||
@@ -133,6 +153,8 @@ offset_left = -18.987999
|
||||
offset_top = -22.968002
|
||||
offset_right = 19.012001
|
||||
offset_bottom = 23.031998
|
||||
tooltip_text = "Spirit Points"
|
||||
mouse_filter = 1
|
||||
theme_override_colors/font_color = Color(0.012617188, 0.012617188, 0.012617188, 1)
|
||||
theme_override_font_sizes/font_size = 33
|
||||
text = "88"
|
||||
@@ -161,24 +183,184 @@ offset_left = -20.0
|
||||
offset_top = -20.472002
|
||||
offset_right = 22.0
|
||||
offset_bottom = 25.527998
|
||||
tooltip_text = "Sacrifice Tokens"
|
||||
mouse_filter = 1
|
||||
theme_override_colors/font_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
|
||||
theme_override_font_sizes/font_size = 33
|
||||
text = "88"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ActionRail" type="PanelContainer" parent="HUD"]
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -276.0
|
||||
offset_top = -241.0
|
||||
offset_right = -84.0
|
||||
offset_bottom = -77.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_ld7sk")
|
||||
|
||||
[node name="RailMargin" type="MarginContainer" parent="HUD/ActionRail"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="RailHBox" type="HBoxContainer" parent="HUD/ActionRail/RailMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="Deck-Discard Panel Container" type="Control" parent="HUD/ActionRail/RailMargin/RailHBox"]
|
||||
custom_minimum_size = Vector2(76, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer"]
|
||||
self_modulate = Color(0, 0.8117647, 0.77254903, 0.38039216)
|
||||
texture_filter = 5
|
||||
custom_minimum_size = Vector2(1.78, 76)
|
||||
layout_mode = 2
|
||||
theme = SubResource("Theme_056su")
|
||||
texture = ExtResource("4_ld7sk")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="DeckLabel" type="Label" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer/TextureRect"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.507
|
||||
anchor_top = 0.40789473
|
||||
anchor_right = 0.507
|
||||
anchor_bottom = 0.40789473
|
||||
offset_left = -22.532001
|
||||
offset_top = -36.0
|
||||
offset_right = 22.467999
|
||||
offset_bottom = 10.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
tooltip_text = "Cards in Deck"
|
||||
mouse_filter = 1
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 33
|
||||
text = "88"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer"]
|
||||
self_modulate = Color(0, 0.8117647, 0.77254903, 0.38039216)
|
||||
texture_filter = 5
|
||||
custom_minimum_size = Vector2(1.78, 76)
|
||||
layout_mode = 2
|
||||
theme = SubResource("Theme_056su")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="DiscardBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer/TextureRect2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = -4.000001
|
||||
offset_top = -5.000001
|
||||
offset_right = 568.0
|
||||
offset_bottom = 275.0
|
||||
scale = Vector2(0.14754085, 0.23068035)
|
||||
tooltip_text = "View Discard"
|
||||
theme_override_colors/icon_normal_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
|
||||
theme_override_colors/icon_focus_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
|
||||
theme_override_colors/icon_pressed_color = Color(0.35976923, 0.7944459, 0.77106035, 1)
|
||||
theme_override_colors/icon_hover_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
|
||||
theme_override_colors/icon_hover_pressed_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
theme_override_icons/icon = ExtResource("5_pryjh")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_xjmfi")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_pryjh")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_pnc6c")
|
||||
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_2dkum")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_7me7j")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_msfbn")
|
||||
|
||||
[node name="DiscardLabel" type="Label" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer/TextureRect2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.32200003
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.32200003
|
||||
offset_left = -20.0
|
||||
offset_top = -31.472002
|
||||
offset_right = 22.0
|
||||
offset_bottom = 14.527998
|
||||
theme_override_colors/font_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
|
||||
theme_override_font_sizes/font_size = 33
|
||||
text = "88"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Controls" type="Control" parent="HUD/ActionRail/RailMargin/RailHBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="RightVBox" type="VBoxContainer" parent="HUD/ActionRail/RailMargin/RailHBox/Controls"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="EndTurnBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 36)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "End Turn"
|
||||
|
||||
[node name="DrawBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 36)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "Draw Card"
|
||||
|
||||
[node name="SettingsBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 36)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Settings"
|
||||
|
||||
[node name="ChatBubbleHost" type="Control" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 36)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HandArea" type="PanelContainer" parent="HUD"]
|
||||
anchors_preset = -1
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.75
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -250.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_ld7sk")
|
||||
|
||||
[node name="HandScroll" type="ScrollContainer" parent="HUD/HandArea"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_8asym")
|
||||
vertical_scroll_mode = 0
|
||||
|
||||
[node name="HandCards" type="HBoxContainer" parent="HUD/HandArea/HandScroll"]
|
||||
@@ -188,6 +370,7 @@ size_flags_vertical = 4
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="RightPanel" type="PanelContainer" parent="HUD"]
|
||||
visible = false
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.75
|
||||
anchor_top = 1.0
|
||||
@@ -199,49 +382,6 @@ offset_right = -1.0
|
||||
offset_bottom = 9.0
|
||||
scale = Vector2(1, 0.96000004)
|
||||
|
||||
[node name="RightMargin" type="MarginContainer" parent="HUD/RightPanel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="RightVBox" type="VBoxContainer" parent="HUD/RightPanel/RightMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="DeckLabel" type="Label" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Deck: 0"
|
||||
|
||||
[node name="DiscardBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "View Discard"
|
||||
|
||||
[node name="DrawBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 36)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "Draw Card"
|
||||
|
||||
[node name="EndTurnBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 36)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "End Turn"
|
||||
|
||||
[node name="SettingsBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Settings"
|
||||
|
||||
[node name="TileDrawerToggleBtn" type="Button" parent="HUD"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(36, 48)
|
||||
|
||||
@@ -50,9 +50,11 @@ enum Mode {
|
||||
@onready var _st_lbl : Label = %StLabel
|
||||
@onready var _deck_lbl : Label = %DeckLabel
|
||||
@onready var _discard_btn : Button = %DiscardBtn
|
||||
@onready var _discard_lbl : Label = %DiscardLabel
|
||||
@onready var _draw_btn : Button = %DrawBtn
|
||||
@onready var _end_turn_btn : Button = %EndTurnBtn
|
||||
@onready var _settings_btn : Button = %SettingsBtn
|
||||
@onready var _chat_bubble_host : Control = %ChatBubbleHost
|
||||
@onready var _tile_drawer_toggle_btn : Button = %TileDrawerToggleBtn
|
||||
@onready var _in_game_settings: PanelContainer = %InGameSettings
|
||||
@onready var _ctx_popup : PanelContainer = %ContextPopup
|
||||
@@ -105,7 +107,6 @@ const AFFINITY_COLORS : Dictionary = {
|
||||
}
|
||||
|
||||
const _CARD_WIDGET_SCENE := preload("res://scenes/collection/components/CardWidget.tscn")
|
||||
const _CHAT_OVERLAY_SCENE := preload("res://scenes/chat/ChatOverlay.tscn")
|
||||
|
||||
const HI_GREEN := Color(0.20, 0.90, 0.20, 0.40)
|
||||
const HI_RED := Color(1.00, 0.25, 0.25, 0.50)
|
||||
@@ -270,6 +271,14 @@ var _hovered_coord : Vector2i = Vector2i(-1, -1)
|
||||
## The MeshInstance3D of the unit currently receiving a hover-glow override.
|
||||
var _hovered_unit_mesh : MeshInstance3D = null
|
||||
|
||||
const UNIT_SFX_KEYS := [
|
||||
"moveSoundUrl",
|
||||
"attackSoundUrl",
|
||||
"damagedSoundUrl",
|
||||
"deathSoundUrl",
|
||||
"blockedSoundUrl",
|
||||
]
|
||||
|
||||
## Animation name aliases: maps the canonical lower-case action to fallback track names.
|
||||
## The AnimationPlayer track list is matched case-insensitively against each entry.
|
||||
const ANIM_ALIASES : Dictionary = {
|
||||
@@ -306,10 +315,11 @@ func _ready() -> void:
|
||||
Settings.settings_changed.connect(_sync_cam_ctrl_panel)
|
||||
_create_tile_drawer()
|
||||
Game.triggered_target_request.connect(_on_triggered_target_request)
|
||||
HighlightConfig.texture_loaded.connect(_on_highlight_texture_loaded)
|
||||
|
||||
# Chat overlay — add to viewport root so it renders above everything.
|
||||
var _chat_overlay := _CHAT_OVERLAY_SCENE.instantiate()
|
||||
get_tree().get_root().add_child(_chat_overlay)
|
||||
Chat.set_bubble_visible(true)
|
||||
Chat.set_bubble_host(_chat_bubble_host)
|
||||
|
||||
Game.state_updated.connect(_on_state_updated)
|
||||
Game.game_over.connect(_on_game_over)
|
||||
@@ -372,11 +382,8 @@ func _exit_tree() -> void:
|
||||
func(_t: String, _r: Variant) -> void: pass,
|
||||
func(_c: String, _m: String) -> void: pass)
|
||||
_clear_stars()
|
||||
# Remove chat overlay added to the viewport root.
|
||||
var root := get_tree().get_root()
|
||||
for child in root.get_children():
|
||||
if child.name == "ChatOverlay":
|
||||
child.queue_free()
|
||||
Chat.set_bubble_host(null)
|
||||
Chat.set_bubble_visible(false)
|
||||
|
||||
|
||||
func _setup_spectator_ui() -> void:
|
||||
@@ -1615,6 +1622,7 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false)
|
||||
if def_id.is_empty():
|
||||
return
|
||||
var def := ContentCache.get_definition(def_id)
|
||||
_prime_unit_sfx(def)
|
||||
var model_asset := _find_model3d_asset(def)
|
||||
var model_url := str(model_asset.get("cdnUrl", ""))
|
||||
var model_etag := str(model_asset.get("contentETag", ""))
|
||||
@@ -1969,6 +1977,15 @@ func _sfx_for_unit(iid: String, sfx_key: String) -> String:
|
||||
return str(def.get(sfx_key, ""))
|
||||
|
||||
|
||||
func _prime_unit_sfx(def: Dictionary) -> void:
|
||||
if def.is_empty():
|
||||
return
|
||||
for sfx_key: String in UNIT_SFX_KEYS:
|
||||
var url := str(def.get(sfx_key, "")).strip_edges()
|
||||
if not url.is_empty():
|
||||
SFX.prime(url)
|
||||
|
||||
|
||||
## Returns true if the AnimationPlayer's current track is an "attack" animation.
|
||||
func _is_attack_track(full_name: String) -> bool:
|
||||
var s := full_name.get_slice("/", full_name.get_slice_count("/") - 1)
|
||||
@@ -2508,6 +2525,27 @@ func _place_highlight_quad(quad: MeshInstance3D, x: int, y: int, col: Color, tex
|
||||
mat.albedo_texture = texture
|
||||
quad.visible = true
|
||||
|
||||
|
||||
func _on_highlight_texture_loaded(_type: String) -> void:
|
||||
match _mode:
|
||||
Mode.UNIT_SELECTED:
|
||||
if not _sel_unit_id.is_empty():
|
||||
_select_unit(_sel_unit_id)
|
||||
Mode.CARD_FROM_HAND, Mode.TERRAMORPHA_SELECT:
|
||||
var sel_card := _find_hand_card(_sel_card_id)
|
||||
if not sel_card.is_empty():
|
||||
_clear_highlights()
|
||||
_highlight_tiles(_valid_play_tiles(sel_card), "movement")
|
||||
Mode.PLACEMENT:
|
||||
_clear_highlights()
|
||||
_highlight_tiles(_valid_placement_tiles(), "movement")
|
||||
_:
|
||||
pass
|
||||
|
||||
if _hovered_coord.x >= 0:
|
||||
_hovered_coord = Vector2i(-1, -1)
|
||||
_update_hover(get_viewport().get_mouse_position())
|
||||
|
||||
# ── Valid target computation ──────────────────────────────────────────────────
|
||||
|
||||
func _valid_play_tiles(card: Dictionary) -> Array:
|
||||
@@ -2895,7 +2933,7 @@ func _tile_drawer_section_title(title: String, expanded: bool) -> String:
|
||||
## as _create_tile_drawer_section ("root", "header", "content", "title") plus "scroll"
|
||||
## and a mutable "count" entry used to keep the header label up-to-date.
|
||||
func _create_scrollable_section(parent: VBoxContainer, title: String) -> Dictionary:
|
||||
var section := VBoxContainer.new()
|
||||
var section : VBoxContainer = VBoxContainer.new()
|
||||
section.layout_mode = 2
|
||||
section.add_theme_constant_override("separation", 4)
|
||||
parent.add_child(section)
|
||||
@@ -2916,7 +2954,7 @@ func _create_scrollable_section(parent: VBoxContainer, title: String) -> Diction
|
||||
scroll.visible = false
|
||||
section.add_child(scroll)
|
||||
|
||||
var content := VBoxContainer.new()
|
||||
var content : VBoxContainer = VBoxContainer.new()
|
||||
content.layout_mode = 2
|
||||
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
content.add_theme_constant_override("separation", 2)
|
||||
@@ -3000,6 +3038,21 @@ func _set_tile_drawer_lines(section: Dictionary, labels: Array, lines: Array,
|
||||
lbl.tooltip_text = ""
|
||||
|
||||
|
||||
## Clears a scrollable effects section and resets its cached header/toggle state so
|
||||
## the next inspected tile does not inherit a stale count or expanded body.
|
||||
func _clear_effects_section(section: Dictionary, labels: Array) -> void:
|
||||
_set_tile_drawer_lines(section, labels, [])
|
||||
section["count"] = 0
|
||||
var header: Button = section.get("header") as Button
|
||||
if is_instance_valid(header):
|
||||
header.button_pressed = false
|
||||
header.text = _tile_drawer_section_title(str(section.get("title", "Active Effects")), false)
|
||||
var scroll: ScrollContainer = section.get("scroll") as ScrollContainer
|
||||
if is_instance_valid(scroll):
|
||||
scroll.visible = false
|
||||
scroll.scroll_vertical = 0
|
||||
|
||||
|
||||
func _find_unit_owner_account_id(unit_id: String) -> String:
|
||||
if unit_id.is_empty():
|
||||
return ""
|
||||
@@ -3089,10 +3142,10 @@ func _set_tile_drawer_content(tile: Dictionary) -> void:
|
||||
_set_tile_drawer_lines(_tile_drawer_token_section, _tile_drawer_token_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_arch_section, _tile_drawer_arch_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_ruin_section, _tile_drawer_ruin_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_spirit_effects_section, _tile_drawer_spirit_effects_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_token_effects_section, _tile_drawer_token_effects_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_arch_effects_section, _tile_drawer_arch_effects_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_ruin_effects_section, _tile_drawer_ruin_effects_labels, [])
|
||||
_clear_effects_section(_tile_drawer_spirit_effects_section, _tile_drawer_spirit_effects_labels)
|
||||
_clear_effects_section(_tile_drawer_token_effects_section, _tile_drawer_token_effects_labels)
|
||||
_clear_effects_section(_tile_drawer_arch_effects_section, _tile_drawer_arch_effects_labels)
|
||||
_clear_effects_section(_tile_drawer_ruin_effects_section, _tile_drawer_ruin_effects_labels)
|
||||
return
|
||||
|
||||
var coord : Dictionary = tile.get("coord", {})
|
||||
@@ -3128,7 +3181,7 @@ func _set_tile_drawer_content(tile: Dictionary) -> void:
|
||||
_set_effects_section(occ_id, _tile_drawer_spirit_effects_section, _tile_drawer_spirit_effects_labels)
|
||||
else:
|
||||
_set_tile_drawer_lines(_tile_drawer_spirit_section, _tile_drawer_spirit_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_spirit_effects_section, _tile_drawer_spirit_effects_labels, [])
|
||||
_clear_effects_section(_tile_drawer_spirit_effects_section, _tile_drawer_spirit_effects_labels)
|
||||
|
||||
if not occ_id.is_empty() and occ_id != "null" and occ_type == "SpiritToken":
|
||||
var token_owner_id: String = occ_owner_id if not occ_owner_id.is_empty() else _find_unit_owner_account_id(occ_id)
|
||||
@@ -3139,7 +3192,7 @@ func _set_tile_drawer_content(tile: Dictionary) -> void:
|
||||
_set_effects_section(occ_id, _tile_drawer_token_effects_section, _tile_drawer_token_effects_labels)
|
||||
else:
|
||||
_set_tile_drawer_lines(_tile_drawer_token_section, _tile_drawer_token_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_token_effects_section, _tile_drawer_token_effects_labels, [])
|
||||
_clear_effects_section(_tile_drawer_token_effects_section, _tile_drawer_token_effects_labels)
|
||||
|
||||
if not occ_id.is_empty() and occ_id != "null" and occ_type == "ArchSpirit":
|
||||
var arch_owner_id: String = occ_owner_id if not occ_owner_id.is_empty() else _find_unit_owner_account_id(occ_id)
|
||||
@@ -3150,7 +3203,7 @@ func _set_tile_drawer_content(tile: Dictionary) -> void:
|
||||
_set_effects_section(occ_id, _tile_drawer_arch_effects_section, _tile_drawer_arch_effects_labels)
|
||||
else:
|
||||
_set_tile_drawer_lines(_tile_drawer_arch_section, _tile_drawer_arch_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_arch_effects_section, _tile_drawer_arch_effects_labels, [])
|
||||
_clear_effects_section(_tile_drawer_arch_effects_section, _tile_drawer_arch_effects_labels)
|
||||
|
||||
if ruin_id_value != null and not ruin_id.is_empty() and ruin_id != "null":
|
||||
var ruin_lines : Array = ["Ruin: %s" % ruin_id, "Owner: %s" % Game.get_display_name(ruin_owner_id)]
|
||||
@@ -3159,7 +3212,7 @@ func _set_tile_drawer_content(tile: Dictionary) -> void:
|
||||
_set_effects_section(ruin_id, _tile_drawer_ruin_effects_section, _tile_drawer_ruin_effects_labels)
|
||||
else:
|
||||
_set_tile_drawer_lines(_tile_drawer_ruin_section, _tile_drawer_ruin_labels, [])
|
||||
_set_tile_drawer_lines(_tile_drawer_ruin_effects_section, _tile_drawer_ruin_effects_labels, [])
|
||||
_clear_effects_section(_tile_drawer_ruin_effects_section, _tile_drawer_ruin_effects_labels)
|
||||
|
||||
|
||||
## Populates [param section] (a scrollable effects section) with effects targeting
|
||||
@@ -3336,6 +3389,8 @@ func _handle_board_click(mouse_pos: Vector2) -> void:
|
||||
_add_highlight(nx, ny, "movement")
|
||||
|
||||
Mode.UNIT_SELECTED:
|
||||
if coord.x >= 0:
|
||||
_set_tile_drawer_content(Game.get_tile(coord.x, coord.y))
|
||||
# Occupied tile with no direct unit-mesh hit → redirect to the occupant.
|
||||
if unit_id.is_empty() and coord.x >= 0:
|
||||
var _t2 := Game.get_tile(coord.x, coord.y)
|
||||
@@ -3445,7 +3500,7 @@ func _set_mode(new_mode: Mode) -> void:
|
||||
_mode = new_mode
|
||||
_terra_targets = []
|
||||
_terra_count = 0
|
||||
if new_mode != Mode.NONE:
|
||||
if new_mode != Mode.NONE and new_mode != Mode.UNIT_SELECTED:
|
||||
_close_tile_drawer()
|
||||
if new_mode == Mode.NONE:
|
||||
_sel_card_id = ""
|
||||
@@ -4455,7 +4510,7 @@ func _update_hud(state: Dictionary) -> void:
|
||||
var is_mine : bool = (not _is_spectating) and Game.is_my_turn()
|
||||
var my : Dictionary = Game.get_my_player()
|
||||
var opp : Dictionary = Game.get_opponent()
|
||||
|
||||
print("[MY]", my)
|
||||
_phase_lbl.text = "Phase: %s" % phase
|
||||
if _is_spectating:
|
||||
var active_id : String = str(state.get("activePlayerAccountId", ""))
|
||||
@@ -4467,7 +4522,12 @@ func _update_hud(state: Dictionary) -> void:
|
||||
|
||||
_sp_lbl.text = "%d" % int(my.get("currentSp", 0))
|
||||
_st_lbl.text = "%d" % int(my.get("currentSt", 0))
|
||||
_deck_lbl.text = "Deck: %d" % int(my.get("deckCount", 0))
|
||||
_deck_lbl.text = "%d" % int(my.get("deckCount", 0))
|
||||
var discard = Game.get_my_player().get("discard", [])
|
||||
var discCount : int = discard.size()
|
||||
if (discCount <= 0):
|
||||
discCount = 0
|
||||
_discard_lbl.text = "%d" % discCount
|
||||
|
||||
_opp_name_lbl.text = Game.get_display_name(str(opp.get("accountId", "")))
|
||||
_opp_hand_lbl.text = "Hand: %d" % int(opp.get("handCount", 0))
|
||||
|
||||
Reference in New Issue
Block a user