Compare commits

..

No commits in common. "7e5aa22fee56cdeef5a6accd7b4344134b7c42d5" and "9f82e7a2e6d10d3782a22014ad348bebe3b004f7" have entirely different histories.

10 changed files with 29 additions and 92 deletions

View File

@ -14,78 +14,40 @@
{ {
"type": "Button", "type": "Button",
"name": "gameOverText", "name": "gameOverText",
"x": 476.5,
"y": 500,
"width": 327,
"height": 26,
"textures": {
"normal": "resources/game_over/MissionFailed.png",
"hover": "resources/game_over/MissionFailed.png",
"pressed": "resources/game_over/MissionFailed.png"
}
},
{
"type": "Button",
"name": "underlineBtn",
"x": 556,
"y": 465,
"width": 168,
"height": 44,
"textures": {
"normal": "resources/game_over/Container.png",
"hover": "resources/game_over/Container.png",
"pressed": "resources/game_over/Container.png"
}
},
{
"type": "Button",
"name": "finalscore",
"x": 596.5,
"y": 436,
"width": 87,
"height": 9,
"textures": {
"normal": "resources/game_over/FinalScore.png",
"hover": "resources/game_over/FinalScore.png",
"pressed": "resources/game_over/FinalScore.png"
}
},
{
"type": "TextView",
"name": "scoreText",
"x": 350, "x": 350,
"y": 356, "y": 400,
"width": 600, "width": 600,
"height": 80, "height": 150,
"text": "0", "textures": {
"fontSize": 36, "normal": "resources/gameover.png",
"color": [0, 217, 255, 1], "hover": "resources/gameover.png",
"align": "center" "pressed": "resources/gameover.png"
}
}, },
{ {
"type": "Button", "type": "Button",
"name": "restartButton", "name": "restartButton",
"x": 449, "x": 350,
"y": 308, "y": 300,
"width": 382, "width": 300,
"height": 56, "height": 80,
"textures": { "textures": {
"normal": "resources/game_over/Filledbuttons.png", "normal": "resources/shoot_normal.png",
"hover": "resources/game_over/Filledbuttons.png", "hover": "resources/shoot_normal.png",
"pressed": "resources/game_over/Filledbuttons.png" "pressed": "resources/shoot_normal.png"
} }
}, },
{ {
"type": "Button", "type": "Button",
"name": "gameOverExitButton", "name": "gameOverExitButton",
"x": 449, "x": 650,
"y": 240, "y": 300,
"width": 382, "width": 300,
"height": 56, "height": 80,
"textures": { "textures": {
"normal": "resources/game_over/Secondarybutton.png", "normal": "resources/sand2.png",
"hover": "resources/game_over/Secondarybutton.png", "hover": "resources/sand2.png",
"pressed": "resources/game_over/Secondarybutton.png" "pressed": "resources/sand2.png"
} }
} }
] ]

BIN
resources/game_over/Container.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/game_over/Filledbuttons.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/game_over/FinalScore.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/game_over/MissionFailed.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/game_over/Secondarybutton.png (Stored with Git LFS)

Binary file not shown.

View File

@ -38,7 +38,7 @@ namespace ZL {
uiManager.startAnimationOnNode("backgroundNode", "bgScroll"); uiManager.startAnimationOnNode("backgroundNode", "bgScroll");
static bool isExitButtonAnimating = false; static bool isExitButtonAnimating = false;
uiManager.setAnimationCallback("settingsButton", "buttonsExit", [this]() { 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)) { if (uiManager.pushMenuFromSavedRoot(settingsSavedRoot)) {
uiManager.setButtonCallback("Opt1", [this](const std::string& n) { uiManager.setButtonCallback("Opt1", [this](const std::string& n) {
std::cerr << "Opt1 pressed: " << n << std::endl; std::cerr << "Opt1 pressed: " << n << std::endl;
@ -258,17 +258,14 @@ namespace ZL {
}); });
} }
void MenuManager::showGameOver(int score) void MenuManager::showGameOver()
{ {
if (!uiGameOverShown) { if (!uiGameOverShown) {
if (uiManager.pushMenuFromSavedRoot(gameOverSavedRoot)) { if (uiManager.pushMenuFromSavedRoot(gameOverSavedRoot)) {
uiManager.setText("scoreText", std::string("Score: ") + std::to_string(score));
uiManager.setButtonCallback("restartButton", [this](const std::string& name) { uiManager.setButtonCallback("restartButton", [this](const std::string& name) {
uiManager.setText("scoreText", "");
uiGameOverShown = false; uiGameOverShown = false;
uiManager.popMenu(); uiManager.popMenu();
if (onRestartPressed) onRestartPressed(); onRestartPressed();
}); });
uiManager.setButtonCallback("gameOverExitButton", [this](const std::string& name) { uiManager.setButtonCallback("gameOverExitButton", [this](const std::string& name) {

View File

@ -28,8 +28,7 @@ namespace ZL {
void setupMenu(); void setupMenu();
//void showGameOver(); void showGameOver();
void showGameOver(int score);
std::function<void()> onRestartPressed; std::function<void()> onRestartPressed;
std::function<void(float)> onVelocityChanged; std::function<void(float)> onVelocityChanged;

View File

@ -276,7 +276,7 @@ namespace ZL
std::cerr << "Client: Failed to send RESPAWN\n"; std::cerr << "Client: Failed to send RESPAWN\n";
} }
} }
this->playerScore = 0;
std::cerr << "Game restarted\n"; std::cerr << "Game restarted\n";
}; };
@ -1598,7 +1598,7 @@ namespace ZL
std::cerr << "GAME OVER: collision with planet (moved back and exploded)\n"; std::cerr << "GAME OVER: collision with planet (moved back and exploded)\n";
menuManager.showGameOver(this->playerScore); menuManager.showGameOver();
} }
else { else {
bool stoneCollided = false; bool stoneCollided = false;
@ -1673,7 +1673,7 @@ namespace ZL
planetObject.planetStones.statuses[collidedTriIdx] = ChunkStatus::Empty; planetObject.planetStones.statuses[collidedTriIdx] = ChunkStatus::Empty;
} }
menuManager.showGameOver(this->playerScore); menuManager.showGameOver();
} }
} }
} }
@ -1777,17 +1777,12 @@ namespace ZL
shipAlive = false; shipAlive = false;
gameOver = true; gameOver = true;
Environment::shipState.velocity = 0.0f; Environment::shipState.velocity = 0.0f;
menuManager.showGameOver(this->playerScore); menuManager.showGameOver();
} }
else { else {
deadRemotePlayers.insert(d.targetId); deadRemotePlayers.insert(d.targetId);
std::cout << "Marked remote player " << d.targetId << " as dead" << std::endl; 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;
}
} }
} }

View File

@ -122,7 +122,6 @@ namespace ZL {
static constexpr float CLOSE_DIST = 600.0f; static constexpr float CLOSE_DIST = 600.0f;
std::unordered_set<int> deadRemotePlayers; std::unordered_set<int> deadRemotePlayers;
int playerScore = 0;
static constexpr float TARGET_MAX_DIST = 50000.0f; static constexpr float TARGET_MAX_DIST = 50000.0f;
static constexpr float TARGET_MAX_DIST_SQ = TARGET_MAX_DIST * TARGET_MAX_DIST; static constexpr float TARGET_MAX_DIST_SQ = TARGET_MAX_DIST * TARGET_MAX_DIST;