Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/aiconfig/aiconfig.js
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | function checkBehavior() | ||||
let aiBehavior = Engine.GetGUIObjectByName("aiBehavior"); | let aiBehavior = Engine.GetGUIObjectByName("aiBehavior"); | ||||
aiBehavior.enabled = false; | aiBehavior.enabled = false; | ||||
aiBehavior.selected = g_Settings.AIBehaviors.findIndex(b => b.Name == "balanced"); | aiBehavior.selected = g_Settings.AIBehaviors.findIndex(b => b.Name == "balanced"); | ||||
} | } | ||||
function returnAI(save = true) | function returnAI(save = true) | ||||
{ | { | ||||
let idx = Engine.GetGUIObjectByName("aiSelection").selected; | let idx = Engine.GetGUIObjectByName("aiSelection").selected; | ||||
Engine.PopGuiPage({ | |||||
// Pop the page before calling the callback, so the callback runs | |||||
// in the parent GUI page's context | |||||
Engine.PopGuiPageCB({ | |||||
"save": save, | "save": save, | ||||
"id": g_AIDescriptions[idx].id, | "id": g_AIDescriptions[idx].id, | ||||
"name": g_AIDescriptions[idx].data.name, | "name": g_AIDescriptions[idx].data.name, | ||||
"difficulty": Engine.GetGUIObjectByName("aiDifficulty").selected, | "difficulty": Engine.GetGUIObjectByName("aiDifficulty").selected, | ||||
"behavior": g_Settings.AIBehaviors[Engine.GetGUIObjectByName("aiBehavior").selected].Name, | "behavior": g_Settings.AIBehaviors[Engine.GetGUIObjectByName("aiBehavior").selected].Name, | ||||
"playerSlot": g_PlayerSlot | "playerSlot": g_PlayerSlot | ||||
}); | }); | ||||
} | } |
Wildfire Games · Phabricator