forked from townforge/townforge
game: allow hiding the spectator mode screen
This commit is contained in:
parent
71d55ac2fa
commit
f971110251
@ -17,3 +17,6 @@ TBLayout: axis: y, distribution-position: "left top", distribution: "available",
|
||||
|
||||
TBButton: skin: "TBButton.spectator", text: " Or explain accounts " id: "spectator-explain"
|
||||
font: size: 20px
|
||||
|
||||
TBButton: skin: "TBButton.spectator", text: " Hide " id: "spectator-hide"
|
||||
font: size: 20px
|
||||
|
@ -270,7 +270,8 @@ UIUrho3D::UIUrho3D(Context *ctx, const GameState *gameState):
|
||||
sel_x0(0),
|
||||
sel_y0(0),
|
||||
sel_x1(0),
|
||||
sel_y1(0)
|
||||
sel_y1(0),
|
||||
hide_spectator_mode(false)
|
||||
{
|
||||
auto root = ctx->GetSubsystem<UI>()->GetRoot();
|
||||
auto* cache = ctx->GetSubsystem<ResourceCache>();
|
||||
@ -829,7 +830,7 @@ void UIUrho3D::RefreshNotifications()
|
||||
void UIUrho3D::UpdateSpectatorMode(const std::shared_ptr<GameWallet> &w)
|
||||
{
|
||||
const bool has_account = gameState->playerState.has_wallet && gameState->playerState.id > 0;
|
||||
spectatorModeWidget->SetVisibility((w->is_spectator() || !has_account) ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_INVISIBLE);
|
||||
spectatorModeWidget->SetVisibility((w->is_spectator() || !has_account) && !hide_spectator_mode ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_INVISIBLE);
|
||||
if (w->is_spectator() || !has_account)
|
||||
{
|
||||
spectatorCreateButton->SetText(w->is_spectator() ? " Load a wallet " : " Create an avatar ");
|
||||
@ -1709,6 +1710,11 @@ void UIUrho3D::HandleExplainAccounts(StringHash eventType, VariantMap& eventData
|
||||
SendTutorialTrigger("accounts", true);
|
||||
}
|
||||
|
||||
void UIUrho3D::HandleSpectatorHide(StringHash eventType, VariantMap& eventData)
|
||||
{
|
||||
hide_spectator_mode = !hide_spectator_mode;
|
||||
}
|
||||
|
||||
void UIUrho3D::HandleAcceptInvitation(StringHash eventType, VariantMap& eventData)
|
||||
{
|
||||
if (acceptInvitationDialog)
|
||||
@ -4125,6 +4131,7 @@ void UIUrho3D::HandleTBMessage(StringHash eventType, VariantMap& eventData)
|
||||
CONNECT("spectator-create-account", HandleDeposit);
|
||||
CONNECT("spectator-no-wallet", HandleNoWallet);
|
||||
CONNECT("spectator-explain", HandleExplainAccounts);
|
||||
CONNECT("spectator-hide", HandleSpectatorHide);
|
||||
CONNECT("request-new-avatar", HandleRequestNewAvatar);
|
||||
CONNECT("configure-network", HandleConfigureNetwork);
|
||||
CONNECT("show-queued-commands", HandleShowQueuedCommands);
|
||||
|
@ -472,6 +472,7 @@ private:
|
||||
void HandleStartMining(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
|
||||
void HandleStopMining(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
|
||||
void HandleRequestNewAvatar(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
|
||||
void HandleSpectatorHide(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
|
||||
|
||||
void HandleDemolishConfirmation(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
|
||||
void HandleDestroyFlagConfirmation(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
|
||||
@ -743,6 +744,8 @@ private:
|
||||
uint32_t sel_y0;
|
||||
uint32_t sel_x1;
|
||||
uint32_t sel_y1;
|
||||
|
||||
bool hide_spectator_mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user