Differential D3347 Diff 17093 ps/trunk/binaries/data/mods/public/gui/reference/common/TemplateVariant.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/reference/common/TemplateVariant.js
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
svn:mime-type | null | text/js \ No newline at end of property |
/** | |||||
* Enum-type class that defines various template variant types. | |||||
*/ | |||||
class TemplateVariant | |||||
{ | |||||
/** | |||||
* @param passthru Signifies if we should pass though to the base template when generating build lists. | |||||
*/ | |||||
constructor(name, passthru=true) | |||||
{ | |||||
this.name = name; | |||||
this.passthru = passthru; | |||||
TemplateVariant[name] = this; | |||||
} | |||||
static registerType(name, passthru=true) | |||||
{ | |||||
TemplateVariant[name] = new TemplateVariant(name, passthru); | |||||
} | |||||
toString() | |||||
{ | |||||
return this.constructor.name + "." + this.name; | |||||
} | |||||
} | |||||
/** | |||||
* Registered Template Variants. | |||||
* New variants add themselves as static properties to the main class. | |||||
*/ | |||||
TemplateVariant.registerType("base"); | |||||
TemplateVariant.registerType("unknown"); | |||||
TemplateVariant.registerType("upgrade", false); | |||||
TemplateVariant.registerType("promotion", false); | |||||
TemplateVariant.registerType("unlockedByTechnology"); | |||||
TemplateVariant.registerType("trainable"); |
Wildfire Games · Phabricator