Documentation
¶
Overview ¶
Package progress persists the player's journey to a versioned JSON file.
Index ¶
Constants ¶
View Source
const Version = 2
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Progress ¶
type Progress struct {
Version int `json:"version"`
XP int `json:"xp"`
Level int `json:"level"`
Stars map[string]int `json:"stars"`
Completed []string `json:"completed"`
Badges []string `json:"badges"`
LastLesson string `json:"lastLesson"`
// Theme is the selected UI color theme (empty = default). It is a display
// setting rather than progress, but it rides along in the same file. Added
// after Version 2; omitempty keeps it out of older saves, and a missing
// value unmarshals to "" so v2 files load without a version bump.
Theme string `json:"theme,omitempty"`
}
func Load ¶
Load never fails: missing, corrupt, or old-version files yield a fresh Progress (old files are kept as <path>.v1.bak).
func (*Progress) IsCompleted ¶
func (*Progress) MarkCompleted ¶
Click to show internal directories.
Click to hide internal directories.