Ver Fonte

better UI

Laserlicht há 1 ano atrás
pai
commit
afb90c076d

+ 1 - 1
Mods/vcmi/config/vcmi/english.json

@@ -61,7 +61,7 @@
 
 	"vcmi.spellResearch.canNotAfford" : "You can't afford to research a spell.",
 	"vcmi.spellResearch.comeAgain" : "Research has already been done today. Come back tomorrow.",
-	"vcmi.spellResearch.pay" : "Would you like to research a new spell and replace this?",
+	"vcmi.spellResearch.pay" : "Would you like to research this new spell and replace the old one?",
 
 	"vcmi.mainMenu.serverConnecting" : "Connecting...",
 	"vcmi.mainMenu.serverAddressEnter" : "Enter address:",

+ 1 - 1
Mods/vcmi/config/vcmi/german.json

@@ -60,7 +60,7 @@
 
 	"vcmi.spellResearch.canNotAfford" : "Ihr könnt es Euch nicht leisten, einen Zauberspruch zu erforschen.",
 	"vcmi.spellResearch.comeAgain" : "Die Forschung wurde heute bereits abgeschlossen. Kommt morgen wieder.",
-	"vcmi.spellResearch.pay" : "Möchtet Ihr einen neuen Zauberspruch erforschen und diesen ersetzen?",
+	"vcmi.spellResearch.pay" : "Möchtet Ihr diesen neuen Zauberspruch erforschen und den alten ersetzen?",
 
 	"vcmi.mainMenu.serverConnecting" : "Verbinde...",
 	"vcmi.mainMenu.serverAddressEnter" : "Addresse eingeben:",

+ 3 - 1
client/widgets/CComponent.cpp

@@ -70,6 +70,7 @@ void CComponent::init(ComponentType Type, ComponentSubType Subtype, std::optiona
 	customSubtitle = ValText;
 	size = imageSize;
 	font = fnt;
+	newLine = false;
 
 	assert(size < sizeInvalid);
 
@@ -471,7 +472,8 @@ void CComponentBox::placeComponents(bool selectable)
 
 		//start next row
 		if ((pos.w != 0 && rows.back().width + comp->pos.w + distance > pos.w) // row is full
-			|| rows.back().comps >= componentsInRow)
+			|| rows.back().comps >= componentsInRow
+			|| (prevComp && prevComp->newLine))
 		{
 			prevComp = nullptr;
 			rows.push_back (RowData (0,0,0));

+ 1 - 0
client/widgets/CComponent.h

@@ -52,6 +52,7 @@ public:
 	std::string customSubtitle;
 	ESize size; //component size.
 	EFonts font; //Font size of label
+	bool newLine; //Line break after component
 
 	std::string getDescription() const;
 	std::string getSubtitle() const;

+ 3 - 1
client/windows/CCastleInterface.cpp

@@ -2053,9 +2053,11 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition)
 		cost[EGameResID::GEMS] = (level + 1) * 2;
 
 		std::vector<std::shared_ptr<CComponent>> resComps;
+		resComps.push_back(std::make_shared<CComponent>(ComponentType::SPELL_SCROLL, town->spells[level].at(town->spellsAtLevel(level, false))));
+		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));
+			resComps.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, i->resType, i->resVal, CComponent::ESize::medium));
 		}
 
 		if(LOCPLINT->cb->getResourceAmount().canAfford(cost))

+ 1 - 0
test/mock/mock_IGameCallback.h

@@ -44,6 +44,7 @@ public:
 	void showInfoDialog(InfoWindow * iw) override {}
 
 	void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override {}
+	void setTownSpells(const CGTownInstance * town, int level, const std::vector<SpellID> spells) override {}
 	bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;}
 	void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {}
 	void setOwner(const CGObjectInstance * objid, PlayerColor owner) override {}