1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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().popWindows(1);
} }
GH.windows().createAndPushWindow<CLobbyScreen>(handler.screenType); GH.windows().createAndPushWindow<CLobbyScreen>(handler.screenType, handler.campaignStateToSend && !handler.campaignStateToSend->campaignSet.empty());
} }
handler.setState(EClientState::LOBBY); handler.setState(EClientState::LOBBY);
} }

View File

@@ -21,6 +21,7 @@
#include "../gui/CGuiHandler.h" #include "../gui/CGuiHandler.h"
#include "../gui/Shortcut.h" #include "../gui/Shortcut.h"
#include "../widgets/Buttons.h" #include "../widgets/Buttons.h"
#include "../widgets/GraphicalPrimitiveCanvas.h"
#include "../windows/InfoWindows.h" #include "../windows/InfoWindows.h"
#include "../render/Colors.h" #include "../render/Colors.h"
#include "../globalLobby/GlobalLobbyClient.h" #include "../globalLobby/GlobalLobbyClient.h"
@@ -35,7 +36,7 @@
#include "../../lib/rmg/CMapGenOptions.h" #include "../../lib/rmg/CMapGenOptions.h"
#include "../CGameInfo.h" #include "../CGameInfo.h"
CLobbyScreen::CLobbyScreen(ESelectionScreen screenType) CLobbyScreen::CLobbyScreen(ESelectionScreen screenType, bool fromCampaignSet)
: CSelectionBase(screenType), bonusSel(nullptr) : CSelectionBase(screenType), bonusSel(nullptr)
{ {
OBJECT_CONSTRUCTION; OBJECT_CONSTRUCTION;
@@ -114,6 +115,12 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
if (wasInLobbyRoom) if (wasInLobbyRoom)
CSH->getGlobalLobby().activateInterface(); CSH->getGlobalLobby().activateInterface();
}, EShortcut::GLOBAL_CANCEL); }, 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() CLobbyScreen::~CLobbyScreen()

View File

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