1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

adjust select descriptions

This commit is contained in:
Laserlicht
2025-11-08 21:23:12 +01:00
parent 1a3e3d1d9e
commit 7d09289e5b
4 changed files with 66 additions and 7 deletions

View File

@@ -146,7 +146,24 @@
"vcmi.lobby.battleOnlyModeCreatureSelect" : "Select Creature", "vcmi.lobby.battleOnlyModeCreatureSelect" : "Select Creature",
"vcmi.lobby.battleOnlyModeSecSkillSelect" : "Select Secondary Skill", "vcmi.lobby.battleOnlyModeSecSkillSelect" : "Select Secondary Skill",
"vcmi.lobby.battleOnlyModeArtifactSelect" : "Select Artifact", "vcmi.lobby.battleOnlyModeArtifactSelect" : "Select Artifact",
"vcmi.lobby.battleOnlyModeSelect" : "Select", "vcmi.lobby.battleOnlyModeSelectHero" : "Select\nHero",
"vcmi.lobby.battleOnlyModeSelectUnit" : "Unit\n%d",
"vcmi.lobby.battleOnlyModeSelectSkill" : "Skill\n%d",
"vcmi.lobby.battleOnlyModeSelectArtifact" : "Art.\n%s",
"vcmi.lobby.battleOnlyModeSelectArtifact.0" : "Head",
"vcmi.lobby.battleOnlyModeSelectArtifact.1" : "Should.",
"vcmi.lobby.battleOnlyModeSelectArtifact.2" : "Neck",
"vcmi.lobby.battleOnlyModeSelectArtifact.3" : "R.Hand",
"vcmi.lobby.battleOnlyModeSelectArtifact.4" : "L.Hand",
"vcmi.lobby.battleOnlyModeSelectArtifact.5" : "Torso",
"vcmi.lobby.battleOnlyModeSelectArtifact.6" : "R.Ring",
"vcmi.lobby.battleOnlyModeSelectArtifact.7" : "L.Ring",
"vcmi.lobby.battleOnlyModeSelectArtifact.8" : "Feet",
"vcmi.lobby.battleOnlyModeSelectArtifact.9" : "Misc 1",
"vcmi.lobby.battleOnlyModeSelectArtifact.10" : "Misc 2",
"vcmi.lobby.battleOnlyModeSelectArtifact.11" : "Misc 3",
"vcmi.lobby.battleOnlyModeSelectArtifact.12" : "Misc 4",
"vcmi.lobby.battleOnlyModeSelectArtifact.18" : "Misc 5",
"vcmi.lobby.battleOnlyModeReset" : "Reset", "vcmi.lobby.battleOnlyModeReset" : "Reset",
"vcmi.lobby.templatesSelect.hover" : "Templates", "vcmi.lobby.templatesSelect.hover" : "Templates",
"vcmi.lobby.templatesSelect.help" : "Search and select template", "vcmi.lobby.templatesSelect.help" : "Search and select template",

View File

@@ -146,7 +146,24 @@
"vcmi.lobby.battleOnlyModeCreatureSelect" : "Kreatur auswählen", "vcmi.lobby.battleOnlyModeCreatureSelect" : "Kreatur auswählen",
"vcmi.lobby.battleOnlyModeSecSkillSelect" : "Sekundären Skill auswählen", "vcmi.lobby.battleOnlyModeSecSkillSelect" : "Sekundären Skill auswählen",
"vcmi.lobby.battleOnlyModeArtifactSelect" : "Artifakt auswählen", "vcmi.lobby.battleOnlyModeArtifactSelect" : "Artifakt auswählen",
"vcmi.lobby.battleOnlyModeSelect" : "Wählen", "vcmi.lobby.battleOnlyModeSelectHero" : "Wähle\nHelden",
"vcmi.lobby.battleOnlyModeSelectUnit" : "Einh.\n%d",
"vcmi.lobby.battleOnlyModeSelectSkill" : "Skill\n%d",
"vcmi.lobby.battleOnlyModeSelectArtifact" : "Art.\n%s",
"vcmi.lobby.battleOnlyModeSelectArtifact.0" : "Kopf",
"vcmi.lobby.battleOnlyModeSelectArtifact.1" : "Schult.",
"vcmi.lobby.battleOnlyModeSelectArtifact.2" : "Nacken",
"vcmi.lobby.battleOnlyModeSelectArtifact.3" : "R.Hand",
"vcmi.lobby.battleOnlyModeSelectArtifact.4" : "L.Hand",
"vcmi.lobby.battleOnlyModeSelectArtifact.5" : "Torso",
"vcmi.lobby.battleOnlyModeSelectArtifact.6" : "R.Ring",
"vcmi.lobby.battleOnlyModeSelectArtifact.7" : "L.Ring",
"vcmi.lobby.battleOnlyModeSelectArtifact.8" : "Fuß",
"vcmi.lobby.battleOnlyModeSelectArtifact.9" : "Misc 1",
"vcmi.lobby.battleOnlyModeSelectArtifact.10" : "Misc 2",
"vcmi.lobby.battleOnlyModeSelectArtifact.11" : "Misc 3",
"vcmi.lobby.battleOnlyModeSelectArtifact.12" : "Misc 4",
"vcmi.lobby.battleOnlyModeSelectArtifact.18" : "Misc 5",
"vcmi.lobby.battleOnlyModeReset" : "Zurücksetzen", "vcmi.lobby.battleOnlyModeReset" : "Zurücksetzen",
"vcmi.lobby.templatesSelect.hover" : "Templates", "vcmi.lobby.templatesSelect.hover" : "Templates",
"vcmi.lobby.templatesSelect.help" : "Suche und wähle Template aus", "vcmi.lobby.templatesSelect.help" : "Suche und wähle Template aus",

View File

@@ -20,6 +20,7 @@
#include "../render/CAnimation.h" #include "../render/CAnimation.h"
#include "../render/Canvas.h" #include "../render/Canvas.h"
#include "../render/CanvasImage.h" #include "../render/CanvasImage.h"
#include "../render/IFont.h"
#include "../gui/Shortcut.h" #include "../gui/Shortcut.h"
#include "../gui/WindowHandler.h" #include "../gui/WindowHandler.h"
#include "../widgets/Buttons.h" #include "../widgets/Buttons.h"
@@ -66,6 +67,8 @@
BattleOnlyModeTab::BattleOnlyModeTab() BattleOnlyModeTab::BattleOnlyModeTab()
: startInfo(std::make_shared<BattleOnlyModeStartInfo>()) : startInfo(std::make_shared<BattleOnlyModeStartInfo>())
, disabledColor(GAME->server().isHost() ? Colors::WHITE : Colors::ORANGE) , disabledColor(GAME->server().isHost() ? Colors::WHITE : Colors::ORANGE)
, boxColor(ColorRGBA(128, 128, 128))
, disabledBoxColor(GAME->server().isHost() ? boxColor : ColorRGBA(116, 92, 16))
{ {
OBJECT_CONSTRUCTION; OBJECT_CONSTRUCTION;
@@ -223,7 +226,16 @@ std::shared_ptr<IImage> drawBlackBox(Point size, std::string text, ColorRGBA col
auto image = ENGINE->renderHandler().createImage(size, CanvasScalingPolicy::AUTO); auto image = ENGINE->renderHandler().createImage(size, CanvasScalingPolicy::AUTO);
Canvas canvas = image->getCanvas(); Canvas canvas = image->getCanvas();
canvas.drawColor(Rect(0, 0, size.x, size.y), Colors::BLACK); canvas.drawColor(Rect(0, 0, size.x, size.y), Colors::BLACK);
canvas.drawText(Point(size.x / 2, size.y / 2), FONT_TINY, color, ETextAlignment::CENTER, text);
std::vector<std::string> lines;
boost::split(lines, text, boost::is_any_of("\n"));
int lineH = ENGINE->renderHandler().loadFont(FONT_TINY)->getLineHeight();
int totalH = lines.size() * lineH;
int startY = (size.y - totalH) / 2 + lineH / 2;
for (size_t i = 0; i < lines.size(); ++i)
canvas.drawText(Point(size.x / 2, startY + i * lineH), FONT_TINY, color, ETextAlignment::CENTER, lines[i]);
return image; return image;
} }
@@ -330,7 +342,7 @@ void BattleOnlyModeHeroSelector::setHeroIcon()
if(!parent.startInfo->selectedHero[id]) if(!parent.startInfo->selectedHero[id])
{ {
heroImage = std::make_shared<CPicture>(drawBlackBox(Point(58, 64), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelect"), id == 1 ? Colors::WHITE : parent.disabledColor), Point(6, 7)); heroImage = std::make_shared<CPicture>(drawBlackBox(Point(58, 64), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelectHero"), id == 1 ? parent.boxColor : parent.disabledBoxColor), Point(6, 7));
heroLabel = std::make_shared<CLabel>(160, 16, FONT_SMALL, ETextAlignment::CENTER, id == 1 ? Colors::WHITE : parent.disabledColor, LIBRARY->generaltexth->translate("core.genrltxt.507")); heroLabel = std::make_shared<CLabel>(160, 16, FONT_SMALL, ETextAlignment::CENTER, id == 1 ? Colors::WHITE : parent.disabledColor, LIBRARY->generaltexth->translate("core.genrltxt.507"));
for(size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++) for(size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++)
primSkillsInput[i]->setText("0"); primSkillsInput[i]->setText("0");
@@ -414,7 +426,10 @@ void BattleOnlyModeHeroSelector::setCreatureIcons()
{ {
if(parent.startInfo->selectedArmy[id][i].getId() == CreatureID::NONE) if(parent.startInfo->selectedArmy[id][i].getId() == CreatureID::NONE)
{ {
creatureImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelect"), id == 1 ? Colors::WHITE : parent.disabledColor), Point(6 + i * 36, 78)); MetaString str;
str.appendTextID("vcmi.lobby.battleOnlyModeSelectUnit");
str.replaceNumber(i + 1);
creatureImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), str.toString(), id == 1 ? parent.boxColor : parent.disabledBoxColor), Point(6 + i * 36, 78));
selectedArmyInput[i]->disable(); selectedArmyInput[i]->disable();
} }
else else
@@ -502,7 +517,10 @@ void BattleOnlyModeHeroSelector::setSecSkillIcons()
auto skillInfo = parent.startInfo->secSkillLevel[id][i]; auto skillInfo = parent.startInfo->secSkillLevel[id][i];
if(skillInfo.second == MasteryLevel::NONE) if(skillInfo.second == MasteryLevel::NONE)
{ {
secSkillImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelect"), id == 1 ? Colors::WHITE : parent.disabledColor), imgPos); MetaString str;
str.appendTextID("vcmi.lobby.battleOnlyModeSelectSkill");
str.replaceNumber(i + 1);
secSkillImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), str.toString(), id == 1 ? parent.boxColor : parent.disabledBoxColor), imgPos);
selectedSecSkillInput[i]->disable(); selectedSecSkillInput[i]->disable();
} }
else else
@@ -606,7 +624,12 @@ void BattleOnlyModeHeroSelector::setArtifactIcons()
Point imgPos(6 + xPos * 36, 137 + yPos * 36); Point imgPos(6 + xPos * 36, 137 + yPos * 36);
auto artifactId = parent.startInfo->artifacts[id][artPos[i]]; auto artifactId = parent.startInfo->artifacts[id][artPos[i]];
if(artifactId == ArtifactID::NONE) if(artifactId == ArtifactID::NONE)
artifactImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelect"), id == 1 ? Colors::WHITE : parent.disabledColor), imgPos); {
MetaString str;
str.appendTextID("vcmi.lobby.battleOnlyModeSelectArtifact");
str.replaceTextID("vcmi.lobby.battleOnlyModeSelectArtifact." + std::to_string(artPos[i]));
artifactImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), str.toString(), id == 1 ? parent.boxColor : parent.disabledBoxColor), imgPos);
}
else else
{ {
auto image = ENGINE->renderHandler().loadImage(AnimationPath::builtin("Artifact"), artifactId.toArtifact()->getIconIndex(), 0, EImageBlitMode::OPAQUE); auto image = ENGINE->renderHandler().loadImage(AnimationPath::builtin("Artifact"), artifactId.toArtifact()->getIconIndex(), 0, EImageBlitMode::OPAQUE);

View File

@@ -85,6 +85,8 @@ private:
std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector2; std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector2;
ColorRGBA disabledColor; ColorRGBA disabledColor;
ColorRGBA boxColor;
ColorRGBA disabledBoxColor;
void init(); void init();
void onChange(); void onChange();