Ticket #2549: tooltipOptions.patch
File tooltipOptions.patch, 7.1 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/gui/options/options.js
9 9 [translate("Windowed Mode"), translate("Start 0 A.D. in a window"), {"config":"windowed"}, "boolean"], 10 10 [translate("Background Pause"), translate("Pause single player games when window loses focus"), {"config":"pauseonfocusloss"}, "boolean"], 11 11 [translate("Disable Welcome Screen"), translate("If you disable this screen completely, you may miss important announcements.\nYou can still launch it using the main menu."), {"config":"splashscreendisable"}, "boolean"], 12 [translate("Detailed Tooltips"), translate("Show detailed tooltips for trainable units in unit-producing buildings."), {"config":"showdetailedtooltips"}, "boolean"], 12 13 [translate("Developer Overlay"), translate("Show overlay in-game with options such as reveal map, control all units, and change perspective. Designed for use by developers"), {"config":"developeroverlay.enable"}, "boolean"], 13 14 ], 14 15 "graphicsSetting": -
binaries/data/mods/public/gui/session/unit_commands.js
514 514 var [trainEntLimit, trainEntCount, canBeAddedCount, trainEntLimitChangers] = 515 515 getEntityLimitAndCount(playerState, entType); 516 516 tooltip += formatLimitString(trainEntLimit, trainEntCount, trainEntLimitChangers); 517 517 if (Engine.ConfigDB_GetValue("user", "showdetailedtooltips") === "true") 518 { 519 if (template.health) 520 tooltip += "\n[font=\"sans-bold-13\"]" + translate("Health:") + "[/font] " + template.health; 521 if (template.attack) 522 tooltip += "\n" + getEntityAttack(template); 523 if (template.armour) 524 tooltip += "\n[font=\"sans-bold-13\"]" + translate("Armour") + ":[/font] " + armorTypesToText(template.armour); 525 if (template.speed) 526 tooltip += "\n" + getEntitySpeed(template); 527 } 518 528 tooltip += "[color=\"255 251 131\"]" + formatBatchTrainingString(buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch) + "[/color]"; 519 529 break; 520 530 -
binaries/data/mods/public/gui/session/utility_functions.js
234 234 if (dmg.hack) 235 235 dmgArray.push(sprintf(translate("%(damage)s %(damageType)s"), { 236 236 damage: dmg.hack, 237 damageType: "[font=\"sans-1 2\"]" + translate("Hack") + "[/font]"237 damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Hack") + "[/color][/font]" 238 238 })); 239 239 if (dmg.pierce) 240 240 dmgArray.push(sprintf(translate("%(damage)s %(damageType)s"), { 241 241 damage: dmg.pierce, 242 damageType: "[font=\"sans-1 2\"]" + translate("Pierce") + "[/font]"242 damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Pierce") + "[/color][/font]" 243 243 })); 244 244 if (dmg.crush) 245 245 dmgArray.push(sprintf(translate("%(damage)s %(damageType)s"), { 246 246 damage: dmg.crush, 247 damageType: "[font=\"sans-1 2\"]" + translate("Crush") + "[/font]"247 damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Crush") + "[/color][/font]" 248 248 })); 249 249 250 250 return dmgArray.join("[font=\"sans-12\"]" + translate(", ") + "[/font]"); … … 260 260 if (dmg.hack) 261 261 dmgArray.push(sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), { 262 262 damage: dmg.hack, 263 damageType: "[font=\"sans-1 2\"]" + translate("Hack") + "[/font]",263 damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Hack") + "[/color][/font]", 264 264 armorPercentage: "[font=\"sans-10\"]" + sprintf(translate("(%(armorPercentage)s)"), { armorPercentage: armorLevelToPercentageString(dmg.hack) }) + "[/font]" 265 265 })); 266 266 if (dmg.pierce) 267 267 dmgArray.push(sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), { 268 268 damage: dmg.pierce, 269 damageType: "[font=\"sans-1 2\"]" + translate("Pierce") + "[/font]",269 damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Pierce") + "[/color][/font]", 270 270 armorPercentage: "[font=\"sans-10\"]" + sprintf(translate("(%(armorPercentage)s)"), { armorPercentage: armorLevelToPercentageString(dmg.pierce) }) + "[/font]" 271 271 })); 272 272 if (dmg.crush) 273 273 dmgArray.push(sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), { 274 274 damage: dmg.crush, 275 damageType: "[font=\"sans-1 2\"]" + translate("Crush") + "[/font]",275 damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Crush") + "[/color][/font]", 276 276 armorPercentage: "[font=\"sans-10\"]" + sprintf(translate("(%(armorPercentage)s)"), { armorPercentage: armorLevelToPercentageString(dmg.crush) }) + "[/font]" 277 277 })); 278 278 … … 574 574 { 575 575 var label = "[font=\"sans-bold-13\"]" + translate("Speed:") + "[/font]"; 576 576 var speeds = []; 577 if (template.speed.walk) speeds.push(sprintf(translate("%(speed)s %(movementType)s"), { speed: template.speed.walk, movementType: "[font=\"sans-12\"]" + translate("Walk") + "[/font]"})); 578 if (template.speed.run) speeds.push(sprintf(translate("%(speed)s %(movementType)s"), { speed: template.speed.run, movementType: "[font=\"sans-12\"]" + translate("Run") + "[/font]"})); 577 if (template.speed.walk) 578 speeds.push(sprintf(translate("%(speed)s %(movementType)s"), { speed: template.speed.walk, movementType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Walk") + "[/color][/font]"})); 579 if (template.speed.run) 580 speeds.push(sprintf(translate("%(speed)s %(movementType)s"), { speed: template.speed.run, movementType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Run") + "[/color][/font]"})); 579 581 580 582 speed = sprintf(translate("%(label)s %(speeds)s"), { label: label, speeds: speeds.join(translate(", ")) }) 581 583 } … … 591 593 delete template.attack['Slaughter']; 592 594 for (var type in template.attack) 593 595 { 596 if (type == "Charge") 597 continue; // Charging isn't implemented yet and shouldn't be displayed. 594 598 var attack = ""; 595 599 var attackLabel = "[font=\"sans-bold-13\"]" + getAttackTypeLabel(type) + "[/font]"; 596 600 if (type == "Ranged") … … 600 604 attackLabel: attackLabel, 601 605 damageTypes: damageTypesToText(template.attack[type]), 602 606 rangeLabel: "[font=\"sans-bold-13\"]" + translate("Range:") + "[/font]", 603 range: Math.round(template.attack[type].maxRange/4) 607 range: Math.round(template.attack[type].maxRange/4) + "[font=\"sans-10\"][color=\"orange\"] " + translate("meters") + "[/color][/font]" 604 608 }); 605 609 } 606 610 else … … 613 617 attacks.push(attack); 614 618 } 615 619 } 616 return attacks.join( "\n");620 return attacks.join(translate(", ")); 617 621 } 618 622 619 623 function getEntityNames(template) … … 808 812 warn(sprintf("Internationalization: Unexpected context for resource type localization found: ‘%(context)s’. This context is not supported.", { context: context })); 809 813 return resourceCode; // It should never get here. 810 814 } 811 } 812 No newline at end of file 815 }