1
0
forked from 0ad/0ad

Only show the full template run name + template name if they're different.

The campaign screen currently shows both the name of the run (selected
by the user) and the name of the campaign. This is, by default, the
same, and thus looks weird.

Reported by: langbart, marder
Tested by: marder
Differential Revision: https://code.wildfiregames.com/D4158
This was SVN commit r25780.
This commit is contained in:
wraitii 2021-06-12 17:19:09 +00:00
parent 956b3f96db
commit 7e423fe20e
2 changed files with 7 additions and 6 deletions

View File

@ -11,7 +11,7 @@ class NewCampaignModal
Engine.GetGUIObjectByName('cancelButton').onPress = () => Engine.PopGuiPage();
Engine.GetGUIObjectByName('startButton').onPress = () => this.createAndStartCampaign();
Engine.GetGUIObjectByName('runDescription').caption = translate(this.template.Name);
Engine.GetGUIObjectByName('runDescription').caption = translateWithContext("Campaign Template", this.template.Name);
Engine.GetGUIObjectByName('runDescription').onTextEdit = () => {
Engine.GetGUIObjectByName('startButton').enabled = Engine.GetGUIObjectByName('runDescription').caption.length > 0;
};

View File

@ -107,15 +107,16 @@ class CampaignRun
}
/**
* @param forlist - if true, generate a label for listing all runs.
* Otherwise, just return a short human readable name.
* (not currently used for regular runs).
* Return a readable name for this campaign.
* @param full - if true, include both user description and template name. Otherwise, skip one if they're identical.
*/
getLabel(forList)
getLabel(full)
{
if (!full && this.meta.userDescription === translateWithContext("Campaign Template", this.template.Name))
return this.meta.userDescription;
return sprintf(translate("%(userDesc)s - %(templateName)s"), {
"userDesc": this.meta.userDescription,
"templateName": this.template.Name
"templateName": translateWithContext("Campaign Template", this.template.Name)
});
}