merge
This commit is contained in:
commit
7e5aa22fee
10 files changed
+93
-30
No files matched your search
+6
-3
@@ -38,7 +38,7 @@ namespace ZL {
|
||||
uiManager.startAnimationOnNode("backgroundNode", "bgScroll");
|
||||
static bool isExitButtonAnimating = false;
|
||||
uiManager.setAnimationCallback("settingsButton", "buttonsExit", [this]() {
|
||||
std::cerr << "Settings button animation finished -> переход в настройки" << std::endl;
|
||||
std::cerr << "Settings button animation finished -> ??????? ? ?????????" << std::endl;
|
||||
if (uiManager.pushMenuFromSavedRoot(settingsSavedRoot)) {
|
||||
uiManager.setButtonCallback("Opt1", [this](const std::string& n) {
|
||||
std::cerr << "Opt1 pressed: " << n << std::endl;
|
||||
@@ -258,14 +258,17 @@ namespace ZL {
|
||||
});
|
||||
}
|
||||
|
||||
void MenuManager::showGameOver()
|
||||
void MenuManager::showGameOver(int score)
|
||||
{
|
||||
if (!uiGameOverShown) {
|
||||
if (uiManager.pushMenuFromSavedRoot(gameOverSavedRoot)) {
|
||||
uiManager.setText("scoreText", std::string("Score: ") + std::to_string(score));
|
||||
|
||||
uiManager.setButtonCallback("restartButton", [this](const std::string& name) {
|
||||
uiManager.setText("scoreText", "");
|
||||
uiGameOverShown = false;
|
||||
uiManager.popMenu();
|
||||
onRestartPressed();
|
||||
if (onRestartPressed) onRestartPressed();
|
||||
});
|
||||
|
||||
uiManager.setButtonCallback("gameOverExitButton", [this](const std::string& name) {
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@ namespace ZL {
|
||||
|
||||
void setupMenu();
|
||||
|
||||
void showGameOver();
|
||||
//void showGameOver();
|
||||
void showGameOver(int score);
|
||||
|
||||
std::function<void()> onRestartPressed;
|
||||
std::function<void(float)> onVelocityChanged;
|
||||
|
||||
+9
-4
@@ -276,7 +276,7 @@ namespace ZL
|
||||
std::cerr << "Client: Failed to send RESPAWN\n";
|
||||
}
|
||||
}
|
||||
|
||||
this->playerScore = 0;
|
||||
std::cerr << "Game restarted\n";
|
||||
};
|
||||
|
||||
@@ -1598,7 +1598,7 @@ namespace ZL
|
||||
|
||||
std::cerr << "GAME OVER: collision with planet (moved back and exploded)\n";
|
||||
|
||||
menuManager.showGameOver();
|
||||
menuManager.showGameOver(this->playerScore);
|
||||
}
|
||||
else {
|
||||
bool stoneCollided = false;
|
||||
@@ -1673,7 +1673,7 @@ namespace ZL
|
||||
planetObject.planetStones.statuses[collidedTriIdx] = ChunkStatus::Empty;
|
||||
}
|
||||
|
||||
menuManager.showGameOver();
|
||||
menuManager.showGameOver(this->playerScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1777,12 +1777,17 @@ namespace ZL
|
||||
shipAlive = false;
|
||||
gameOver = true;
|
||||
Environment::shipState.velocity = 0.0f;
|
||||
menuManager.showGameOver();
|
||||
menuManager.showGameOver(this->playerScore);
|
||||
}
|
||||
else {
|
||||
deadRemotePlayers.insert(d.targetId);
|
||||
std::cout << "Marked remote player " << d.targetId << " as dead" << std::endl;
|
||||
}
|
||||
if (d.killerId == localId) {
|
||||
this->playerScore += 1;
|
||||
std::cout << "Client: Increased local score to " << this->playerScore << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ namespace ZL {
|
||||
static constexpr float CLOSE_DIST = 600.0f;
|
||||
|
||||
std::unordered_set<int> deadRemotePlayers;
|
||||
int playerScore = 0;
|
||||
|
||||
static constexpr float TARGET_MAX_DIST = 50000.0f;
|
||||
static constexpr float TARGET_MAX_DIST_SQ = TARGET_MAX_DIST * TARGET_MAX_DIST;
|
||||
|
||||
Reference in new issue
Block a user