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
@@ -0,0 +1,56 @@
|
||||
class_name Avatars
|
||||
extends RefCounted
|
||||
|
||||
## Selectable profile portraits. Crumb is always available; guest portraits
|
||||
## unlock with the corresponding Guest Book entry.
|
||||
|
||||
static func all() -> Array:
|
||||
var out := [{
|
||||
"id": "crumb",
|
||||
"name": "Crumb",
|
||||
"path": "res://art/crumb_head.png",
|
||||
"room": 0,
|
||||
}]
|
||||
for guest in Guests.all():
|
||||
var id := str(guest.get("id", ""))
|
||||
if id.is_empty():
|
||||
continue
|
||||
out.append({
|
||||
"id": id,
|
||||
"name": str(guest.get("name", id)),
|
||||
"path": Guests.portrait(id, "thumbs"),
|
||||
"room": int(guest.get("unlock_room", 0)),
|
||||
})
|
||||
return out
|
||||
|
||||
|
||||
static func by_id(id: String) -> Dictionary:
|
||||
for avatar in all():
|
||||
if str(avatar.get("id", "")) == id:
|
||||
return avatar
|
||||
return {}
|
||||
|
||||
|
||||
static func portrait_path(id: String) -> String:
|
||||
var avatar := by_id(id)
|
||||
if avatar.is_empty():
|
||||
return "res://art/crumb_head.png"
|
||||
return str(avatar.get("path", "res://art/crumb_head.png"))
|
||||
|
||||
|
||||
static func is_unlocked(id: String) -> bool:
|
||||
if id == "crumb":
|
||||
return true
|
||||
var avatar := by_id(id)
|
||||
if avatar.is_empty():
|
||||
return false
|
||||
return SaveGame.is_guest_unlocked(id)
|
||||
|
||||
|
||||
static func requirement_text(id: String) -> String:
|
||||
var avatar := by_id(id)
|
||||
if avatar.is_empty():
|
||||
return ""
|
||||
if id == "crumb":
|
||||
return "Always available"
|
||||
return "Meet in Room %d" % int(avatar.get("room", 0))
|
||||
Reference in new issue
Block a user