Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/reference/viewer/viewer.js
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
var g_RankIconPath = "session/icons/ranks/"; | var g_RankIconPath = "session/icons/ranks/"; | ||||
/** | /** | ||||
* Page initialisation. May also eventually pre-draw/arrange objects. | * Page initialisation. May also eventually pre-draw/arrange objects. | ||||
* | * | ||||
* @param {object} data - Contains the civCode and the name of the template to display. | * @param {object} data - Contains the civCode and the name of the template to display. | ||||
* @param {string} data.templateName | * @param {string} data.templateName | ||||
* @param {string} [data.civ] | * @param {string} [data.civ] | ||||
* @param {*} [data.callback] - If set and loosely equivalent to true, a callback is | |||||
* assumed to be setup ready be called by the Engine upon | |||||
* closure of this page. | |||||
*/ | */ | ||||
function init(data) | function init(data) | ||||
{ | { | ||||
if (!data || !data.templateName) | if (!data || !data.templateName) | ||||
{ | { | ||||
error("Viewer: No template provided"); | error("Viewer: No template provided"); | ||||
closePage(); | closePage(); | ||||
return; | return; | ||||
} | } | ||||
if (data.callback) | |||||
g_CallbackSet = true; | |||||
let templateName = removeFiltersFromTemplateName(data.templateName); | let templateName = removeFiltersFromTemplateName(data.templateName); | ||||
let isTech = techDataExists(templateName); | let isTech = techDataExists(templateName); | ||||
// Attempt to get the civ code from the template, or, if | // Attempt to get the civ code from the template, or, if | ||||
// it's a technology, from the researcher's template. | // it's a technology, from the researcher's template. | ||||
if (!isTech) | if (!isTech) | ||||
{ | { | ||||
// Catch and redirect if template is a non-promotion variant of | // Catch and redirect if template is a non-promotion variant of | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator