Achievements
| Kind | class |
| Package | backend |
| Full name | backend.Achievements |
| Source | source/backend/Achievements.hx |
| Compiled when | #if ACHIEVEMENTS_ALLOWED |
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
achievements | Map<String, Achievement> | yes | new Map<String, Achievement>() | #if ACHIEVEMENTS_ALLOWED |
variables | Map<String, Float> | yes | [] | #if ACHIEVEMENTS_ALLOWED |
achievementsUnlocked | Array<String> | yes | [] | #if ACHIEVEMENTS_ALLOWED |
showingPopups | Bool | yes | — | property (get, never) · #if ACHIEVEMENTS_ALLOWED |
Public methods
init
static function init()
Only compiled when #if ACHIEVEMENTS_ALLOWED.
get
static function get(name:String):Achievement
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
exists
static function exists(name:String):Bool
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
load
static function load():Void
Only compiled when #if ACHIEVEMENTS_ALLOWED.
save
static function save():Void
Only compiled when #if ACHIEVEMENTS_ALLOWED.
getScore
static function getScore(name:String):Float
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
setScore
static function setScore(name:String, value:Float, saveIfNotUnlocked:Bool = true):Float
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
value | Float | — |
saveIfNotUnlocked (optional) | Bool | true |
addScore
static function addScore(name:String, value:Float = 1, saveIfNotUnlocked:Bool = true):Float
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
value (optional) | Float | 1 |
saveIfNotUnlocked (optional) | Bool | true |
unlock
static function unlock(name:String, autoStartPopup:Bool = true):String
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
autoStartPopup (optional) | Bool | true |
isUnlocked
static inline function isUnlocked(name:String)
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
get_showingPopups
static function get_showingPopups()
Only compiled when #if ACHIEVEMENTS_ALLOWED.
startPopup
static function startPopup(achieve:String, endFunc:Void->Void = null)
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
achieve | String | — |
endFunc | Void->Void = null | — |
createAchievement
static function createAchievement(name:String, data:Achievement, mod:String = null)
Only compiled when #if ACHIEVEMENTS_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
name | String | — |
data | Achievement | — |
mod (optional) | String | null |
reloadList
static function reloadList()
Only compiled when #if ACHIEVEMENTS_ALLOWED + #if MODS_ALLOWED.
addLuaCallbacks
static function addLuaCallbacks(lua:State)
Only compiled when #if ACHIEVEMENTS_ALLOWED + #if MODS_ALLOWED + #if LUA_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
lua | State | — |
addPythonCallbacks
static function addPythonCallbacks(python:PythonScript)
Only compiled when #if ACHIEVEMENTS_ALLOWED + #if MODS_ALLOWED + #if PYTHON_ALLOWED.
| Parameter | Type | Default |
|---|---|---|
python | PythonScript | — |
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
_firstLoad | Bool | yes |
_lastUnlock | Int | yes |
_popups | Array<AchievementPopup> | yes |
_sortID | — | yes |
_originalLength | — | yes |
| Method |
|---|
static function _scoreFunc(name:String, mode:Int = 0, addOrSet:Float = 1, saveIfNotUnlocked:Bool = true):Float |
static inline function loadAchievementJson(path:String, addMods:Bool = true) |