Browse Source

Fixed texts:
- added new texts to translate.json
- implemented texts for abilities

Remaining TODO's:
- handling of stack artifact
- handling of commander artifacts
- stack experience

Ivan Savenko 11 years ago
parent
commit
e4e9d71143
4 changed files with 29 additions and 11 deletions
  1. 11 7
      client/CCreatureWindow.cpp
  2. 2 2
      client/CCreatureWindow.h
  3. 3 2
      client/gui/CIntObjectClasses.cpp
  4. 13 0
      config/translate.json

+ 11 - 7
client/CCreatureWindow.cpp

@@ -181,6 +181,10 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt)
 	morale->set(parent->info->stackNode);
 	auto luck = new MoraleLuckBox(false, genRect(42, 42, 375, 110));
 	luck->set(parent->info->stackNode);
+
+	//TODO: artifacts
+
+	//TODO: stack artifacts
 }
 
 void CStackWindow::CWindowSection::createActiveSpells()
@@ -334,6 +338,8 @@ void CStackWindow::CWindowSection::createCommanderAbilities()
 				{
 					parent->setSelection(skillID, icon);
 				};
+				icon->text = stack->bonusToString(bonus, true);
+				icon->hoverText = stack->bonusToString(bonus, false);
 				return icon;
 			}
 			if (skillID >= 100)
@@ -355,11 +361,6 @@ void CStackWindow::CWindowSection::createCommanderAbilities()
 		leftBtn->block(true);
 		rightBtn->block(true);
 	}
-
-	pos.h += bg2->pos.h;
-	/*
-	bonusItems.push_back (new CBonusItem (genRect(0, 0, 251, 57), stack->bonusToString(b, false), stack->bonusToString(b, true), stack->bonusToGraphics(b)));
-*/
 }
 
 void CStackWindow::setSelection(si32 newSkill, CClickableObject * newIcon)
@@ -463,6 +464,7 @@ void CStackWindow::CWindowSection::createButtonPanel()
 	{
 		for (size_t i=0; i<2; i++)
 		{
+			std::string btnIDs[2] = { "showSkills", "showBonuses" };
 			auto onSwitch = [&, i]()
 			{
 				parent->switchButtons[parent->activeTab]->enable();
@@ -471,7 +473,8 @@ void CStackWindow::CWindowSection::createButtonPanel()
 				parent->redraw(); // FIXME: enable/disable don't redraw screen themselves
 			};
 
-			parent->switchButtons[i] = new CAdventureMapButton(std::make_pair("",""), onSwitch, 302 + i*40, 5, "stackWindow/upgradeButton");
+			const JsonNode & text = VLC->generaltexth->localizedTexts["creatureWindow"][btnIDs[i]];
+			parent->switchButtons[i] = new CAdventureMapButton(text["label"].String(), text["help"].String(), onSwitch, 302 + i*40, 5, "stackWindow/upgradeButton");
 			parent->switchButtons[i]->addOverlay(new CAnimImage("stackWindow/switchModeIcons", i));
 		}
 		parent->switchButtons[parent->activeTab]->disable();
@@ -544,7 +547,8 @@ CIntObject * CStackWindow::switchTab(size_t index)
 			activeTab = 0;
 			auto ret = new CWindowSection(this);
 			ret->createCommander();
-			ret->createCommanderAbilities();
+			if (info->levelupInfo)
+				ret->createCommanderAbilities();
 			return ret;
 		}
 		case 1:

+ 2 - 2
client/CCreatureWindow.h

@@ -27,8 +27,8 @@ public:
 
 	std::function<void()> callback; //TODO: create more generic clickable class than AdvMapButton?
 
-	void clickLeft(tribool down, bool previousState);
-	void clickRight(tribool down, bool previousState){};
+	void clickLeft(tribool down, bool previousState) override;
+	//void clickRight(tribool down, bool previousState){};
 
 	void setObject(CIntObject * object);
 };

+ 3 - 2
client/gui/CIntObjectClasses.cpp

@@ -1147,14 +1147,15 @@ CHoverableArea::~CHoverableArea()
 
 void LRClickableAreaWText::clickLeft(tribool down, bool previousState)
 {
-	if(!down && previousState)
+	if(!down && previousState && !text.empty())
 	{
 		LOCPLINT->showInfoDialog(text);
 	}
 }
 void LRClickableAreaWText::clickRight(tribool down, bool previousState)
 {
-	adventureInt->handleRightClick(text, down);
+	if (!text.empty())
+		adventureInt->handleRightClick(text, down);
 }
 
 LRClickableAreaWText::LRClickableAreaWText()

+ 13 - 0
config/translate.json

@@ -54,5 +54,18 @@
 		"anyOf"  :  "Any of the following:",
 		"allOf"  :  "All of the following:",
 		"noneOf" : "None of the following:"
+	},
+	"creatureWindow" :
+	{
+		"showBonuses" :
+		{
+			"label" : "Switch to bonuses view",
+			"help" : "Displays all active bonuses of the commander"
+		},
+		"showSkills" :
+		{
+			"label" : "Switch to skills view",
+			"help" : "Displays all learned skills of the commander"
+		}
 	}
 }