mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Remove pageLoop
That functionality is now built in to the engine.
This commit is contained in:
parent
6ead0d2f92
commit
3d8971daca
7 changed files with 16 additions and 34 deletions
|
|
@ -301,24 +301,6 @@ function getBuildString()
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a page. If that page completes with an object with a @a nextPage
|
||||
* property that page is opened with the @a args property of that object.
|
||||
* That continues untill there is no @a nextPage property in the completion
|
||||
* value. If there is no @a nextPage in the completion value the
|
||||
* @a completionValue is returned.
|
||||
* @param {String} page - The page first opened.
|
||||
* @param args - passed to the first page opened.
|
||||
*/
|
||||
async function pageLoop(page, args)
|
||||
{
|
||||
let completionValue = { "nextPage": page, "args": args };
|
||||
while (completionValue?.nextPage != null)
|
||||
completionValue = await Engine.OpenChildPage(completionValue.nextPage, completionValue.args);
|
||||
|
||||
return completionValue;
|
||||
}
|
||||
|
||||
function formatXmppAnnouncement(subject, text)
|
||||
{
|
||||
var message = "";
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class CivInfoButton
|
|||
|
||||
async openPage(page)
|
||||
{
|
||||
this.civInfo = await pageLoop(page, this.civInfo.args);
|
||||
this.civInfo = await Engine.OpenChildPage(page, this.civInfo.args);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export const mainMenuItems = [
|
|||
"hotkey": "structree",
|
||||
"onPress": () =>
|
||||
{
|
||||
pageLoop("page_structree.xml");
|
||||
Engine.OpenChildPage("page_structree.xml");
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -56,7 +56,7 @@ export const mainMenuItems = [
|
|||
"hotkey": "civinfo",
|
||||
"onPress": () =>
|
||||
{
|
||||
pageLoop("page_civinfo.xml");
|
||||
Engine.OpenChildPage("page_civinfo.xml");
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ class CivInfoPage extends ReferencePage
|
|||
|
||||
switchToStructreePage()
|
||||
{
|
||||
this.closePageCallback({
|
||||
"nextPage": "page_structree.xml",
|
||||
"args": {
|
||||
this.closePageCallback({ [Engine.openRequest] : {
|
||||
"page": "page_structree.xml",
|
||||
"argument": {
|
||||
"civ": this.activeCiv
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
|
||||
closePage()
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ class CivInfoButton
|
|||
|
||||
onPress()
|
||||
{
|
||||
this.parentPage.closePageCallback({
|
||||
"nextPage": "page_civinfo.xml",
|
||||
"args": {
|
||||
this.parentPage.closePageCallback({ [Engine.openRequest] : {
|
||||
"page": "page_civinfo.xml",
|
||||
"argument": {
|
||||
"civ": this.parentPage.activeCiv
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ class StructreeButton
|
|||
|
||||
onPress()
|
||||
{
|
||||
this.parentPage.closePageCallback({
|
||||
"nextPage": "page_structree.xml",
|
||||
"args": {
|
||||
this.parentPage.closePageCallback({ [Engine.openRequest] : {
|
||||
"page": "page_structree.xml",
|
||||
"argument": {
|
||||
"civ": this.parentPage.activeCiv
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CivIcon
|
|||
closeOpenDialogs();
|
||||
g_PauseControl.implicitPause();
|
||||
|
||||
this.dialogSelection = await pageLoop(
|
||||
this.dialogSelection = await Engine.OpenChildPage(
|
||||
page,
|
||||
{
|
||||
// If an Observer triggers `openPage()` via hotkey, g_ViewedPlayer could be -1 or 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue