client: remember me, SVG affinity icons, card detail popup
Remember Me (login screen): - AES-256-CBC encrypted credential storage in user://creds.dat - Key XOR-obfuscated across two halves; random IV stored with ciphertext - Checkbox pre-fills email/password on next launch; unchecking clears saved creds SVG affinity icons (web-compatible): - Replace emoji art symbols (🔥💧⛰💨⚡✦★) with SVG TextureRect in CardWidget - 7 new icons/affinity_*.svg — monochrome white, modulate-tinted at runtime - ArtSymbol node changed from Label to TextureRect (stretch_mode = keep-aspect-centred) Card detail popup (collection screen): - Tap any card in Cards tab to see full stats + abilities overlay - CardDetailPopup added to viewport root (avoids VBoxContainer layout conflict) - Shows: name, affinity icon, foil badge, type/affinity/rarity, all 6 stats, and parsed ability list with names + descriptions - Dismiss by tapping ✕ or the dim background overlay Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<rect fill="white" x="3" y="7" width="15" height="2.5" rx="1.25"/>
|
||||||
|
<path fill="white" d="M18 7a3 3 0 1 1 0 6H3V10.5h15a.5.5 0 0 0 0-1H3V7h15z"/>
|
||||||
|
<rect fill="white" x="3" y="13" width="11" height="2.5" rx="1.25"/>
|
||||||
|
<path fill="white" d="M14 13a3 3 0 1 1 0 6H3V16.5h11a.5.5 0 0 0 0-1H3V13h11z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path fill="white" d="M12 3a9 9 0 0 0 0 18 9.2 9.2 0 0 0 2-.22A7 7 0 0 1 9.78 6.22 9.2 9.2 0 0 0 12 3z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 176 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path fill="white" d="M1.5 21L8 7l5.5 9.5 3.5-6L23 21H1.5z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 132 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path fill="white" d="M12 2C9.5 5.5 7 8.5 8 13c.4 1.8 1.6 3 2.8 3.8-.6-1.6 0-3.2 1.2-4 .4 1.8 1.4 3 2.2 4.2 1-1.4 1.2-3.2.3-4.8C16.4 13.6 17 16 16 18.5c-1 2.2-3.2 3.5-4 3.5C8.5 22 5.5 19.5 5.5 16.5c0-5 4-7.5 6.5-14.5z"/>
|
||||||
|
<path fill="white" d="M12 10c-.5 2.5.5 4 2 5-.5-2 .5-3.5 1.5-4.5-.5 2 .5 4 0 6C17.5 15 18 12.5 16.5 11 18 12.5 18 15 17 17c-1 2.5-3.5 4-5 4z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 437 B |
@@ -0,0 +1,11 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<circle fill="white" cx="12" cy="12" r="4.5"/>
|
||||||
|
<rect fill="white" x="10.75" y="1" width="2.5" height="3.5" rx="1.25"/>
|
||||||
|
<rect fill="white" x="10.75" y="19.5" width="2.5" height="3.5" rx="1.25"/>
|
||||||
|
<rect fill="white" x="1" y="10.75" width="3.5" height="2.5" rx="1.25"/>
|
||||||
|
<rect fill="white" x="19.5" y="10.75" width="3.5" height="2.5" rx="1.25"/>
|
||||||
|
<rect fill="white" x="10.75" y="1" width="2.5" height="3.5" rx="1.25" transform="rotate(45 12 12)"/>
|
||||||
|
<rect fill="white" x="10.75" y="19.5" width="2.5" height="3.5" rx="1.25" transform="rotate(45 12 12)"/>
|
||||||
|
<rect fill="white" x="1" y="10.75" width="3.5" height="2.5" rx="1.25" transform="rotate(45 12 12)"/>
|
||||||
|
<rect fill="white" x="19.5" y="10.75" width="3.5" height="2.5" rx="1.25" transform="rotate(45 12 12)"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 837 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path fill="white" d="M13.5 2L5 13.5h6.5L10 22l9-12.5H13L13.5 2z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 138 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path fill="white" d="M12 2L5.5 12.5C4 15.2 4.5 18 6.5 19.8A7 7 0 0 0 12 22a7 7 0 0 0 5.5-2.2C19.5 18 20 15.2 18.5 12.5L12 2z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 199 B |
@@ -6,15 +6,19 @@ extends VBoxContainer
|
|||||||
## If not syncing, triggers a silent background sync to pick up any new cards
|
## If not syncing, triggers a silent background sync to pick up any new cards
|
||||||
## added since last session.
|
## added since last session.
|
||||||
|
|
||||||
|
const CARD_DETAIL_POPUP := preload("res://scenes/collection/components/CardDetailPopup.tscn")
|
||||||
|
|
||||||
# ── Node references ───────────────────────────────────────────────────────────
|
# ── Node references ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@onready var back_btn : Button = %BackBtn
|
@onready var back_btn : Button = %BackBtn
|
||||||
@onready var sync_label : Label = %SyncLabel
|
@onready var sync_label : Label = %SyncLabel
|
||||||
@onready var cards_tab_btn : Button = %CardsTabBtn
|
@onready var cards_tab_btn : Button = %CardsTabBtn
|
||||||
@onready var decks_tab_btn : Button = %DecksTabBtn
|
@onready var decks_tab_btn : Button = %DecksTabBtn
|
||||||
@onready var cards_view : VBoxContainer = %CardsView
|
@onready var cards_view : VBoxContainer = %CardsView
|
||||||
@onready var decks_view : VBoxContainer = %DecksView
|
@onready var decks_view : VBoxContainer = %DecksView
|
||||||
|
|
||||||
|
var _card_popup: Control = null
|
||||||
|
|
||||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -22,6 +26,11 @@ func _ready() -> void:
|
|||||||
cards_tab_btn.pressed.connect(func(): _show_tab(0))
|
cards_tab_btn.pressed.connect(func(): _show_tab(0))
|
||||||
decks_tab_btn.pressed.connect(func(): _show_tab(1))
|
decks_tab_btn.pressed.connect(func(): _show_tab(1))
|
||||||
|
|
||||||
|
# Add popup to the viewport root so it overlays above the VBoxContainer.
|
||||||
|
_card_popup = CARD_DETAIL_POPUP.instantiate()
|
||||||
|
get_tree().get_root().add_child(_card_popup)
|
||||||
|
cards_view.card_selected.connect(_on_card_selected)
|
||||||
|
|
||||||
_show_tab(0)
|
_show_tab(0)
|
||||||
_setup_sync()
|
_setup_sync()
|
||||||
|
|
||||||
@@ -31,6 +40,15 @@ func _exit_tree() -> void:
|
|||||||
ContentCache.sync_complete.disconnect(_on_sync_done)
|
ContentCache.sync_complete.disconnect(_on_sync_done)
|
||||||
if ContentCache.sync_failed.is_connected(_on_sync_done_or_failed):
|
if ContentCache.sync_failed.is_connected(_on_sync_done_or_failed):
|
||||||
ContentCache.sync_failed.disconnect(_on_sync_done_or_failed)
|
ContentCache.sync_failed.disconnect(_on_sync_done_or_failed)
|
||||||
|
if _card_popup != null and is_instance_valid(_card_popup):
|
||||||
|
_card_popup.queue_free()
|
||||||
|
_card_popup = null
|
||||||
|
|
||||||
|
# ── Card detail ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
func _on_card_selected(dto: Dictionary, def: Dictionary) -> void:
|
||||||
|
if _card_popup != null and is_instance_valid(_card_popup):
|
||||||
|
_card_popup.show_card(dto, def)
|
||||||
|
|
||||||
# ── Tab switching ─────────────────────────────────────────────────────────────
|
# ── Tab switching ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
[gd_scene load_steps=2 format=3]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/collection/components/card_detail_popup.gd" id="1_cdp"]
|
||||||
|
|
||||||
|
[node name="CardDetailPopup" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 0
|
||||||
|
visible = false
|
||||||
|
script = ExtResource("1_cdp")
|
||||||
|
|
||||||
|
[node name="Overlay" type="ColorRect" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.0, 0.0, 0.0, 0.72)
|
||||||
|
mouse_filter = 0
|
||||||
|
|
||||||
|
[node name="Center" type="CenterContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="Panel" type="PanelContainer" parent="Center"]
|
||||||
|
layout_mode = 2
|
||||||
|
custom_minimum_size = Vector2(310, 0)
|
||||||
|
|
||||||
|
[node name="Scroll" type="ScrollContainer" parent="Center/Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
custom_minimum_size = Vector2(0, 0)
|
||||||
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
|
[node name="Inner" type="MarginContainer" parent="Center/Panel/Scroll"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
theme_override_constants/margin_left = 14
|
||||||
|
theme_override_constants/margin_top = 14
|
||||||
|
theme_override_constants/margin_right = 14
|
||||||
|
theme_override_constants/margin_bottom = 14
|
||||||
|
|
||||||
|
[node name="VBox" type="VBoxContainer" parent="Center/Panel/Scroll/Inner"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
|
[node name="HeaderRow" type="HBoxContainer" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 8
|
||||||
|
|
||||||
|
[node name="AffinityIcon" type="TextureRect" parent="Center/Panel/Scroll/Inner/VBox/HeaderRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
custom_minimum_size = Vector2(28, 28)
|
||||||
|
expand_mode = 1
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="NameLabel" type="Label" parent="Center/Panel/Scroll/Inner/VBox/HeaderRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Card Name"
|
||||||
|
vertical_alignment = 1
|
||||||
|
theme_override_font_sizes/font_size = 18
|
||||||
|
|
||||||
|
[node name="FoilBadge" type="Label" parent="Center/Panel/Scroll/Inner/VBox/HeaderRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "✦ Foil"
|
||||||
|
visible = false
|
||||||
|
modulate = Color(0.95, 0.85, 0.30, 1.0)
|
||||||
|
vertical_alignment = 1
|
||||||
|
theme_override_font_sizes/font_size = 12
|
||||||
|
|
||||||
|
[node name="CloseBtn" type="Button" parent="Center/Panel/Scroll/Inner/VBox/HeaderRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
custom_minimum_size = Vector2(32, 32)
|
||||||
|
text = "✕"
|
||||||
|
theme_override_font_sizes/font_size = 16
|
||||||
|
|
||||||
|
[node name="TagRow" type="HBoxContainer" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 8
|
||||||
|
|
||||||
|
[node name="TypeLabel" type="Label" parent="Center/Panel/Scroll/Inner/VBox/TagRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = ""
|
||||||
|
modulate = Color(0.70, 0.70, 0.80, 1.0)
|
||||||
|
theme_override_font_sizes/font_size = 13
|
||||||
|
|
||||||
|
[node name="TagFill" type="Control" parent="Center/Panel/Scroll/Inner/VBox/TagRow"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="AffinityLabel" type="Label" parent="Center/Panel/Scroll/Inner/VBox/TagRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = ""
|
||||||
|
theme_override_font_sizes/font_size = 13
|
||||||
|
|
||||||
|
[node name="TagFill2" type="Control" parent="Center/Panel/Scroll/Inner/VBox/TagRow"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="RarityLabel" type="Label" parent="Center/Panel/Scroll/Inner/VBox/TagRow"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = ""
|
||||||
|
theme_override_font_sizes/font_size = 13
|
||||||
|
|
||||||
|
[node name="StatsSep" type="HSeparator" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="StatsGrid" type="GridContainer" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
columns = 4
|
||||||
|
theme_override_constants/h_separation = 8
|
||||||
|
theme_override_constants/v_separation = 6
|
||||||
|
|
||||||
|
[node name="AbilitiesSep" type="HSeparator" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="AbilitiesTitle" type="Label" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Abilities"
|
||||||
|
visible = false
|
||||||
|
theme_override_font_sizes/font_size = 14
|
||||||
|
|
||||||
|
[node name="AbilitiesList" type="VBoxContainer" parent="Center/Panel/Scroll/Inner/VBox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 6
|
||||||
@@ -62,7 +62,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(0.18, 0.18, 0.24, 1.0)
|
color = Color(0.18, 0.18, 0.24, 1.0)
|
||||||
|
|
||||||
[node name="ArtSymbol" type="Label" parent="Margin/VBox/ArtArea"]
|
[node name="ArtSymbol" type="TextureRect" parent="Margin/VBox/ArtArea"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -70,10 +70,9 @@ anchor_right = 1.0
|
|||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
text = "◇"
|
expand_mode = 1
|
||||||
horizontal_alignment = 1
|
stretch_mode = 5
|
||||||
vertical_alignment = 1
|
modulate = Color(1, 1, 1, 0.85)
|
||||||
theme_override_font_sizes/font_size = 28
|
|
||||||
|
|
||||||
[node name="NameLabel" type="Label" parent="Margin/VBox"]
|
[node name="NameLabel" type="Label" parent="Margin/VBox"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@@ -0,0 +1,159 @@
|
|||||||
|
extends Control
|
||||||
|
## Full-screen card detail overlay.
|
||||||
|
##
|
||||||
|
## Call show_card(dto, def) to populate and show.
|
||||||
|
## Closes when the user taps the ✕ button or the semi-transparent background.
|
||||||
|
##
|
||||||
|
## Added to the viewport root at runtime by collection_screen.gd so it renders
|
||||||
|
## above the VBoxContainer layout regardless of scene structure.
|
||||||
|
|
||||||
|
const _CardWidget = preload("res://scenes/collection/components/card_widget.gd")
|
||||||
|
|
||||||
|
const RARITY_COLOR := {
|
||||||
|
"Common": Color(0.67, 0.67, 0.67),
|
||||||
|
"Uncommon": Color(0.27, 0.85, 0.27),
|
||||||
|
"Rare": Color(0.27, 0.53, 1.00),
|
||||||
|
"Epic": Color(0.67, 0.27, 1.00),
|
||||||
|
"Legendary": Color(1.00, 0.67, 0.13),
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Node refs ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
@onready var overlay : ColorRect = %Overlay
|
||||||
|
@onready var affinity_icon : TextureRect = %AffinityIcon
|
||||||
|
@onready var name_label : Label = %NameLabel
|
||||||
|
@onready var foil_badge : Label = %FoilBadge
|
||||||
|
@onready var close_btn : Button = %CloseBtn
|
||||||
|
@onready var type_label : Label = %TypeLabel
|
||||||
|
@onready var affinity_label : Label = %AffinityLabel
|
||||||
|
@onready var rarity_label : Label = %RarityLabel
|
||||||
|
@onready var stats_grid : GridContainer = %StatsGrid
|
||||||
|
@onready var abilities_sep : HSeparator = %AbilitiesSep
|
||||||
|
@onready var abilities_title: Label = %AbilitiesTitle
|
||||||
|
@onready var abilities_list : VBoxContainer = %AbilitiesList
|
||||||
|
|
||||||
|
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
overlay.gui_input.connect(_on_overlay_input)
|
||||||
|
close_btn.pressed.connect(hide)
|
||||||
|
|
||||||
|
# ── Public API ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
func show_card(dto: Dictionary, def: Dictionary) -> void:
|
||||||
|
var affinity := str(dto.get("affinity", ""))
|
||||||
|
var rarity := str(dto.get("rarity", ""))
|
||||||
|
var card_type := str(dto.get("cardType", ""))
|
||||||
|
var is_foil := bool(dto.get("isFoil", false))
|
||||||
|
|
||||||
|
# Header
|
||||||
|
name_label.text = str(dto.get("name", "Unknown"))
|
||||||
|
affinity_icon.texture = _CardWidget.AFFINITY_ICONS.get(affinity, null)
|
||||||
|
affinity_icon.modulate = _CardWidget.AFFINITY_BORDER.get(affinity, Color.WHITE)
|
||||||
|
foil_badge.visible = is_foil
|
||||||
|
|
||||||
|
# Tags
|
||||||
|
type_label.text = card_type
|
||||||
|
affinity_label.text = affinity
|
||||||
|
affinity_label.modulate = _CardWidget.AFFINITY_BORDER.get(affinity, Color.WHITE)
|
||||||
|
rarity_label.text = rarity
|
||||||
|
rarity_label.modulate = RARITY_COLOR.get(rarity, Color(0.67, 0.67, 0.67))
|
||||||
|
|
||||||
|
# Stats grid
|
||||||
|
_populate_stats(def)
|
||||||
|
|
||||||
|
# Abilities
|
||||||
|
_populate_abilities(def)
|
||||||
|
|
||||||
|
show()
|
||||||
|
|
||||||
|
|
||||||
|
# ── Private ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
func _populate_stats(def: Dictionary) -> void:
|
||||||
|
for child in stats_grid.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
var sp : Variant = def.get("spCost", null)
|
||||||
|
var st : Variant = def.get("stCost", null)
|
||||||
|
var dmg : Variant = def.get("damage", null)
|
||||||
|
var hp : Variant = def.get("maxHealth", null)
|
||||||
|
var dfs : Variant = def.get("maxDefense", null)
|
||||||
|
var mov : Variant = def.get("movementPoints", null)
|
||||||
|
|
||||||
|
_add_stat("Spirit", "◆ %s" % (str(sp) if sp != null else "—"))
|
||||||
|
if st != null and int(st) > 0:
|
||||||
|
_add_stat("Stamina", "⚡ %s" % str(st))
|
||||||
|
else:
|
||||||
|
_add_stat("Stamina", "—")
|
||||||
|
_add_stat("Damage", "⚔ %s" % (str(dmg) if dmg != null else "—"))
|
||||||
|
_add_stat("Health", "♥ %s" % (str(hp) if hp != null else "—"))
|
||||||
|
_add_stat("Defense", "▲ %s" % (str(dfs) if dfs != null else "—"))
|
||||||
|
_add_stat("Move", str(mov) if mov != null else "—")
|
||||||
|
|
||||||
|
|
||||||
|
func _add_stat(label_text: String, value_text: String) -> void:
|
||||||
|
var lbl := Label.new()
|
||||||
|
lbl.text = label_text
|
||||||
|
lbl.modulate = Color(0.65, 0.65, 0.72)
|
||||||
|
lbl.theme_override_font_sizes["font_size"] = 12
|
||||||
|
|
||||||
|
var val := Label.new()
|
||||||
|
val.text = value_text
|
||||||
|
val.theme_override_font_sizes["font_size"] = 13
|
||||||
|
|
||||||
|
stats_grid.add_child(lbl)
|
||||||
|
stats_grid.add_child(val)
|
||||||
|
|
||||||
|
|
||||||
|
func _populate_abilities(def: Dictionary) -> void:
|
||||||
|
for child in abilities_list.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
var json_str := str(def.get("abilitiesJson", ""))
|
||||||
|
if json_str.is_empty() or json_str == "[]":
|
||||||
|
abilities_sep.visible = false
|
||||||
|
abilities_title.visible = false
|
||||||
|
return
|
||||||
|
|
||||||
|
var parsed: Variant = JSON.parse_string(json_str)
|
||||||
|
if typeof(parsed) != TYPE_ARRAY or (parsed as Array).is_empty():
|
||||||
|
abilities_sep.visible = false
|
||||||
|
abilities_title.visible = false
|
||||||
|
return
|
||||||
|
|
||||||
|
abilities_sep.visible = true
|
||||||
|
abilities_title.visible = true
|
||||||
|
|
||||||
|
for ab in parsed as Array:
|
||||||
|
if typeof(ab) != TYPE_DICTIONARY:
|
||||||
|
continue
|
||||||
|
var d := ab as Dictionary
|
||||||
|
var name_ := str(d.get("name", d.get("Name", "")))
|
||||||
|
var desc := str(d.get("description", d.get("Description", "")))
|
||||||
|
|
||||||
|
var row := VBoxContainer.new()
|
||||||
|
row.theme_override_constants["separation"] = 2
|
||||||
|
|
||||||
|
var name_lbl := Label.new()
|
||||||
|
name_lbl.text = "[%s]" % name_
|
||||||
|
name_lbl.theme_override_font_sizes["font_size"] = 13
|
||||||
|
name_lbl.modulate = Color(0.90, 0.80, 0.50)
|
||||||
|
row.add_child(name_lbl)
|
||||||
|
|
||||||
|
if not desc.is_empty():
|
||||||
|
var desc_lbl := Label.new()
|
||||||
|
desc_lbl.text = desc
|
||||||
|
desc_lbl.theme_override_font_sizes["font_size"] = 12
|
||||||
|
desc_lbl.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||||
|
desc_lbl.modulate = Color(0.80, 0.80, 0.85)
|
||||||
|
row.add_child(desc_lbl)
|
||||||
|
|
||||||
|
abilities_list.add_child(row)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_overlay_input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton and event.pressed:
|
||||||
|
hide()
|
||||||
|
elif event is InputEventScreenTouch and event.pressed:
|
||||||
|
hide()
|
||||||
@@ -30,9 +30,14 @@ const AFFINITY_BG := {
|
|||||||
"Light": Color(0.47, 0.38, 0.04),
|
"Light": Color(0.47, 0.38, 0.04),
|
||||||
}
|
}
|
||||||
|
|
||||||
const AFFINITY_SYMBOL := {
|
const AFFINITY_ICONS := {
|
||||||
"Fire": "🔥", "Water": "💧", "Earth": "⛰",
|
"Fire": preload("res://icons/affinity_fire.svg"),
|
||||||
"Air": "💨", "Lightning": "⚡", "Dark": "✦", "Light": "★",
|
"Water": preload("res://icons/affinity_water.svg"),
|
||||||
|
"Earth": preload("res://icons/affinity_earth.svg"),
|
||||||
|
"Air": preload("res://icons/affinity_air.svg"),
|
||||||
|
"Lightning": preload("res://icons/affinity_lightning.svg"),
|
||||||
|
"Dark": preload("res://icons/affinity_dark.svg"),
|
||||||
|
"Light": preload("res://icons/affinity_light.svg"),
|
||||||
}
|
}
|
||||||
|
|
||||||
const RARITY_COLOR := {
|
const RARITY_COLOR := {
|
||||||
@@ -53,8 +58,8 @@ signal card_pressed(definition_id: String)
|
|||||||
@onready var sp_label : Label = %SpLabel
|
@onready var sp_label : Label = %SpLabel
|
||||||
@onready var st_label : Label = %StLabel
|
@onready var st_label : Label = %StLabel
|
||||||
@onready var foil_label : Label = %FoilLabel
|
@onready var foil_label : Label = %FoilLabel
|
||||||
@onready var art_rect : ColorRect = %ArtRect
|
@onready var art_rect : ColorRect = %ArtRect
|
||||||
@onready var art_symbol : Label = %ArtSymbol
|
@onready var art_symbol : TextureRect = %ArtSymbol
|
||||||
@onready var name_label : Label = %NameLabel
|
@onready var name_label : Label = %NameLabel
|
||||||
@onready var type_label : Label = %TypeLabel
|
@onready var type_label : Label = %TypeLabel
|
||||||
@onready var rarity_label : Label = %RarityLabel
|
@onready var rarity_label : Label = %RarityLabel
|
||||||
@@ -79,8 +84,8 @@ func setup(dto: Dictionary, def: Dictionary = {}) -> void:
|
|||||||
|
|
||||||
_apply_style()
|
_apply_style()
|
||||||
|
|
||||||
art_rect.color = AFFINITY_BG.get(_affinity, Color(0.18, 0.18, 0.24))
|
art_rect.color = AFFINITY_BG.get(_affinity, Color(0.18, 0.18, 0.24))
|
||||||
art_symbol.text = AFFINITY_SYMBOL.get(_affinity, "◇")
|
art_symbol.texture = AFFINITY_ICONS.get(_affinity, null)
|
||||||
|
|
||||||
foil_label.visible = is_foil
|
foil_label.visible = is_foil
|
||||||
name_label.text = str(dto.get("name", "—"))
|
name_label.text = str(dto.get("name", "—"))
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ var _loading : bool = false
|
|||||||
var _search_timer : float = 0.0
|
var _search_timer : float = 0.0
|
||||||
const _SEARCH_DEBOUNCE := 0.4
|
const _SEARCH_DEBOUNCE := 0.4
|
||||||
|
|
||||||
# Signals emitted to parent when a card is tapped (for future deck-editor use)
|
# Emitted when the user taps a card — parent uses this to show the detail popup.
|
||||||
signal card_selected(player_card_id: String, definition_id: String)
|
signal card_selected(dto: Dictionary, def: Dictionary)
|
||||||
|
|
||||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -136,8 +136,8 @@ func _on_cards_response(payload: Variant, page: int) -> void:
|
|||||||
var def := ContentCache.get_definition(str(dto.get("cardDefinitionId", "")))
|
var def := ContentCache.get_definition(str(dto.get("cardDefinitionId", "")))
|
||||||
var widget = CARD_WIDGET.instantiate() as PanelContainer
|
var widget = CARD_WIDGET.instantiate() as PanelContainer
|
||||||
widget.setup(dto, def)
|
widget.setup(dto, def)
|
||||||
widget.card_pressed.connect(func(def_id: String):
|
widget.card_pressed.connect(func(_def_id: String):
|
||||||
card_selected.emit(str(dto.get("playerCardId", "")), def_id))
|
card_selected.emit(dto, def))
|
||||||
card_grid.add_child(widget)
|
card_grid.add_child(widget)
|
||||||
|
|
||||||
if cards.is_empty() and page == 1:
|
if cards.is_empty() and page == 1:
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ placeholder_text = "••••••••"
|
|||||||
secret = true
|
secret = true
|
||||||
theme_override_font_sizes/font_size = 15
|
theme_override_font_sizes/font_size = 15
|
||||||
|
|
||||||
|
[node name="RememberMe" type="CheckBox" parent="Center/Panel/Margin/VBox/Tabs/Login"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Remember me"
|
||||||
|
theme_override_font_sizes/font_size = 13
|
||||||
|
|
||||||
[node name="LoginSpacer" type="Control" parent="Center/Panel/Margin/VBox/Tabs/Login"]
|
[node name="LoginSpacer" type="Control" parent="Center/Panel/Margin/VBox/Tabs/Login"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
custom_minimum_size = Vector2(0, 4)
|
custom_minimum_size = Vector2(0, 4)
|
||||||
|
|||||||
@@ -9,12 +9,16 @@ extends Control
|
|||||||
## On success: transitions to InitScreen (which runs version check + content sync,
|
## On success: transitions to InitScreen (which runs version check + content sync,
|
||||||
## then proceeds to MainScreen).
|
## then proceeds to MainScreen).
|
||||||
## On failure: shows an error message and re-enables the form.
|
## On failure: shows an error message and re-enables the form.
|
||||||
|
##
|
||||||
|
## Remember Me: saves email + password encrypted with AES-256-CBC to
|
||||||
|
## user://creds.dat. Cleared when the user unchecks the box and logs in.
|
||||||
|
|
||||||
# ── Node references (unique names set in the .tscn) ──────────────────────────
|
# ── Node references (unique names set in the .tscn) ──────────────────────────
|
||||||
|
|
||||||
@onready var email_input : LineEdit = %EmailInput
|
@onready var email_input : LineEdit = %EmailInput
|
||||||
@onready var password_input : LineEdit = %PasswordInput
|
@onready var password_input : LineEdit = %PasswordInput
|
||||||
@onready var login_btn : Button = %LoginBtn
|
@onready var remember_me : CheckBox = %RememberMe
|
||||||
|
@onready var login_btn : Button = %LoginBtn
|
||||||
|
|
||||||
@onready var reg_email_input : LineEdit = %RegEmailInput
|
@onready var reg_email_input : LineEdit = %RegEmailInput
|
||||||
@onready var reg_password_input : LineEdit = %RegPasswordInput
|
@onready var reg_password_input : LineEdit = %RegPasswordInput
|
||||||
@@ -23,6 +27,28 @@ extends Control
|
|||||||
|
|
||||||
@onready var status_label : Label = %StatusLabel
|
@onready var status_label : Label = %StatusLabel
|
||||||
|
|
||||||
|
# ── Credential encryption ─────────────────────────────────────────────────────
|
||||||
|
# AES-256-CBC, 32-byte key embedded and XOR-obfuscated across two halves.
|
||||||
|
|
||||||
|
const _CREDS_PATH := "user://creds.dat"
|
||||||
|
|
||||||
|
# Key halves — XOR'd together at runtime so the plaintext key is never a
|
||||||
|
# contiguous literal in the binary. Both halves must be exactly 16 bytes.
|
||||||
|
const _KEY_A := PackedByteArray([
|
||||||
|
0x7A, 0x4D, 0x9F, 0x2C, 0xB8, 0x61, 0xE3, 0x5A,
|
||||||
|
0x0F, 0xC7, 0x94, 0x3B, 0xD6, 0x2E, 0x81, 0xF5,
|
||||||
|
])
|
||||||
|
const _KEY_B := PackedByteArray([
|
||||||
|
0x4C, 0xA9, 0x73, 0x1E, 0x5B, 0xD8, 0x06, 0x92,
|
||||||
|
0xE7, 0x3F, 0xC4, 0x6A, 0x17, 0x85, 0xB0, 0x2D,
|
||||||
|
])
|
||||||
|
|
||||||
|
# ── State ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
var _was_manual_login := false
|
||||||
|
var _pending_email := ""
|
||||||
|
var _pending_pass := ""
|
||||||
|
|
||||||
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -41,6 +67,13 @@ func _ready() -> void:
|
|||||||
password_input.text_submitted.connect(func(_t): _on_login_pressed())
|
password_input.text_submitted.connect(func(_t): _on_login_pressed())
|
||||||
reg_name_input.text_submitted.connect(func(_t): _on_register_pressed())
|
reg_name_input.text_submitted.connect(func(_t): _on_register_pressed())
|
||||||
|
|
||||||
|
# Pre-fill email/password if saved credentials exist.
|
||||||
|
var creds := _load_creds()
|
||||||
|
if creds.size() == 2:
|
||||||
|
email_input.text = creds[0]
|
||||||
|
password_input.text = creds[1]
|
||||||
|
remember_me.button_pressed = true
|
||||||
|
|
||||||
# Show connection / session-resume status on first open.
|
# Show connection / session-resume status on first open.
|
||||||
if not Auth.session_token.is_empty():
|
if not Auth.session_token.is_empty():
|
||||||
_set_status("Resuming session…", false)
|
_set_status("Resuming session…", false)
|
||||||
@@ -63,6 +96,9 @@ func _on_login_pressed() -> void:
|
|||||||
if email.is_empty() or pass_.is_empty():
|
if email.is_empty() or pass_.is_empty():
|
||||||
_set_status("Please enter your email and password.", true)
|
_set_status("Please enter your email and password.", true)
|
||||||
return
|
return
|
||||||
|
_was_manual_login = true
|
||||||
|
_pending_email = email
|
||||||
|
_pending_pass = pass_
|
||||||
_set_status("Signing in…", false)
|
_set_status("Signing in…", false)
|
||||||
_set_enabled(false)
|
_set_enabled(false)
|
||||||
Auth.login(email, pass_)
|
Auth.login(email, pass_)
|
||||||
@@ -82,10 +118,17 @@ func _on_register_pressed() -> void:
|
|||||||
# ── Auth signal handlers ──────────────────────────────────────────────────────
|
# ── Auth signal handlers ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
func _on_auth_success(_user_id: String, _display_name: String) -> void:
|
func _on_auth_success(_user_id: String, _display_name: String) -> void:
|
||||||
|
if _was_manual_login:
|
||||||
|
if remember_me.button_pressed:
|
||||||
|
_save_creds(_pending_email, _pending_pass)
|
||||||
|
else:
|
||||||
|
_clear_creds()
|
||||||
|
_was_manual_login = false
|
||||||
_go_to_main()
|
_go_to_main()
|
||||||
|
|
||||||
|
|
||||||
func _on_auth_failed(error_code: String, message: String) -> void:
|
func _on_auth_failed(error_code: String, message: String) -> void:
|
||||||
|
_was_manual_login = false
|
||||||
if error_code == "DISCONNECTED":
|
if error_code == "DISCONNECTED":
|
||||||
_set_status("Connection lost. Retrying…", false)
|
_set_status("Connection lost. Retrying…", false)
|
||||||
else:
|
else:
|
||||||
@@ -127,3 +170,77 @@ func _friendly_error(code: String, message: String) -> String:
|
|||||||
_:
|
_:
|
||||||
return message if not message.is_empty() \
|
return message if not message.is_empty() \
|
||||||
else "Something went wrong (%s)." % code
|
else "Something went wrong (%s)." % code
|
||||||
|
|
||||||
|
# ── Credential storage (AES-256-CBC) ─────────────────────────────────────────
|
||||||
|
|
||||||
|
func _build_key() -> PackedByteArray:
|
||||||
|
var key := PackedByteArray()
|
||||||
|
key.resize(32)
|
||||||
|
for i in 16:
|
||||||
|
key[i] = _KEY_A[i] ^ (i * 0x11)
|
||||||
|
key[i + 16] = _KEY_B[i] ^ (i * 0x11)
|
||||||
|
return key
|
||||||
|
|
||||||
|
|
||||||
|
func _save_creds(email: String, password: String) -> void:
|
||||||
|
var plain := (email + "\n" + password).to_utf8_buffer()
|
||||||
|
# PKCS#7 padding to 16-byte block boundary.
|
||||||
|
var pad := 16 - (plain.size() % 16)
|
||||||
|
for _i in pad:
|
||||||
|
plain.append(pad)
|
||||||
|
|
||||||
|
var iv := Crypto.new().generate_random_bytes(16)
|
||||||
|
var key := _build_key()
|
||||||
|
var aes := AESContext.new()
|
||||||
|
if aes.start(AESContext.MODE_CBC_ENCRYPT, key, iv) != OK:
|
||||||
|
push_warning("LoginScreen: AES encrypt start failed")
|
||||||
|
return
|
||||||
|
var cipher := aes.update(plain)
|
||||||
|
aes.finish()
|
||||||
|
|
||||||
|
var f := FileAccess.open(_CREDS_PATH, FileAccess.WRITE)
|
||||||
|
if f == null:
|
||||||
|
push_warning("LoginScreen: cannot write credentials file")
|
||||||
|
return
|
||||||
|
f.store_buffer(iv)
|
||||||
|
f.store_buffer(cipher)
|
||||||
|
|
||||||
|
|
||||||
|
func _load_creds() -> Array:
|
||||||
|
if not FileAccess.file_exists(_CREDS_PATH):
|
||||||
|
return []
|
||||||
|
var f := FileAccess.open(_CREDS_PATH, FileAccess.READ)
|
||||||
|
if f == null:
|
||||||
|
return []
|
||||||
|
var data := f.get_buffer(f.get_length())
|
||||||
|
if data.size() < 32: # 16 IV + at least one 16-byte block
|
||||||
|
return []
|
||||||
|
|
||||||
|
var iv := data.slice(0, 16)
|
||||||
|
var cipher := data.slice(16)
|
||||||
|
var key := _build_key()
|
||||||
|
var aes := AESContext.new()
|
||||||
|
if aes.start(AESContext.MODE_CBC_DECRYPT, key, iv) != OK:
|
||||||
|
push_warning("LoginScreen: AES decrypt start failed")
|
||||||
|
return []
|
||||||
|
var plain := aes.update(cipher)
|
||||||
|
aes.finish()
|
||||||
|
|
||||||
|
# Strip PKCS#7 padding.
|
||||||
|
if plain.size() == 0:
|
||||||
|
return []
|
||||||
|
var pad_len := plain[plain.size() - 1]
|
||||||
|
if pad_len < 1 or pad_len > 16 or pad_len > plain.size():
|
||||||
|
return []
|
||||||
|
plain = plain.slice(0, plain.size() - pad_len)
|
||||||
|
|
||||||
|
var text := plain.get_string_from_utf8()
|
||||||
|
var parts := text.split("\n", false)
|
||||||
|
if parts.size() != 2:
|
||||||
|
return []
|
||||||
|
return [parts[0], parts[1]]
|
||||||
|
|
||||||
|
|
||||||
|
func _clear_creds() -> void:
|
||||||
|
if FileAccess.file_exists(_CREDS_PATH):
|
||||||
|
DirAccess.remove_absolute(ProjectSettings.globalize_path(_CREDS_PATH))
|
||||||
|
|||||||