Browse Source

campaign list workaround

Laserlicht 9 months ago
parent
commit
7dba34c16e
3 changed files with 12 additions and 3 deletions
  1. 1 1
      client/NetPacksLobbyClient.cpp
  2. 8 1
      client/lobby/CLobbyScreen.cpp
  3. 3 1
      client/lobby/CLobbyScreen.h

+ 1 - 1
client/NetPacksLobbyClient.cpp

@@ -78,7 +78,7 @@ void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientCon
 				GH.windows().popWindows(1);
 			}
 
-			GH.windows().createAndPushWindow<CLobbyScreen>(handler.screenType);
+			GH.windows().createAndPushWindow<CLobbyScreen>(handler.screenType, handler.campaignStateToSend && !handler.campaignStateToSend->campaignSet.empty());
 		}
 		handler.setState(EClientState::LOBBY);
 	}

+ 8 - 1
client/lobby/CLobbyScreen.cpp

@@ -21,6 +21,7 @@
 #include "../gui/CGuiHandler.h"
 #include "../gui/Shortcut.h"
 #include "../widgets/Buttons.h"
+#include "../widgets/GraphicalPrimitiveCanvas.h"
 #include "../windows/InfoWindows.h"
 #include "../render/Colors.h"
 #include "../globalLobby/GlobalLobbyClient.h"
@@ -35,7 +36,7 @@
 #include "../../lib/rmg/CMapGenOptions.h"
 #include "../CGameInfo.h"
 
-CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
+CLobbyScreen::CLobbyScreen(ESelectionScreen screenType, bool fromCampaignSet)
 	: CSelectionBase(screenType), bonusSel(nullptr)
 {
 	OBJECT_CONSTRUCTION;
@@ -114,6 +115,12 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
 		if (wasInLobbyRoom)
 			CSH->getGlobalLobby().activateInterface();
 	}, EShortcut::GLOBAL_CANCEL);
+
+	if(fromCampaignSet) // workaround to avoid confusing players by custom campaign list displaying for a few ms -> instead of this draw a black screen while "loading"
+	{
+		blackScreen = std::make_shared<GraphicalPrimitiveCanvas>(Rect(Point(0, 0), pos.dimensions()));
+		blackScreen->addBox(Point(0, 0), pos.dimensions(), Colors::BLACK);
+	}
 }
 
 CLobbyScreen::~CLobbyScreen()

+ 3 - 1
client/lobby/CLobbyScreen.h

@@ -12,13 +12,15 @@
 #include "CSelectionBase.h"
 
 class CBonusSelection;
+class GraphicalPrimitiveCanvas;
 
 class CLobbyScreen final : public CSelectionBase
 {
 public:
 	std::shared_ptr<CButton> buttonChat;
+	std::shared_ptr<GraphicalPrimitiveCanvas> blackScreen;
 
-	CLobbyScreen(ESelectionScreen type);
+	CLobbyScreen(ESelectionScreen type, bool fromCampaignSet = false);
 	~CLobbyScreen();
 	void toggleTab(std::shared_ptr<CIntObject> tab) final;
 	void startCampaign();