Changeset View
Standalone View
binaries/data/mods/public/gui/session/messages.js
Show First 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | addChatMessage({ | ||||
"status": notification.status | "status": notification.status | ||||
}); | }); | ||||
updatePlayerData(); | updatePlayerData(); | ||||
}, | }, | ||||
"ceasefire-ended": function(notification, player) | "ceasefire-ended": function(notification, player) | ||||
{ | { | ||||
updatePlayerData(); | updatePlayerData(); | ||||
}, | }, | ||||
"tutorial": function(notification, player) | |||||
{ | |||||
updateTutorial(notification); | |||||
}, | |||||
"tribute": function(notification, player) | "tribute": function(notification, player) | ||||
{ | { | ||||
addChatMessage({ | addChatMessage({ | ||||
"type": "tribute", | "type": "tribute", | ||||
"sourcePlayer": notification.donator, | "sourcePlayer": notification.donator, | ||||
"targetPlayer": player, | "targetPlayer": player, | ||||
"amounts": notification.amounts | "amounts": notification.amounts | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | for (let notification of Engine.GuiInterfaceCall("GetNotifications")) | ||||
} | } | ||||
for (let player of notification.players) | for (let player of notification.players) | ||||
g_NotificationsTypes[notification.type](notification, player); | g_NotificationsTypes[notification.type](notification, player); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Updates the tutorial panel when a new goal. | |||||
elexis: That comment should be replaced with an accurate one.
The code seems universal enough to… | |||||
*/ | |||||
function updateTutorial(notification) | |||||
{ | |||||
// Show the tutorial panel if not yet done | |||||
Engine.GetGUIObjectByName("tutorialPanel").hidden = false; | |||||
if (notification.warning) | |||||
{ | |||||
Engine.GetGUIObjectByName("tutorialWarning").caption = "[color=\"orange\"]" + notification.message + "[/color]"; | |||||
Not Done Inline ActionsThe colors should become globals g_TutorialColorWarning and g_TutorialColorText so that if we want to change the color, we only have to change one place without investigating whether we fixed all occurances. Nice side effect that mods can change it from other files elexis: The colors should become globals g_TutorialColorWarning and g_TutorialColorText so that if we… | |||||
Not Done Inline ActionsI think having a working tutorial is the most important feature missing in 0ad, and that it should be included, tested and then improved (not the other way). That would allow everybody being able to modify such things which for the moment i really don't care compared to the goal of having such a tutorial easily accessible from the learn to play menu (for me that would be the most important feature for A22 to help new players), and which certainly will change when people try and use it. mimo: I think having a working tutorial is the most important feature missing in 0ad, and that it… | |||||
Not Done Inline Actions
Agree that we should have it in Alpha 22 to give people a good place to start before they are lost when starting the first games.
I don't mind if it's reviewed or not as long as defects are worked out elexis: > I think having a working tutorial is the most important feature missing in 0ad
Agree that we… | |||||
return; | |||||
} | |||||
let tutorialText = Engine.GetGUIObjectByName("tutorialText"); | |||||
let caption = tutorialText.caption.replace('[color=\"yellow\"]', '').replace('[/color]', ''); | |||||
Not Done Inline ActionsThe replacement is ugly. Recall the uncolored last message in a global if needed or rewrite things to avoid it. Notice there could be multiple colorization inside the message given by the tutorial map. Strings might be improved, I have to test this elexis: The replacement is ugly. Recall the uncolored last message in a global if needed or rewrite… | |||||
Not Done Inline ActionsIf this is tutorial interface is going to be used by developers and players, someone will eventually attempt to set a color and break it. When receiving a new tutorial message, the caption could just show (Could also use a string and append it to it, but might be handy in the future to do something with individual notifications at prior times) elexis: If this is tutorial interface is going to be used by developers and players, someone will… | |||||
if (caption) | |||||
caption += "\n"; | |||||
tutorialText.caption = caption + "[color=\"yellow\"]" + notification.message + "[/color]"; | |||||
if (notification.readyButton) | |||||
Not Done Inline ActionsIf used more than once: Replacing an existing button caption and onPress often results in issues, for example the launchGame button in the gamesetup which is also used as a ready button. elexis: If used more than once:
let tutorialWarning = Engine.GetGUIObjectByName("tutorialReady");
let… | |||||
Not Done Inline Actionsi'm not convinced that's better. mimo: i'm not convinced that's better. | |||||
{ | |||||
Engine.GetGUIObjectByName("tutorialReady").hidden = false; | |||||
if (notification.leave) | |||||
{ | |||||
Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Click to quit this tutorial."); | |||||
Engine.GetGUIObjectByName("tutorialReady").caption = translate("Quit"); | |||||
Engine.GetGUIObjectByName("tutorialReady").onPress = leaveGame; | |||||
} | |||||
else | |||||
Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Click when ready."); | |||||
} | |||||
else | |||||
{ | |||||
Engine.GetGUIObjectByName("tutorialWarning").caption = translate("Follow the instructions."); | |||||
Engine.GetGUIObjectByName("tutorialReady").hidden = true; | |||||
} | |||||
} | |||||
/** | |||||
* Displays all active counters (messages showing the remaining time) for wonder-victory, ceasefire etc. | * Displays all active counters (messages showing the remaining time) for wonder-victory, ceasefire etc. | ||||
*/ | */ | ||||
function updateTimeNotifications() | function updateTimeNotifications() | ||||
{ | { | ||||
let notifications = Engine.GuiInterfaceCall("GetTimeNotifications", g_ViewedPlayer); | let notifications = Engine.GuiInterfaceCall("GetTimeNotifications", g_ViewedPlayer); | ||||
let notificationText = ""; | let notificationText = ""; | ||||
for (let n of notifications) | for (let n of notifications) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 633 Lines • Show Last 20 Lines |
That comment should be replaced with an accurate one.
The code seems universal enough to handle all sorts of tutorials, so I'd be ok with adding it to the session/