1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

campaign list workaround

This commit is contained in:
Laserlicht
2024-12-27 21:22:45 +01:00
parent 50d3e71468
commit 7dba34c16e
3 changed files with 12 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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()

View File

@@ -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();