浏览代码

small fix

Laserlicht 1 年之前
父节点
当前提交
f0435d8b8e
共有 3 个文件被更改,包括 14 次插入3 次删除
  1. 3 1
      client/battle/BattleInterfaceClasses.cpp
  2. 2 0
      client/battle/BattleInterfaceClasses.h
  3. 9 2
      client/battle/BattleWindow.cpp

+ 3 - 1
client/battle/BattleInterfaceClasses.cpp

@@ -44,6 +44,7 @@
 #include "../render/CAnimation.h"
 #include "../render/IRenderHandler.h"
 #include "../adventureMap/CInGameConsole.h"
+#include "../eventsSDL/InputHandler.h"
 
 #include "../../CCallback.h"
 #include "../../lib/CStack.h"
@@ -470,6 +471,7 @@ void QuickSpellPanel::create()
 		});
 		button->setOverlay(std::make_shared<CAnimImage>(AnimationPath::builtin("spellint"), !spellIdentifier.empty() ? id.num + 1 : 0));
 		button->addPopupCallback([this, i, hero](){
+			GH.input().hapticFeedback();
 			GH.windows().createAndPushWindow<CSpellWindow>(hero, owner.curInt.get(), true, [this, i](SpellID spell){
 				Settings configID = persistentStorage.write["quickSpell"][std::to_string(i)];
 				configID->String() = spell.toSpell()->identifier;
@@ -479,7 +481,7 @@ void QuickSpellPanel::create()
 
 		if(!id.hasValue() || !id.toSpell()->canBeCast(owner.getBattle().get(), spells::Mode::HERO, hero))
 		{
-			buttonsDisabled.push_back(std::make_shared<TransparentFilledRectangle>(Rect(2, 5 + 37 * i, 48, 36), ColorRGBA(0, 0, 0, 172)));
+			buttonsDisabled.push_back(std::make_shared<TransparentFilledRectangle>(Rect(2, 5 + 37 * i, 48, 36), ColorRGBA(0, 0, 0, 128)));
 		}
 		labels.push_back(std::make_shared<CLabel>(7, 8 + 37 * i, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, config["keyboard"]["battleSpellShortcut" + std::to_string(i)].String()));
 

+ 2 - 0
client/battle/BattleInterfaceClasses.h

@@ -160,6 +160,8 @@ private:
 
 	BattleInterface & owner;
 public:
+	bool isEnabled; // isActive() is not working on multiple conditions, because of this we need a seperate flag
+
 	QuickSpellPanel(BattleInterface & owner);
 
 	void create();

+ 9 - 2
client/battle/BattleWindow.cpp

@@ -226,6 +226,7 @@ void BattleWindow::hideStickyQuickSpellWindow()
 	showStickyQuickSpellWindow->Bool() = false;
 
 	quickSpellWindow->disable();
+	quickSpellWindow->isEnabled = false;
 
 	setPositionInfoWindow();
 	createTimerInfoWindows();
@@ -238,9 +239,15 @@ void BattleWindow::showStickyQuickSpellWindow()
 	showStickyQuickSpellWindow->Bool() = true;
 
 	if(GH.screenDimensions().x >= 1050)
+	{
 		quickSpellWindow->enable();
+		quickSpellWindow->isEnabled = true;
+	}
 	else
+	{
 		quickSpellWindow->disable();
+		quickSpellWindow->isEnabled = false;
+	}
 
 	setPositionInfoWindow();
 	createTimerInfoWindows();
@@ -251,7 +258,7 @@ void BattleWindow::createTimerInfoWindows()
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
 
-	int xOffsetAttacker = quickSpellWindow->isActive() ? -53 : 0;
+	int xOffsetAttacker = quickSpellWindow->isEnabled ? -53 : 0;
 
 	if(LOCPLINT->cb->getStartInfo()->turnTimerInfo.battleTimer != 0 || LOCPLINT->cb->getStartInfo()->turnTimerInfo.unitTimer != 0)
 	{
@@ -373,7 +380,7 @@ void BattleWindow::updateQueue()
 
 void BattleWindow::setPositionInfoWindow()
 {
-	int xOffsetAttacker = quickSpellWindow->isActive() ? -53 : 0;
+	int xOffsetAttacker = quickSpellWindow->isEnabled ? -53 : 0;
 	if(defenderHeroWindow)
 	{
 		Point position = (GH.screenDimensions().x >= 1000)