mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
- Refactor achievements to make use of Signals - Move implemented achievement interfaces to appropriate platform folders (SteamAchievements in currently in use in browser wrapper for testing) - Fix invalid jsdocs - Add dev-standalone script to package.json scripts
59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
/* typehints:start */
|
|
import { Application } from "../application";
|
|
/* typehints:end */
|
|
|
|
export const ACHIEVEMENTS = {
|
|
painting: "painting",
|
|
cutting: "cutting",
|
|
rotating: "rotating",
|
|
stacking: "stacking",
|
|
blueprints: "blueprints",
|
|
}
|
|
|
|
export class AchievementsInterface {
|
|
/** @param {Application} app */
|
|
constructor(app) {
|
|
this.app = app;
|
|
}
|
|
|
|
/**
|
|
* Load achievements into an initial state, bypassing unlocked and/or
|
|
* irrelevant achievements where possible.
|
|
*
|
|
* @params key
|
|
* @returns {Promise<void>}
|
|
*/
|
|
load() {
|
|
abstract;
|
|
return Promise.reject();
|
|
}
|
|
|
|
/**
|
|
* Call to unlock an achievement
|
|
* @params {string} [key] - A property within the ACHIEVEMENTS enum or empty if
|
|
* bypassing.
|
|
* @returns {void}
|
|
*/
|
|
unlock(key) {
|
|
abstract;
|
|
}
|
|
|
|
/**
|
|
* Initializes the list of achievements.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
initialize() {
|
|
abstract;
|
|
return Promise.reject();
|
|
}
|
|
|
|
/**
|
|
* Checks if achievements are supported in the current build
|
|
* @returns {boolean}
|
|
*/
|
|
hasAchievements() {
|
|
abstract;
|
|
return false;
|
|
}
|
|
}
|