Ticket #2549: tooltipOptions2.patch

File tooltipOptions2.patch, 7.2 KB (added by Mikel, 10 years ago)

Sorry fixed fully i hope

  • binaries/data/mods/public/gui/options/options.js

     
    99        [translate("Windowed Mode"), translate("Start 0 A.D. in a window"), {"config":"windowed"}, "boolean"],
    1010        [translate("Background Pause"), translate("Pause single player games when window loses focus"), {"config":"pauseonfocusloss"}, "boolean"],
    1111        [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"],
    1213        [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"],
    1314    ],
    1415    "graphicsSetting":
  • binaries/data/mods/public/gui/session/unit_commands.js

     
    514514                var [trainEntLimit, trainEntCount, canBeAddedCount, trainEntLimitChangers] =
    515515                    getEntityLimitAndCount(playerState, entType);
    516516                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("Armor:") + "[/font] " + armorTypesToText(template.armour);
     525                    if (template.speed)
     526                        tooltip += "\n" + getEntitySpeed(template);
     527                }
    518528                tooltip += "[color=\"255 251 131\"]" + formatBatchTrainingString(buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch) + "[/color]";
    519529                break;
    520530
  • binaries/data/mods/public/gui/session/utility_functions.js

     
    234234    if (dmg.hack)
    235235        dmgArray.push(sprintf(translate("%(damage)s %(damageType)s"), {
    236236            damage: dmg.hack,
    237             damageType: "[font=\"sans-12\"]" + translate("Hack") + "[/font]"
     237            damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Hack") + "[/color][/font]"
    238238        }));
    239239    if (dmg.pierce)
    240240        dmgArray.push(sprintf(translate("%(damage)s %(damageType)s"), {
    241241            damage: dmg.pierce,
    242             damageType: "[font=\"sans-12\"]" + translate("Pierce") + "[/font]"
     242            damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Pierce") + "[/color][/font]"
    243243        }));
    244244    if (dmg.crush)
    245245        dmgArray.push(sprintf(translate("%(damage)s %(damageType)s"), {
    246246            damage: dmg.crush,
    247             damageType: "[font=\"sans-12\"]" + translate("Crush") + "[/font]"
     247            damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Crush") + "[/color][/font]"
    248248        }));
    249249
    250250    return dmgArray.join("[font=\"sans-12\"]" + translate(", ") + "[/font]");
     
    260260    if (dmg.hack)
    261261        dmgArray.push(sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), {
    262262            damage: dmg.hack,
    263             damageType: "[font=\"sans-12\"]" + translate("Hack") + "[/font]",
     263            damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Hack") + "[/color][/font]",
    264264            armorPercentage: "[font=\"sans-10\"]" + sprintf(translate("(%(armorPercentage)s)"), { armorPercentage: armorLevelToPercentageString(dmg.hack) }) + "[/font]"
    265265        }));
    266266    if (dmg.pierce)
    267267        dmgArray.push(sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), {
    268268            damage: dmg.pierce,
    269             damageType: "[font=\"sans-12\"]" + translate("Pierce") + "[/font]",
     269            damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Pierce") + "[/color][/font]",
    270270            armorPercentage: "[font=\"sans-10\"]" + sprintf(translate("(%(armorPercentage)s)"), { armorPercentage: armorLevelToPercentageString(dmg.pierce) }) + "[/font]"
    271271        }));
    272272    if (dmg.crush)
    273273        dmgArray.push(sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), {
    274274            damage: dmg.crush,
    275             damageType: "[font=\"sans-12\"]" + translate("Crush") + "[/font]",
     275            damageType: "[font=\"sans-10\"][color=\"orange\"]" + translate("Crush") + "[/color][/font]",
    276276            armorPercentage: "[font=\"sans-10\"]" + sprintf(translate("(%(armorPercentage)s)"), { armorPercentage: armorLevelToPercentageString(dmg.crush) }) + "[/font]"
    277277        }));
    278278
     
    574574    {
    575575        var label = "[font=\"sans-bold-13\"]" + translate("Speed:") + "[/font]";
    576576        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]"}));
    579581
    580582        speed = sprintf(translate("%(label)s %(speeds)s"), { label: label, speeds: speeds.join(translate(", ")) })
    581583    }
     
    591593        delete template.attack['Slaughter'];
    592594        for (var type in template.attack)
    593595        {
     596            if (type == "Charge")
     597                continue; // Charging isn't implemented yet and shouldn't be displayed.
    594598            var attack = "";
    595599            var attackLabel = "[font=\"sans-bold-13\"]" + getAttackTypeLabel(type) + "[/font]";
    596600            if (type == "Ranged")
     
    600604                    attackLabel: attackLabel,
    601605                    damageTypes: damageTypesToText(template.attack[type]),
    602606                    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) + "[font=\"sans-10\"][color=\"orange\"] " + translate("meters:") + "[/color][/font]"
    604608                });
    605609            }
    606610            else
     
    613617            attacks.push(attack);
    614618        }
    615619    }
    616     return attacks.join("\n");
     620    return attacks.join(translate(", "));
    617621}
    618622
    619623function getEntityNames(template)
     
    808812        warn(sprintf("Internationalization: Unexpected context for resource type localization found: ‘%(context)s’. This context is not supported.", { context: context }));
    809813        return resourceCode; // It should never get here.
    810814    }
    811 }
    812  No newline at end of file
     815}