Răsfoiți Sursa

Paint timer color into player color

nordsoft 2 ani în urmă
părinte
comite
314a17cdd9
2 a modificat fișierele cu 10 adăugiri și 1 ștergeri
  1. 8 0
      client/adventureMap/TurnTimerWidget.cpp
  2. 2 1
      config/widgets/turnTimer.json

+ 8 - 0
client/adventureMap/TurnTimerWidget.cpp

@@ -15,6 +15,7 @@
 #include "../CPlayerInterface.h"
 
 #include "../render/EFont.h"
+#include "../render/Graphics.h"
 #include "../gui/CGuiHandler.h"
 #include "../gui/TextAlignment.h"
 #include "../widgets/Images.h"
@@ -77,6 +78,13 @@ void TurnTimerWidget::setTime(int time)
 		std::ostringstream oss;
 		oss << turnTime / 60 << ":" << std::setw(2) << std::setfill('0') << turnTime % 60;
 		w->setText(oss.str());
+		
+		if(graphics && LOCPLINT && LOCPLINT->cb
+		   && variables["textColorFromPlayerColor"].Bool()
+		   && LOCPLINT->cb->getCurrentPlayer().isValidPlayer())
+		{
+			w->setColor(graphics->playerColors[LOCPLINT->cb->getCurrentPlayer()]);
+		}
 	}
 }
 

+ 2 - 1
config/widgets/turnTimer.json

@@ -28,6 +28,7 @@
 	"variables":
 	{
 		"notificationTime": [0, 1, 2, 3, 4, 5, 20],
-		"notificationSound": "WE5"
+		"notificationSound": "WE5",
+		"textColorFromPlayerColor": true
 	}
 }