|
@@ -123,7 +123,7 @@ void CSelectionBase::toggleTab(std::shared_ptr<CIntObject> tab)
|
|
|
}
|
|
|
|
|
|
InfoCard::InfoCard()
|
|
|
- : showChat(true)
|
|
|
+ : chatMode(ChatMode::Enabled)
|
|
|
{
|
|
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
|
|
setRedrawParent(true);
|
|
@@ -137,6 +137,7 @@ InfoCard::InfoCard()
|
|
|
mapDescription = std::make_shared<CTextBox>("", descriptionRect, 1);
|
|
|
playerListBg = std::make_shared<CPicture>(ImagePath::builtin("CHATPLUG.bmp"), 16, 276);
|
|
|
chat = std::make_shared<CChatBox>(Rect(18, 126, 335, 143));
|
|
|
+ pvpBox = std::make_shared<PvPBox>(Rect(18, 126, 335, 262));
|
|
|
|
|
|
buttonInvitePlayers = std::make_shared<CButton>(Point(20, 365), AnimationPath::builtin("pregameInvitePlayers"), CGI->generaltexth->zelp[105], [](){ CSH->getGlobalLobby().activateRoomInviteInterface(); } );
|
|
|
buttonOpenGlobalLobby = std::make_shared<CButton>(Point(188, 365), AnimationPath::builtin("pregameReturnToLobby"), CGI->generaltexth->zelp[105], [](){ CSH->getGlobalLobby().activateInterface(); });
|
|
@@ -193,9 +194,9 @@ InfoCard::InfoCard()
|
|
|
labelGroupPlayers = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
|
|
|
disableLabelRedraws();
|
|
|
}
|
|
|
- setChat(false);
|
|
|
+ setChat(ChatMode::Disabled);
|
|
|
if (CSH->inLobbyRoom())
|
|
|
- setChat(true); // FIXME: less ugly version?
|
|
|
+ setChat(ChatMode::Enabled); // FIXME: less ugly version?
|
|
|
}
|
|
|
|
|
|
void InfoCard::disableLabelRedraws()
|
|
@@ -249,7 +250,7 @@ void InfoCard::changeSelection()
|
|
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
|
|
// FIXME: We recreate them each time because CLabelGroup don't use smart pointers
|
|
|
labelGroupPlayers = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
|
|
|
- if(!showChat)
|
|
|
+ if(chatMode != ChatMode::Enabled)
|
|
|
labelGroupPlayers->disable();
|
|
|
|
|
|
for(const auto & p : CSH->playerNames)
|
|
@@ -266,18 +267,14 @@ void InfoCard::changeSelection()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void InfoCard::toggleChat()
|
|
|
+void InfoCard::setChat(ChatMode setMode)
|
|
|
{
|
|
|
- setChat(!showChat);
|
|
|
-}
|
|
|
-
|
|
|
-void InfoCard::setChat(bool activateChat)
|
|
|
-{
|
|
|
- if(showChat == activateChat)
|
|
|
+ if(chatMode == setMode)
|
|
|
return;
|
|
|
|
|
|
- if(activateChat)
|
|
|
+ switch(setMode)
|
|
|
{
|
|
|
+ case InfoCard::ChatMode::Enabled:
|
|
|
if(SEL->screenType == ESelectionScreen::campaignList)
|
|
|
{
|
|
|
labelCampaignDescription->disable();
|
|
@@ -300,14 +297,15 @@ void InfoCard::setChat(bool activateChat)
|
|
|
}
|
|
|
mapDescription->disable();
|
|
|
chat->enable();
|
|
|
+ pvpBox->disable();
|
|
|
playerListBg->enable();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ break;
|
|
|
+ case InfoCard::ChatMode::Disabled:
|
|
|
buttonInvitePlayers->disable();
|
|
|
buttonOpenGlobalLobby->disable();
|
|
|
mapDescription->enable();
|
|
|
chat->disable();
|
|
|
+ pvpBox->disable();
|
|
|
playerListBg->disable();
|
|
|
|
|
|
if(SEL->screenType == ESelectionScreen::campaignList)
|
|
@@ -325,9 +323,34 @@ void InfoCard::setChat(bool activateChat)
|
|
|
labelLossConditionText->enable();
|
|
|
labelGroupPlayers->disable();
|
|
|
}
|
|
|
+ break;
|
|
|
+ case InfoCard::ChatMode::PvP:
|
|
|
+ buttonInvitePlayers->disable();
|
|
|
+ buttonOpenGlobalLobby->disable();
|
|
|
+ mapDescription->disable();
|
|
|
+ chat->disable();
|
|
|
+ pvpBox->enable();
|
|
|
+ playerListBg->enable();
|
|
|
+
|
|
|
+ if(SEL->screenType == ESelectionScreen::campaignList)
|
|
|
+ {
|
|
|
+ labelCampaignDescription->disable();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ labelScenarioDescription->disable();
|
|
|
+ labelVictoryCondition->disable();
|
|
|
+ labelLossCondition->disable();
|
|
|
+ iconsVictoryCondition->disable();
|
|
|
+ iconsLossCondition->disable();
|
|
|
+ labelVictoryConditionText->disable();
|
|
|
+ labelLossConditionText->disable();
|
|
|
+ labelGroupPlayers->disable();
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
- showChat = activateChat;
|
|
|
+ chatMode = setMode;
|
|
|
GH.windows().totalRedraw();
|
|
|
}
|
|
|
|
|
@@ -373,6 +396,16 @@ void CChatBox::addNewMessage(const std::string & text)
|
|
|
chatHistory->slider->scrollToMax();
|
|
|
}
|
|
|
|
|
|
+PvPBox::PvPBox(const Rect & rect)
|
|
|
+{
|
|
|
+ OBJ_CONSTRUCTION;
|
|
|
+ pos += rect.topLeft();
|
|
|
+ setRedrawParent(true);
|
|
|
+
|
|
|
+ buttonFlipCoin = std::make_shared<CButton>(Point(17, 160), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("flip coin"), [](){ std::cout << "coin flip"; }, EShortcut::NONE);
|
|
|
+ buttonFlipCoin->setTextOverlay("Flip coin2", EFonts::FONT_SMALL, Colors::WHITE);
|
|
|
+}
|
|
|
+
|
|
|
CFlagBox::CFlagBox(const Rect & rect)
|
|
|
: CIntObject(SHOW_POPUP)
|
|
|
{
|