Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/settings.js
Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | return [ | ||||
"Title": translateWithContext("map", "Scenario"), | "Title": translateWithContext("map", "Scenario"), | ||||
"Description": translate("A map with a predefined landscape and matchsettings.") | "Description": translate("A map with a predefined landscape and matchsettings.") | ||||
} | } | ||||
]; | ]; | ||||
} | } | ||||
function loadBiomes() | function loadBiomes() | ||||
{ | { | ||||
return Engine.BuildDirEntList(g_BiomesDirectory, "*.json", false).map(file => { | return Engine.ListDirectoryFiles(g_BiomesDirectory, "*.json", false).map(file => { | ||||
let description = Engine.ReadJSONFile(file).Description; | let description = Engine.ReadJSONFile(file).Description; | ||||
return { | return { | ||||
"Id": file.substr(g_BiomesDirectory.length).slice(0, -".json".length), | "Id": file.substr(g_BiomesDirectory.length).slice(0, -".json".length), | ||||
"Title": translateWithContext("biome definition", description.Title), | "Title": translateWithContext("biome definition", description.Title), | ||||
"Description": translateWithContext("biome definition", description.Description) | "Description": translateWithContext("biome definition", description.Description) | ||||
}; | }; | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Loads available gametypes. | * Loads available gametypes. | ||||
* | * | ||||
* @returns {Array|undefined} | * @returns {Array|undefined} | ||||
*/ | */ | ||||
function loadVictoryConditions() | function loadVictoryConditions() | ||||
{ | { | ||||
let subdir = "victory_conditions/"; | let subdir = "victory_conditions/"; | ||||
let files = Engine.BuildDirEntList(g_SettingsDirectory + subdir, "*.json", false).map( | let files = Engine.ListDirectoryFiles(g_SettingsDirectory + subdir, "*.json", false).map( | ||||
file => file.substr(g_SettingsDirectory.length)); | file => file.substr(g_SettingsDirectory.length)); | ||||
let victoryConditions = files.map(file => { | let victoryConditions = files.map(file => { | ||||
let vc = loadSettingValuesFile(file); | let vc = loadSettingValuesFile(file); | ||||
if (vc) | if (vc) | ||||
vc.Name = file.substr(subdir.length, file.length - (subdir + ".json").length); | vc.Name = file.substr(subdir.length, file.length - (subdir + ".json").length); | ||||
return vc; | return vc; | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator