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