1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-18 03:21:27 +02:00

improve ui

This commit is contained in:
Laserlicht 2024-09-30 18:15:13 +02:00
parent e2b49bbf79
commit 31f87cb6ed
3 changed files with 11 additions and 6 deletions

View File

@ -59,9 +59,9 @@
"vcmi.spellBook.search" : "search...",
"vcmi.spellResearch.canNotAfford" : "You can't afford to research a spell.",
"vcmi.spellResearch.canNotAfford" : "You can't afford to replace {%SPELL1} with {%SPELL2}. But you can still discard this spell and continue spell research.",
"vcmi.spellResearch.comeAgain" : "Research has already been done today. Come back tomorrow.",
"vcmi.spellResearch.pay" : "Would you like to research this new spell and replace the old one or skip this spell?",
"vcmi.spellResearch.pay" : "Would you like to replace {%SPELL1} with {%SPELL2}? Or discard this spell and continue spell research?",
"vcmi.spellResearch.research" : "Research this Spell",
"vcmi.spellResearch.skip" : "Skip this Spell",
"vcmi.spellResearch.abort" : "Abort",

View File

@ -58,9 +58,9 @@
"vcmi.spellBook.search" : "suchen...",
"vcmi.spellResearch.canNotAfford" : "Ihr könnt es Euch nicht leisten, einen Zauberspruch zu erforschen.",
"vcmi.spellResearch.canNotAfford" : "Ihr könnt es Euch nicht leisten, {%SPELL1} durch {%SPELL2} zu ersetzen. Aber Ihr könnt diesen Zauberspruch trotzdem verwerfen und die Zauberspruchforschung fortsetzen.",
"vcmi.spellResearch.comeAgain" : "Die Forschung wurde heute bereits abgeschlossen. Kommt morgen wieder.",
"vcmi.spellResearch.pay" : "Möchtet Ihr diesen neuen Zauberspruch erforschen und den alten ersetzen oder diesen überspringen?",
"vcmi.spellResearch.pay" : "Möchtet Ihr {%SPELL1} durch {%SPELL2} ersetzen? Oder diesen Zauberspruch verwerfen und die Zauberspruchforschung fortsetzen?",
"vcmi.spellResearch.research" : "Erforsche diesen Zauberspruch",
"vcmi.spellResearch.skip" : "Überspringe diesen Zauberspruch",
"vcmi.spellResearch.abort" : "Abbruch",

View File

@ -2053,19 +2053,24 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition)
auto cost = costBase * std::pow(town->spellResearchCounter + 1, costExponent);
std::vector<std::shared_ptr<CComponent>> resComps;
resComps.push_back(std::make_shared<CComponent>(ComponentType::SPELL, town->spells[level].at(town->spellsAtLevel(level, false))));
auto newSpell = town->spells[level].at(town->spellsAtLevel(level, false));
resComps.push_back(std::make_shared<CComponent>(ComponentType::SPELL, spell->id));
resComps.push_back(std::make_shared<CComponent>(ComponentType::SPELL, newSpell));
resComps.back()->newLine = true;
for(TResources::nziterator i(cost); i.valid(); i++)
{
resComps.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, i->resType, i->resVal, CComponent::ESize::medium));
}
auto showSpellResearchDialog = [this, resComps, town, cost](){
auto showSpellResearchDialog = [this, resComps, town, cost, newSpell](){
std::vector<std::pair<AnimationPath, CFunctionList<void()>>> pom;
pom.emplace_back(AnimationPath::builtin("ibuy30.DEF"), nullptr);
pom.emplace_back(AnimationPath::builtin("hsbtns4.DEF"), nullptr);
pom.emplace_back(AnimationPath::builtin("ICANCEL.DEF"), nullptr);
auto text = CGI->generaltexth->translate(LOCPLINT->cb->getResourceAmount().canAfford(cost) ? "vcmi.spellResearch.pay" : "vcmi.spellResearch.canNotAfford");
boost::replace_first(text, "%SPELL1", spell->id.toSpell()->getNameTranslated());
boost::replace_first(text, "%SPELL2", newSpell.toSpell()->getNameTranslated());
auto temp = std::make_shared<CInfoWindow>(text, LOCPLINT->playerID, resComps, pom);
temp->buttons[0]->addCallback([this, town](){ LOCPLINT->cb->spellResearch(town, spell->id, true); });