polish(streak): add reward milestones and clean Krea2 workflow
Fill the Daily Streak screen with 3-day and 7-day frame progress, and remove the stale template text from the Krea2 CLIPTextEncode node.
This commit is contained in:
1 parent
78f1dbaa31
commit
c65a33b5f0
4 files changed
+5236
-2
No files matched your search
@@ -6,6 +6,8 @@ var current_label: Label
|
|||||||
var best_label: Label
|
var best_label: Label
|
||||||
var goal_label: Label
|
var goal_label: Label
|
||||||
var week_row: HBoxContainer
|
var week_row: HBoxContainer
|
||||||
|
var regular_milestone: Label
|
||||||
|
var night_milestone: Label
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -81,16 +83,41 @@ func _ready() -> void:
|
|||||||
gift_text.custom_minimum_size = Vector2(110, 0)
|
gift_text.custom_minimum_size = Vector2(110, 0)
|
||||||
gift_row.add_child(gift_text)
|
gift_row.add_child(gift_text)
|
||||||
|
|
||||||
|
content.add_child(UI.heading("Streak rewards", 18))
|
||||||
|
var milestones := HBoxContainer.new()
|
||||||
|
milestones.add_theme_constant_override("separation", 6)
|
||||||
|
content.add_child(milestones)
|
||||||
|
regular_milestone = _milestone_card(milestones, "3-day · Regular")
|
||||||
|
night_milestone = _milestone_card(milestones, "7-day · Night Owl")
|
||||||
|
|
||||||
UI.pass_scroll_input(content)
|
UI.pass_scroll_input(content)
|
||||||
SaveGame.progress_changed.connect(refresh)
|
SaveGame.progress_changed.connect(refresh)
|
||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
|
func _milestone_card(parent: HBoxContainer, title: String) -> Label:
|
||||||
|
var panel := UI.panel(Palette.PAPER, 12, 8)
|
||||||
|
panel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
var box := VBoxContainer.new()
|
||||||
|
box.add_theme_constant_override("separation", 2)
|
||||||
|
panel.add_child(box)
|
||||||
|
box.add_child(UI.label(title, 10, Palette.MUTED))
|
||||||
|
var value := UI.label("", 13)
|
||||||
|
box.add_child(value)
|
||||||
|
parent.add_child(panel)
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
var streak := SaveGame.daily_streak()
|
var streak := SaveGame.daily_streak()
|
||||||
current_label.text = str(streak)
|
current_label.text = str(streak)
|
||||||
best_label.text = "Best streak: %d" % SaveGame.best_streak()
|
best_label.text = "Best streak: %d" % SaveGame.best_streak()
|
||||||
goal_label.text = Daily.goal_text(streak)
|
goal_label.text = Daily.goal_text(streak)
|
||||||
|
var best := SaveGame.best_streak()
|
||||||
|
regular_milestone.text = "Unlocked" if best >= 3 else "%d to go" % (3 - best)
|
||||||
|
night_milestone.text = "Unlocked" if best >= 7 else "%d to go" % (7 - best)
|
||||||
|
regular_milestone.add_theme_color_override("font_color", Palette.GOLD if best >= 3 else Palette.INK)
|
||||||
|
night_milestone.add_theme_color_override("font_color", Palette.GOLD if best >= 7 else Palette.INK)
|
||||||
_build_week()
|
_build_week()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -321,6 +321,11 @@ func _test_profile(main, save) -> void:
|
|||||||
await process_frame
|
await process_frame
|
||||||
_check(main.current == "streak", "Profile should open the streak screen")
|
_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.week_row.get_child_count() == 7, "streak screen should show a seven-day week")
|
||||||
|
var best: int = int(save.best_streak())
|
||||||
|
var regular_text := "Unlocked" if best >= 3 else "%d to go" % (3 - best)
|
||||||
|
var night_text := "Unlocked" if best >= 7 else "%d to go" % (7 - best)
|
||||||
|
_check(main.streak.regular_milestone.text == regular_text, "regular milestone should match best streak")
|
||||||
|
_check(main.streak.night_milestone.text == night_text, "night owl milestone should match best streak")
|
||||||
_check(main.streak.current_label.text == str(save.daily_streak()), "streak number should match the save")
|
_check(main.streak.current_label.text == str(save.daily_streak()), "streak number should match the save")
|
||||||
main.show_screen("profile", false)
|
main.show_screen("profile", false)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user