Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/common/functions_utility.js
/** | /** | ||||
* Used for acoustic GUI notifications. | * Used for acoustic GUI notifications. | ||||
* Define the soundfile paths and specific time thresholds (avoid spam). | * Define the soundfile paths and specific time thresholds (avoid spam). | ||||
* And store the timestamp of last interaction for each notification. | * And store the timestamp of last interaction for each notification. | ||||
*/ | */ | ||||
var g_SoundNotifications = { | var g_SoundNotifications = { | ||||
"nick": { "soundfile": "audio/interface/ui/chat_alert.ogg", "threshold": 3000 } | "nick": { "soundfile": "audio/interface/ui/chat_alert.ogg", "threshold": 3000 } | ||||
}; | }; | ||||
// Get list of XML files in pathname with recursion, excepting those starting with _ | // Get list of XML files in pathname with recursion, excepting those starting with _ | ||||
function getXMLFileList(pathname) | function getXMLFileList(pathname) | ||||
{ | { | ||||
var files = Engine.BuildDirEntList(pathname, "*.xml", true); | var files = Engine.ListDirectoryFiles(pathname, "*.xml", true); | ||||
var result = []; | var result = []; | ||||
// Get only subpath from filename and discard extension | // Get only subpath from filename and discard extension | ||||
for (var i = 0; i < files.length; ++i) | for (var i = 0; i < files.length; ++i) | ||||
{ | { | ||||
var file = files[i]; | var file = files[i]; | ||||
file = file.substring(pathname.length, file.length - 4); | file = file.substring(pathname.length, file.length - 4); | ||||
// Split path into directories so we can check for beginning _ character | // Split path into directories so we can check for beginning _ character | ||||
var tokens = file.split("/"); | var tokens = file.split("/"); | ||||
if (tokens[tokens.length - 1][0] != "_") | if (tokens[tokens.length - 1][0] != "_") | ||||
result.push(file); | result.push(file); | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
function getJSONFileList(pathname) | function getJSONFileList(pathname) | ||||
{ | { | ||||
// Remove the path and extension from each name, since we just want the filename | // Remove the path and extension from each name, since we just want the filename | ||||
return Engine.BuildDirEntList(pathname, "*.json", false).map( | return Engine.ListDirectoryFiles(pathname, "*.json", false).map( | ||||
filename => filename.substring(pathname.length, filename.length - 5)); | filename => filename.substring(pathname.length, filename.length - 5)); | ||||
} | } | ||||
/** | /** | ||||
* Returns translated history and gameplay data of all civs, optionally including a mock gaia civ. | * Returns translated history and gameplay data of all civs, optionally including a mock gaia civ. | ||||
*/ | */ | ||||
function loadCivData(selectableOnly, gaia) | function loadCivData(selectableOnly, gaia) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator