浏览代码

workaround for missing video

Laserlicht 2 年之前
父节点
当前提交
ca96749c45
共有 2 个文件被更改,包括 13 次插入1 次删除
  1. 10 1
      client/mainmenu/CHighScoreScreen.cpp
  2. 3 0
      client/mainmenu/CHighScoreScreen.h

+ 10 - 1
client/mainmenu/CHighScoreScreen.cpp

@@ -17,6 +17,7 @@
 #include "../widgets/TextControls.h"
 #include "../widgets/Buttons.h"
 #include "../widgets/Images.h"
+#include "../widgets/MiscWidgets.h"
 #include "../windows/InfoWindows.h"
 #include "../render/Canvas.h"
 
@@ -234,6 +235,8 @@ CHighScoreInputScreen::CHighScoreInputScreen(bool won, HighScoreCalculation calc
 	pos = center(Rect(0, 0, 800, 600));
 	updateShadow();
 
+	background = std::make_shared<TransparentFilledRectangle>(Rect(0, 0, pos.w, pos.h), Colors::BLACK);
+
 	if(won)
 	{
 		int border = 100;
@@ -321,7 +324,13 @@ void CHighScoreInputScreen::show(Canvas & to)
 
 void CHighScoreInputScreen::activate()
 {
-	CCS->videoh->open(VideoPath::builtin(video));
+	if(!CCS->videoh->open(VideoPath::builtin(video)))
+	{
+		if(!won)
+			close();
+	}
+	else
+		background = nullptr;
 	CIntObject::activate();
 }
 

+ 3 - 0
client/mainmenu/CHighScoreScreen.h

@@ -16,6 +16,8 @@ class CMultiLineLabel;
 class CAnimImage;
 class CTextInput;
 
+class TransparentFilledRectangle;
+
 class HighScoreParameter
 {
 public:
@@ -88,6 +90,7 @@ class CHighScoreInputScreen : public CWindowObject
 {
 	std::vector<std::shared_ptr<CMultiLineLabel>> texts;
 	std::shared_ptr<CHighScoreInput> input;
+	std::shared_ptr<TransparentFilledRectangle> background;
 
 	std::string video;
 	bool won;