Fixing ui bugs
This commit is contained in:
1 parent
3e8dba36a4
commit
a8ded217df
5 files changed
+46
-13
No files matched your search
+2
-1
@@ -139,11 +139,12 @@ namespace ZL {
|
||||
if (auto btn = uiManager.findButton("takeButton")) btn->state = ButtonState::Disabled;
|
||||
|
||||
|
||||
/*
|
||||
auto velocityTv = uiManager.findTextView("velocityText");
|
||||
if (velocityTv) {
|
||||
velocityTv->rect.x = 10.0f;
|
||||
velocityTv->rect.y = static_cast<float>(Environment::height) - velocityTv->rect.h - 10.0f;
|
||||
}
|
||||
}*/
|
||||
|
||||
uiManager.setButtonPressCallback("shootButton", [this](const std::string&) {
|
||||
if (onFirePressed) onFirePressed();
|
||||
|
||||
@@ -349,6 +349,7 @@ namespace ZL
|
||||
}
|
||||
if (bestIdx >= 0) {
|
||||
networkClient->Send("BOX_PICKUP:" + std::to_string(bestIdx));
|
||||
this->playerScore += 1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1837,6 +1838,11 @@ namespace ZL
|
||||
}
|
||||
}
|
||||
|
||||
if (playerScore != prevPlayerScore)
|
||||
{
|
||||
prevPlayerScore = playerScore;
|
||||
menuManager.uiManager.setText("gameScoreText", "Score: " + std::to_string(playerScore));
|
||||
}
|
||||
}
|
||||
|
||||
void Space::fireProjectiles() {
|
||||
@@ -1845,6 +1851,7 @@ namespace ZL
|
||||
Vector3f{ 1.5f, 0.9f - 6.f, 5.0f }
|
||||
};
|
||||
|
||||
|
||||
const float projectileSpeed = PROJECTILE_VELOCITY;
|
||||
const float lifeMs = PROJECTILE_LIFE;
|
||||
const float size = 0.5f;
|
||||
|
||||
@@ -126,6 +126,7 @@ namespace ZL {
|
||||
|
||||
std::unordered_set<int> deadRemotePlayers;
|
||||
int playerScore = 0;
|
||||
int prevPlayerScore = 0;
|
||||
bool wasConnectedToServer = false;
|
||||
|
||||
static constexpr float TARGET_MAX_DIST = 50000.0f;
|
||||
|
||||
Reference in new issue
Block a user