mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
made the game over screens nicer
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
Size = {x = 150, y = 40}
|
||||
|
||||
music = {
|
||||
loop = true,
|
||||
shuffle = false,
|
||||
delay = 2000,
|
||||
tracks = {'defeat.ogg'}
|
||||
}
|
||||
|
||||
res = graphics.resolution
|
||||
overlaySize = {x = 600, y = 450}
|
||||
overlayPos = {x = .5 * (res.x - overlaySize.x), y = 200, z = 0}
|
||||
buttonSize = {x = 150, y = 40}
|
||||
buttonInitPos = {x = .5 * (res.x - buttonSize.x), y = 350, z = .1}
|
||||
|
||||
gui = {
|
||||
{
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Defeat',
|
||||
name = 'D',
|
||||
pos = {x = 100, y = 100, z = 0},
|
||||
pos = {x = overlayPos.x + 20, y = overlayPos.y + 75, z = .1},
|
||||
scale = 1,
|
||||
font = 'batang.ttf',
|
||||
fontFirstChar = 0,
|
||||
@@ -20,17 +25,16 @@ gui = {
|
||||
},
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
pos = {x = 100, y = 200, z = .1},
|
||||
size = {x = 600, y = 600},
|
||||
pos = overlayPos,
|
||||
size = overlaySize,
|
||||
color = {x = 0, y = 0, z = 0, w = 0.1}
|
||||
},
|
||||
{
|
||||
pos = {x = 110, y = 350, z = 0},
|
||||
size = Size,
|
||||
pos = buttonInitPos,
|
||||
size = buttonSize,
|
||||
guiType = GuiType.BUTTON,
|
||||
name = 'Leave',
|
||||
buttonType = ButtonType.STATISTICS,
|
||||
trigger = -1,
|
||||
--imagePath = ''
|
||||
}
|
||||
trigger = -1
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
headerHeight = 150
|
||||
statsInitHeight = 120
|
||||
statsSpace = 100
|
||||
fontName = 'batang.ttf'
|
||||
|
||||
gui = {
|
||||
{
|
||||
guiType = GuiType.TEXT,
|
||||
@@ -6,7 +11,7 @@ gui = {
|
||||
pos = {x = 850, y = 100, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.5,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -15,10 +20,10 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Player',
|
||||
name = 'pl',
|
||||
pos = {x = 50, y = 200, z = 0},
|
||||
pos = {x = 50, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -27,10 +32,10 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Vehicles built',
|
||||
name = 'vb',
|
||||
pos = {x = 150, y = 200, z = 0},
|
||||
pos = {x = 150, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -39,10 +44,10 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Vehicles destroyed',
|
||||
name = 'vd',
|
||||
pos = {x = 450, y = 200, z = 0},
|
||||
pos = {x = 450, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -51,10 +56,10 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Vehicles lost',
|
||||
name = 'vl',
|
||||
pos = {x = 850, y = 200, z = 0},
|
||||
pos = {x = 850, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -63,10 +68,10 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Structures built',
|
||||
name = 'sb',
|
||||
pos = {x = 1050, y = 200, z = 0},
|
||||
pos = {x = 1050, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -75,10 +80,10 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Structures destroyed',
|
||||
name = 'sd',
|
||||
pos = {x = 1350, y = 200, z = 0},
|
||||
pos = {x = 1350, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
font = fontName,
|
||||
fontFirstChar = 0,
|
||||
fontLastChar = 256,
|
||||
color = {x = 1, y = 1, z = 1, w = 1}
|
||||
@@ -87,7 +92,7 @@ gui = {
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'Structures lost',
|
||||
name = 'sl',
|
||||
pos = {x = 1720, y = 200, z = 0},
|
||||
pos = {x = 1720, y = headerHeight, z = 0},
|
||||
zIndex = 0,
|
||||
scale = 0.3,
|
||||
font = 'batang.ttf',
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
Size = {x = 150, y = 40}
|
||||
|
||||
music = {
|
||||
loop = true,
|
||||
shuffle = false,
|
||||
delay = 2000,
|
||||
tracks = {'victory.ogg'}
|
||||
}
|
||||
|
||||
res = graphics.resolution
|
||||
overlaySize = {x = 600, y = 450}
|
||||
overlayPos = {x = .5 * (res.x - overlaySize.x), y = 200, z = 0}
|
||||
buttonSize = {x = 150, y = 40}
|
||||
buttonInitPos = {x = .5 * (res.x - buttonSize.x), y = 350, z = .1}
|
||||
|
||||
gui = {
|
||||
{
|
||||
guiType = GuiType.TEXT,
|
||||
text = 'VICTORY!!!',
|
||||
name = 'V',
|
||||
pos = {x = 100, y = 100, z = 0},
|
||||
zIndex = 0,
|
||||
pos = {x = overlayPos.x + 20, y = overlayPos.y + 75, z = .1},
|
||||
scale = 1,
|
||||
font = 'batang.ttf',
|
||||
fontFirstChar = 0,
|
||||
@@ -21,25 +25,23 @@ gui = {
|
||||
},
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
pos = {x = 100, y = 200, z = 0},
|
||||
zIndex = 1,
|
||||
size = {x = 600, y = 600},
|
||||
pos = overlayPos,
|
||||
size = overlaySize,
|
||||
color = {x = 0, y = 0, z = 0, w = 0.1}
|
||||
},
|
||||
{
|
||||
pos = {x = 100, y = 350, z = 0},
|
||||
size = Size,
|
||||
pos = buttonInitPos,
|
||||
size = buttonSize,
|
||||
guiType = GuiType.BUTTON,
|
||||
name = 'Resume',
|
||||
buttonType = ButtonType.RESUME
|
||||
},
|
||||
{
|
||||
pos = {x = 110, y = 400, z = 0},
|
||||
size = Size,
|
||||
pos = {x = buttonInitPos.x, y = buttonInitPos.y + buttonSize.y + 10, z = buttonInitPos.z},
|
||||
size = buttonSize,
|
||||
guiType = GuiType.BUTTON,
|
||||
name = 'Leave',
|
||||
buttonType = ButtonType.STATISTICS,
|
||||
trigger = -1,
|
||||
--imagePath = ''
|
||||
trigger = -1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,7 @@ namespace battleship{
|
||||
StateManager *sm = GameManager::getSingleton()->getStateManager();
|
||||
sm->dettachAppState(sm->getAppStateByType(AppStateType::ACTIVE_STATE));
|
||||
|
||||
togglePause();
|
||||
|
||||
string endGameScreen = (victory ? "victory.lua" : "defeat.lua");
|
||||
ConcreteGuiManager::getSingleton()->readLuaScreenScript(endGameScreen);
|
||||
ConcreteGuiManager::getSingleton()->parseLuaScript(victory ? "victory.lua" : "defeat.lua");
|
||||
}
|
||||
|
||||
void Game::update(){
|
||||
|
||||
@@ -56,13 +56,16 @@ namespace battleship{
|
||||
}
|
||||
|
||||
Map::Minimap::~Minimap(){
|
||||
Node *guiNode = Root::getSingleton()->getGuiNode();
|
||||
|
||||
for(Node *node : depositIcons){
|
||||
Root::getSingleton()->getGuiNode()->dettachChild(node);
|
||||
guiNode->dettachChild(node);
|
||||
delete node;
|
||||
}
|
||||
|
||||
depositIcons.clear();
|
||||
|
||||
guiNode->dettachChild(camIcon);
|
||||
delete camIcon;
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -6,6 +6,7 @@
|
||||
#include "map.h"
|
||||
|
||||
#include <stateManager.h>
|
||||
#include <solUtil.h>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
@@ -30,7 +31,9 @@ namespace battleship{
|
||||
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
|
||||
Vector3 plCol = player->getColor();
|
||||
Root *root = Root::getSingleton();
|
||||
string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
|
||||
sol::state_view SOL_STATE_VIEW = generateView();
|
||||
float statsInitHeight = SOL_STATE_VIEW["statsInitHeight"], statsSpace = SOL_STATE_VIEW["statsSpace"];
|
||||
string fontName = SOL_STATE_VIEW["fontName"];
|
||||
|
||||
for(int i = 0; i < numPairs; i++){
|
||||
Text *category = guiManager->getText(unitDataPairs[i].first);
|
||||
@@ -39,11 +42,11 @@ namespace battleship{
|
||||
categoryMat->addBoolUniform("texturingEnabled", false);
|
||||
categoryMat->addVec4Uniform("diffuseColor", Vector4(plCol.x, plCol.y, plCol.z, 1));
|
||||
|
||||
Text *categoryVal = new Text(fontPath, unitDataPairs[i].second);
|
||||
Text *categoryVal = new Text(GameManager::getSingleton()->getPath() + "Fonts/" + fontName, unitDataPairs[i].second);
|
||||
categoryVal->setScale(category->getScale());
|
||||
categoryVal->setMaterial(categoryMat);
|
||||
|
||||
Node *categoryValNode = new Node(category->getNode()->getPosition() + Vector3(0, 100 * playerId, 0));
|
||||
Node *categoryValNode = new Node(category->getNode()->getPosition() + Vector3(0, statsInitHeight + statsSpace * playerId, 0));
|
||||
categoryValNode->addText(categoryVal);
|
||||
root->getGuiNode()->attachChild(categoryValNode);
|
||||
|
||||
@@ -64,7 +67,7 @@ namespace battleship{
|
||||
Game *game = Game::getSingleton();
|
||||
int numPlayers = game->getNumPlayers();
|
||||
|
||||
for(int i = 1; i < numPlayers; i++)
|
||||
for(int i = 0; i < numPlayers; i++)
|
||||
addPlayerDataGuiElements(i);
|
||||
|
||||
game->removeAllElements();
|
||||
|
||||
Reference in New Issue
Block a user