feat(profile): selectable avatars and a daily streak view
Profile now has tabbed Avatar/Frame pickers with preview and Confirm/Cancel. Crumb plus unlocked guest portraits can be chosen as the avatar. A new Daily Streak screen shows the current streak, best streak, weekly calendar, next-frame goal, and a 7-day gift marker. Save format moves to version 4 with avatar_id and completion history.
This commit is contained in:
1 parent
c91586b4a1
commit
d0be689faa
16 files changed
+538
-60
No files matched your search
+34
-6
@@ -53,13 +53,13 @@ func _run() -> void:
|
||||
|
||||
|
||||
func _test_screen_cycle(main) -> void:
|
||||
var expected: Array[String] = ["home", "game", "guest_book", "rules", "profile"]
|
||||
_check(main.screens.size() == expected.size(), "Main should expose all five screens")
|
||||
var expected: Array[String] = ["home", "game", "guest_book", "rules", "profile", "streak"]
|
||||
_check(main.screens.size() == expected.size(), "Main should expose all six screens")
|
||||
for name in expected:
|
||||
_check(main.screens.has(name) and main.screens[name] != null, "screen missing: %s" % name)
|
||||
_check(
|
||||
main.home != null and main.game != null and main.guest_book != null
|
||||
and main.rulebook != null and main.profile != null,
|
||||
and main.rulebook != null and main.profile != null and main.streak != null,
|
||||
"named screen references should all exist"
|
||||
)
|
||||
_check(main.settings_sheet != null, "settings sheet missing")
|
||||
@@ -169,6 +169,8 @@ func _test_profile(main, save) -> void:
|
||||
if profile == null:
|
||||
return
|
||||
|
||||
profile._set_tab("frame")
|
||||
await process_frame
|
||||
var expected: int = frames.all().size()
|
||||
_check(profile.frame_grid.get_child_count() == expected, "Profile should show every frame")
|
||||
for i in range(profile.frame_grid.get_child_count()):
|
||||
@@ -211,9 +213,19 @@ func _test_profile(main, save) -> void:
|
||||
_check(int(probe["count"]) == count_before, "frame grid must stay stable while pressed emits")
|
||||
await process_frame
|
||||
await process_frame
|
||||
_check(save.selected_frame() == "regular", "pressing an unlocked frame should select it")
|
||||
_check(profile.pending_frame == "regular", "frame card should update the preview")
|
||||
profile._on_confirm()
|
||||
await process_frame
|
||||
_check(save.selected_frame() == "regular", "Confirm should apply the frame")
|
||||
_check(profile.status_label.text.find("Profile updated") >= 0, "confirmation should be reported")
|
||||
_check(profile.frame_grid.get_child_count() == count_before, "frame grid should stay stable after selection")
|
||||
_check(profile.status_label.text.find("Now wearing") >= 0, "selection should be reported in profile status")
|
||||
|
||||
profile.pending_frame = "plain"
|
||||
profile._build_portrait()
|
||||
profile._build_grid()
|
||||
profile._on_cancel()
|
||||
await process_frame
|
||||
_check(save.selected_frame() == "regular", "Cancel should not write to the save")
|
||||
|
||||
var locked_card = profile.frame_grid.get_child(night_index)
|
||||
locked_card.pressed.emit()
|
||||
@@ -222,7 +234,23 @@ func _test_profile(main, save) -> void:
|
||||
profile.status_label.text.find(frames.requirement_text("night")) >= 0,
|
||||
"locked frame should show its requirement"
|
||||
)
|
||||
_check(save.selected_frame() == "regular", "locked frame must not change the selection")
|
||||
_check(profile.pending_frame == "regular", "locked frame must not change the preview")
|
||||
|
||||
profile._set_tab("avatar")
|
||||
await process_frame
|
||||
_check(profile.frame_grid.get_child_count() > 10, "avatar tab should list portraits")
|
||||
for i in range(profile.frame_grid.get_child_count()):
|
||||
_check(
|
||||
profile.frame_grid.get_child(i).mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||
"avatar card %d should pass swipes" % i
|
||||
)
|
||||
|
||||
profile.streak_pressed.emit()
|
||||
await process_frame
|
||||
_check(main.current == "streak", "Profile should open the streak screen")
|
||||
_check(main.streak.week_row.get_child_count() == 7, "streak screen should show a seven-day week")
|
||||
_check(main.streak.current_label.text == str(save.daily_streak()), "streak number should match the save")
|
||||
main.show_screen("profile", false)
|
||||
|
||||
|
||||
func _test_daily(main, save) -> void:
|
||||
|
||||
Reference in new issue
Block a user