mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
changed layout
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
#include "PlayerLocalState.h"
|
#include "PlayerLocalState.h"
|
||||||
#include "globalLobby/GlobalLobbyClient.h"
|
#include "globalLobby/GlobalLobbyClient.h"
|
||||||
#include "lobby/CLobbyScreen.h"
|
#include "lobby/CLobbyScreen.h"
|
||||||
#include "lobby/CSelectionBase.h"
|
|
||||||
|
|
||||||
#include "adventureMap/CInGameConsole.h"
|
#include "adventureMap/CInGameConsole.h"
|
||||||
|
|
||||||
@@ -74,12 +73,9 @@ void GameChatHandler::onNewLobbyMessageReceived(const std::string & senderName,
|
|||||||
formatted.replaceRawString(messageText);
|
formatted.replaceRawString(messageText);
|
||||||
|
|
||||||
lobby->card->chat->addNewMessage(formatted.toString());
|
lobby->card->chat->addNewMessage(formatted.toString());
|
||||||
if (lobby->card->chatMode != InfoCard::ChatMode::Enabled)
|
if (!lobby->card->showChat)
|
||||||
{
|
|
||||||
lobby->card->setChat(InfoCard::ChatMode::Disabled);
|
|
||||||
lobby->toggleChat();
|
lobby->toggleChat();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
chatHistory.push_back({senderName, messageText, TextOperations::getCurrentFormattedTimeLocal()});
|
chatHistory.push_back({senderName, messageText, TextOperations::getCurrentFormattedTimeLocal()});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,21 +221,11 @@ void CLobbyScreen::toggleMode(bool host)
|
|||||||
|
|
||||||
void CLobbyScreen::toggleChat()
|
void CLobbyScreen::toggleChat()
|
||||||
{
|
{
|
||||||
switch(card->chatMode)
|
card->toggleChat();
|
||||||
{
|
if(card->showChat)
|
||||||
case InfoCard::ChatMode::Enabled:
|
|
||||||
card->setChat(InfoCard::ChatMode::PvP);
|
|
||||||
buttonChat->setTextOverlay(CGI->generaltexth->allTexts[531], FONT_SMALL, Colors::WHITE);
|
buttonChat->setTextOverlay(CGI->generaltexth->allTexts[531], FONT_SMALL, Colors::WHITE);
|
||||||
break;
|
else
|
||||||
case InfoCard::ChatMode::Disabled:
|
|
||||||
card->setChat(InfoCard::ChatMode::Enabled);
|
|
||||||
buttonChat->setTextOverlay("PvP actions", FONT_SMALL, Colors::WHITE);
|
|
||||||
break;
|
|
||||||
case InfoCard::ChatMode::PvP:
|
|
||||||
card->setChat(InfoCard::ChatMode::Disabled);
|
|
||||||
buttonChat->setTextOverlay(CGI->generaltexth->allTexts[532], FONT_SMALL, Colors::WHITE);
|
buttonChat->setTextOverlay(CGI->generaltexth->allTexts[532], FONT_SMALL, Colors::WHITE);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLobbyScreen::updateAfterStateChange()
|
void CLobbyScreen::updateAfterStateChange()
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/CComponent.h"
|
#include "../widgets/CComponent.h"
|
||||||
#include "../widgets/GraphicalPrimitiveCanvas.h"
|
#include "../widgets/GraphicalPrimitiveCanvas.h"
|
||||||
|
#include "../widgets/Images.h"
|
||||||
#include "../widgets/ObjectLists.h"
|
#include "../widgets/ObjectLists.h"
|
||||||
#include "../widgets/Slider.h"
|
#include "../widgets/Slider.h"
|
||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
@@ -124,7 +125,7 @@ void CSelectionBase::toggleTab(std::shared_ptr<CIntObject> tab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InfoCard::InfoCard()
|
InfoCard::InfoCard()
|
||||||
: chatMode(ChatMode::Enabled)
|
: showChat(true)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
setRedrawParent(true);
|
setRedrawParent(true);
|
||||||
@@ -138,7 +139,7 @@ InfoCard::InfoCard()
|
|||||||
mapDescription = std::make_shared<CTextBox>("", descriptionRect, 1);
|
mapDescription = std::make_shared<CTextBox>("", descriptionRect, 1);
|
||||||
playerListBg = std::make_shared<CPicture>(ImagePath::builtin("CHATPLUG.bmp"), 16, 276);
|
playerListBg = std::make_shared<CPicture>(ImagePath::builtin("CHATPLUG.bmp"), 16, 276);
|
||||||
chat = std::make_shared<CChatBox>(Rect(18, 126, 335, 143));
|
chat = std::make_shared<CChatBox>(Rect(18, 126, 335, 143));
|
||||||
pvpBox = std::make_shared<PvPBox>(Rect(18, 126, 335, 262));
|
pvpBox = std::make_shared<PvPBox>(Rect(17, 396, 338, 105));
|
||||||
|
|
||||||
buttonInvitePlayers = std::make_shared<CButton>(Point(20, 365), AnimationPath::builtin("pregameInvitePlayers"), CGI->generaltexth->zelp[105], [](){ CSH->getGlobalLobby().activateRoomInviteInterface(); } );
|
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(); });
|
buttonOpenGlobalLobby = std::make_shared<CButton>(Point(188, 365), AnimationPath::builtin("pregameReturnToLobby"), CGI->generaltexth->zelp[105], [](){ CSH->getGlobalLobby().activateInterface(); });
|
||||||
@@ -195,9 +196,9 @@ InfoCard::InfoCard()
|
|||||||
labelGroupPlayers = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
|
labelGroupPlayers = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
|
||||||
disableLabelRedraws();
|
disableLabelRedraws();
|
||||||
}
|
}
|
||||||
setChat(ChatMode::Disabled);
|
setChat(false);
|
||||||
if (CSH->inLobbyRoom())
|
if (CSH->inLobbyRoom())
|
||||||
setChat(ChatMode::Enabled); // FIXME: less ugly version?
|
setChat(true); // FIXME: less ugly version?
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoCard::disableLabelRedraws()
|
void InfoCard::disableLabelRedraws()
|
||||||
@@ -251,7 +252,7 @@ void InfoCard::changeSelection()
|
|||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
// FIXME: We recreate them each time because CLabelGroup don't use smart pointers
|
// FIXME: We recreate them each time because CLabelGroup don't use smart pointers
|
||||||
labelGroupPlayers = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
|
labelGroupPlayers = std::make_shared<CLabelGroup>(FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
|
||||||
if(chatMode != ChatMode::Enabled)
|
if(!showChat)
|
||||||
labelGroupPlayers->disable();
|
labelGroupPlayers->disable();
|
||||||
|
|
||||||
for(const auto & p : CSH->playerNames)
|
for(const auto & p : CSH->playerNames)
|
||||||
@@ -268,14 +269,18 @@ void InfoCard::changeSelection()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoCard::setChat(ChatMode setMode)
|
void InfoCard::toggleChat()
|
||||||
{
|
{
|
||||||
if(chatMode == setMode)
|
setChat(!showChat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoCard::setChat(bool activateChat)
|
||||||
|
{
|
||||||
|
if(showChat == activateChat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(setMode)
|
if(activateChat)
|
||||||
{
|
{
|
||||||
case InfoCard::ChatMode::Enabled:
|
|
||||||
if(SEL->screenType == ESelectionScreen::campaignList)
|
if(SEL->screenType == ESelectionScreen::campaignList)
|
||||||
{
|
{
|
||||||
labelCampaignDescription->disable();
|
labelCampaignDescription->disable();
|
||||||
@@ -296,12 +301,20 @@ void InfoCard::setChat(ChatMode setMode)
|
|||||||
buttonInvitePlayers->enable();
|
buttonInvitePlayers->enable();
|
||||||
buttonOpenGlobalLobby->enable();
|
buttonOpenGlobalLobby->enable();
|
||||||
}
|
}
|
||||||
|
labelMapDiff->disable();
|
||||||
|
labelPlayerDifficulty->disable();
|
||||||
|
labelRating->disable();
|
||||||
|
labelDifficulty->disable();
|
||||||
|
labelDifficultyPercent->disable();
|
||||||
|
flagbox->disable();
|
||||||
|
iconDifficulty->disable();
|
||||||
mapDescription->disable();
|
mapDescription->disable();
|
||||||
chat->enable();
|
chat->enable();
|
||||||
pvpBox->disable();
|
pvpBox->enable();
|
||||||
playerListBg->enable();
|
playerListBg->enable();
|
||||||
break;
|
}
|
||||||
case InfoCard::ChatMode::Disabled:
|
else
|
||||||
|
{
|
||||||
buttonInvitePlayers->disable();
|
buttonInvitePlayers->disable();
|
||||||
buttonOpenGlobalLobby->disable();
|
buttonOpenGlobalLobby->disable();
|
||||||
mapDescription->enable();
|
mapDescription->enable();
|
||||||
@@ -324,34 +337,16 @@ void InfoCard::setChat(ChatMode setMode)
|
|||||||
labelLossConditionText->enable();
|
labelLossConditionText->enable();
|
||||||
labelGroupPlayers->disable();
|
labelGroupPlayers->disable();
|
||||||
}
|
}
|
||||||
break;
|
labelMapDiff->enable();
|
||||||
case InfoCard::ChatMode::PvP:
|
labelPlayerDifficulty->enable();
|
||||||
buttonInvitePlayers->disable();
|
labelRating->enable();
|
||||||
buttonOpenGlobalLobby->disable();
|
labelDifficulty->enable();
|
||||||
mapDescription->disable();
|
labelDifficultyPercent->enable();
|
||||||
chat->disable();
|
flagbox->enable();
|
||||||
pvpBox->enable();
|
iconDifficulty->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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chatMode = setMode;
|
showChat = activateChat;
|
||||||
GH.windows().totalRedraw();
|
GH.windows().totalRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,21 +398,25 @@ PvPBox::PvPBox(const Rect & rect)
|
|||||||
pos += rect.topLeft();
|
pos += rect.topLeft();
|
||||||
setRedrawParent(true);
|
setRedrawParent(true);
|
||||||
|
|
||||||
buttonFlipCoin = std::make_shared<CButton>(Point(17, 160), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("flip coin"), [](){
|
backgroundTexture = std::make_shared<FilledTexturePlayerColored>(ImagePath::builtin("DiBoxBck"), Rect(0, 0, rect.w, rect.h));
|
||||||
|
backgroundTexture->playerColored(PlayerColor(1));
|
||||||
|
backgroundBorder = std::make_shared<TransparentFilledRectangle>(Rect(0, 0, rect.w, rect.h), ColorRGBA(0, 0, 0, 64), ColorRGBA(96, 96, 96, 255), 1);
|
||||||
|
|
||||||
|
buttonFlipCoin = std::make_shared<CButton>(Point(17, 10), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("flip coin"), [](){
|
||||||
LobbyPvPAction lpa;
|
LobbyPvPAction lpa;
|
||||||
lpa.action = LobbyPvPAction::COIN;
|
lpa.action = LobbyPvPAction::COIN;
|
||||||
CSH->sendLobbyPack(lpa);
|
CSH->sendLobbyPack(lpa);
|
||||||
}, EShortcut::NONE);
|
}, EShortcut::NONE);
|
||||||
buttonFlipCoin->setTextOverlay("Flip coin2", EFonts::FONT_SMALL, Colors::WHITE);
|
buttonFlipCoin->setTextOverlay("Flip coin2", EFonts::FONT_SMALL, Colors::WHITE);
|
||||||
|
|
||||||
buttonRandomTown = std::make_shared<CButton>(Point(17, 184), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("random town"), [](){
|
buttonRandomTown = std::make_shared<CButton>(Point(17, 30), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("random town"), [](){
|
||||||
LobbyPvPAction lpa;
|
LobbyPvPAction lpa;
|
||||||
lpa.action = LobbyPvPAction::RANDOM_TOWN;
|
lpa.action = LobbyPvPAction::RANDOM_TOWN;
|
||||||
CSH->sendLobbyPack(lpa);
|
CSH->sendLobbyPack(lpa);
|
||||||
}, EShortcut::NONE);
|
}, EShortcut::NONE);
|
||||||
buttonRandomTown->setTextOverlay("random town", EFonts::FONT_SMALL, Colors::WHITE);
|
buttonRandomTown->setTextOverlay("random town", EFonts::FONT_SMALL, Colors::WHITE);
|
||||||
|
|
||||||
buttonRandomTownVs = std::make_shared<CButton>(Point(17, 208), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("random town vs"), [](){
|
buttonRandomTownVs = std::make_shared<CButton>(Point(17, 50), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("random town vs"), [](){
|
||||||
LobbyPvPAction lpa;
|
LobbyPvPAction lpa;
|
||||||
lpa.action = LobbyPvPAction::RANDOM_TOWN_VS;
|
lpa.action = LobbyPvPAction::RANDOM_TOWN_VS;
|
||||||
CSH->sendLobbyPack(lpa);
|
CSH->sendLobbyPack(lpa);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class CLabel;
|
|||||||
class CFlagBox;
|
class CFlagBox;
|
||||||
class CLabelGroup;
|
class CLabelGroup;
|
||||||
class TransparentFilledRectangle;
|
class TransparentFilledRectangle;
|
||||||
|
class FilledTexturePlayerColored;
|
||||||
|
|
||||||
class ISelectionScreenInfo
|
class ISelectionScreenInfo
|
||||||
{
|
{
|
||||||
@@ -111,13 +112,8 @@ class InfoCard : public CIntObject
|
|||||||
|
|
||||||
std::shared_ptr<PvPBox> pvpBox;
|
std::shared_ptr<PvPBox> pvpBox;
|
||||||
public:
|
public:
|
||||||
enum ChatMode {
|
|
||||||
Disabled,
|
|
||||||
Enabled,
|
|
||||||
PvP
|
|
||||||
};
|
|
||||||
|
|
||||||
ChatMode chatMode;
|
bool showChat;
|
||||||
std::shared_ptr<CChatBox> chat;
|
std::shared_ptr<CChatBox> chat;
|
||||||
std::shared_ptr<CFlagBox> flagbox;
|
std::shared_ptr<CFlagBox> flagbox;
|
||||||
|
|
||||||
@@ -126,7 +122,8 @@ public:
|
|||||||
InfoCard();
|
InfoCard();
|
||||||
void disableLabelRedraws();
|
void disableLabelRedraws();
|
||||||
void changeSelection();
|
void changeSelection();
|
||||||
void setChat(ChatMode setMode);
|
void toggleChat();
|
||||||
|
void setChat(bool activateChat);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CChatBox : public CIntObject
|
class CChatBox : public CIntObject
|
||||||
@@ -145,11 +142,13 @@ public:
|
|||||||
|
|
||||||
class PvPBox : public CIntObject
|
class PvPBox : public CIntObject
|
||||||
{
|
{
|
||||||
public:
|
std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
|
||||||
|
std::shared_ptr<TransparentFilledRectangle> backgroundBorder;
|
||||||
|
|
||||||
std::shared_ptr<CButton> buttonFlipCoin;
|
std::shared_ptr<CButton> buttonFlipCoin;
|
||||||
std::shared_ptr<CButton> buttonRandomTown;
|
std::shared_ptr<CButton> buttonRandomTown;
|
||||||
std::shared_ptr<CButton> buttonRandomTownVs;
|
std::shared_ptr<CButton> buttonRandomTownVs;
|
||||||
|
public:
|
||||||
PvPBox(const Rect & rect);
|
PvPBox(const Rect & rect);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user