Put tooltips on a diet.

This was SVN commit r13835.
This commit is contained in:
alpha123 2013-09-13 23:49:46 +00:00
parent 04b4e6af4b
commit c28151c1c1
3 changed files with 56 additions and 78 deletions

View File

@ -191,7 +191,7 @@ function formatBatchTrainingString(buildingsCountToTrainFullBatch, fullBatchSize
batchDetailsString += ")";
}
return "\n\n[font=\"serif-bold-13\"]Shift-click[/font][font=\"serif-13\"] to train "
return "\n[font=\"serif-bold-13\"]Shift-click[/font][font=\"serif-13\"] to train "
+ totalBatchTrainingCount + batchDetailsString + ".[/font]";
}
@ -446,6 +446,9 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, playerState, items, c
case TRAINING:
var tooltip = getEntityNamesFormatted(template);
var key = g_ConfigDB.system["hotkey.session.queueunit." + (i + 1)];
if (key)
tooltip = "[color=\"255 251 131\"][font=\"serif-bold-16\"][" + key + "][/font][/color] " + tooltip;
if (template.tooltip)
tooltip += "\n[font=\"serif-13\"]" + template.tooltip + "[/font]";
@ -453,31 +456,15 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, playerState, items, c
var [buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch] =
getTrainingBatchStatus(playerState, unitEntState.id, entType, selection);
if (Engine.HotkeyIsPressed("session.batchtrain"))
{
trainNum = buildingsCountToTrainFullBatch * fullBatchSize + remainderBatch;
}
tooltip += "\n" + getEntityCostTooltip(template, trainNum, unitEntState.id);
if (template.health)
tooltip += "\n[font=\"serif-bold-13\"]Health:[/font] " + template.health;
if (template.armour)
tooltip += "\n[font=\"serif-bold-13\"]Armour:[/font] " + armorTypesToText(template.armour);
if (template.attack)
tooltip += "\n" + getEntityAttack(template);
if (template.speed)
tooltip += "\n" + getEntitySpeed(template);
tooltip += "\n" + getEntityCostTooltip(template, trainNum, unitEntState.id, "");
var [trainEntLimit, trainEntCount, canBeAddedCount] =
getEntityLimitAndCount(playerState, entType);
tooltip += formatLimitString(trainEntLimit, trainEntCount);
tooltip += formatBatchTrainingString(buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch);
var key = g_ConfigDB.system["hotkey.session.queueunit." + (i+1)];
if (key !== undefined)
{
tooltip += "\n[font=\"serif-bold-13\"]HotKey (" + key + ").[/font]";
}
tooltip += "[color=\"255 251 131\"]" + formatBatchTrainingString(buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch) + "[/color]";
break;
case RESEARCH:
@ -502,12 +489,9 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, playerState, items, c
if (template.tooltip)
tooltip += "\n[font=\"serif-13\"]" + template.tooltip + "[/font]";
tooltip += "\n" + getEntityCostTooltip(template);
tooltip += "\n" + getEntityCostTooltip(template, null, null, "");
tooltip += getPopulationBonusTooltip(template);
if (template.health)
tooltip += "\n[font=\"serif-bold-13\"]Health:[/font] " + template.health;
var [entLimit, entCount, canBeAddedCount] =
getEntityLimitAndCount(playerState, entType);
tooltip += formatLimitString(entLimit, entCount);

View File

@ -400,9 +400,12 @@ function getWallPieceTooltip(wallTypes)
/**
* Returns the cost information to display in the specified entity's construction button tooltip.
*/
function getEntityCostTooltip(template, trainNum, entity)
function getEntityCostTooltip(template, trainNum, entity, prefix)
{
var cost = "[font=\"serif-bold-13\"]Costs:[/font] ";
if (prefix == null)
prefix = "[font=\"serif-bold-13\"]Costs:[/font] ";
var cost = prefix;
// Entities with a wallset component are proxies for initiating wall placement and as such do not have a cost of
// their own; the individual wall pieces within it do.
@ -512,7 +515,10 @@ function getEntityNames(template)
function getEntityNamesFormatted(template)
{
return '[font="serif-bold-16"]' + getEntityNames(template) + "[/font]";
var names = getEntityNames(template).split(' (');
return '[font="serif-bold-16"]' + names[0][0] + '[/font]' +
'[font="serif-bold-12"]' + names[0].slice(1).toUpperCase() + '[/font]' +
'[font="serif-bold-16"] (' + names[1] + '[/font]';
}
function getEntityRankedName(entState)

View File

@ -267,18 +267,6 @@ bool CGUIString::TextChunk::Tag::SetTagType(const CStr& tagtype)
{
CStr _tagtype = tagtype.UpperCase();
if (_tagtype == CStr("B"))
{
m_TagType = TAG_B;
return true;
}
else
if (_tagtype == CStr("I"))
{
m_TagType = TAG_I;
return true;
}
else
if (_tagtype == CStr("COLOR"))
{
m_TagType = TAG_COLOR;