- added ability to override UI placement for connected and custom menus
This commit is contained in:
parent
54f37d6231
commit
cf5b085b2e
|
@ -18,6 +18,7 @@
|
||||||
#include "core_data.h"
|
#include "core_data.h"
|
||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "conversion.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -34,11 +35,66 @@ float GraphicComponent::fade= 0.f;
|
||||||
const float GraphicComponent::animSpeed= 0.02f;
|
const float GraphicComponent::animSpeed= 0.02f;
|
||||||
const float GraphicComponent::fadeSpeed= 0.01f;
|
const float GraphicComponent::fadeSpeed= 0.01f;
|
||||||
|
|
||||||
GraphicComponent::GraphicComponent(){
|
std::map<std::string, std::map<std::string, GraphicComponent *> > GraphicComponent::registeredGraphicComponentList;
|
||||||
|
|
||||||
|
GraphicComponent::GraphicComponent(std::string containerName, std::string objName) {
|
||||||
|
instanceName = "";
|
||||||
|
if(objName != "") {
|
||||||
|
registerGraphicComponent(containerName,objName);
|
||||||
|
}
|
||||||
enabled= true;
|
enabled= true;
|
||||||
editable= true;
|
editable= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicComponent::registerGraphicComponent(std::string containerName, std::string objName) {
|
||||||
|
instanceName = objName;
|
||||||
|
registeredGraphicComponentList[containerName][objName] = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphicComponent * GraphicComponent::findRegisteredComponent(std::string containerName, std::string objName) {
|
||||||
|
GraphicComponent *result = NULL;
|
||||||
|
|
||||||
|
std::map<std::string, std::map<std::string, GraphicComponent *> >::iterator iterFind1 = GraphicComponent::registeredGraphicComponentList.find(containerName);
|
||||||
|
if(iterFind1 != GraphicComponent::registeredGraphicComponentList.end()) {
|
||||||
|
std::map<std::string, GraphicComponent *>::iterator iterFind2 = iterFind1->second.find(objName);
|
||||||
|
if(iterFind2 != iterFind1->second.end()) {
|
||||||
|
result = iterFind2->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicComponent::applyAllCustomProperties(std::string containerName) {
|
||||||
|
|
||||||
|
std::map<std::string, std::map<std::string, GraphicComponent *> >::iterator iterFind1 = GraphicComponent::registeredGraphicComponentList.find(containerName);
|
||||||
|
if(iterFind1 != GraphicComponent::registeredGraphicComponentList.end()) {
|
||||||
|
for(std::map<std::string, GraphicComponent *>::iterator iterFind2 = iterFind1->second.begin();
|
||||||
|
iterFind2 != iterFind1->second.end(); iterFind2++) {
|
||||||
|
iterFind2->second->applyCustomProperties(containerName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicComponent::applyCustomProperties(std::string containerName) {
|
||||||
|
if(instanceName != "") {
|
||||||
|
std::map<std::string, std::map<std::string, GraphicComponent *> >::iterator iterFind1 = GraphicComponent::registeredGraphicComponentList.find(containerName);
|
||||||
|
if(iterFind1 != GraphicComponent::registeredGraphicComponentList.end()) {
|
||||||
|
std::map<std::string, GraphicComponent *>::iterator iterFind2 = iterFind1->second.find(instanceName);
|
||||||
|
if(iterFind2 != iterFind1->second.end()) {
|
||||||
|
Config &config = Config::getInstance();
|
||||||
|
|
||||||
|
//if(dynamic_cast<GraphicButton *>(iterFind2->second) != NULL) {
|
||||||
|
GraphicComponent *ctl = dynamic_cast<GraphicComponent *>(iterFind2->second);
|
||||||
|
ctl->x = config.getInt(containerName + "_" + iterFind2->first + "_x",intToStr(ctl->x).c_str());
|
||||||
|
ctl->y = config.getInt(containerName + "_" + iterFind2->first + "_y",intToStr(ctl->y).c_str());
|
||||||
|
ctl->w = config.getInt(containerName + "_" + iterFind2->first + "_w",intToStr(ctl->w).c_str());
|
||||||
|
ctl->h = config.getInt(containerName + "_" + iterFind2->first + "_h",intToStr(ctl->h).c_str());
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicComponent::init(int x, int y, int w, int h){
|
void GraphicComponent::init(int x, int y, int w, int h){
|
||||||
this->x= x;
|
this->x= x;
|
||||||
this->y= y;
|
this->y= y;
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <typeinfo>
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
@ -25,17 +26,21 @@ using Shared::Graphics::Font2D;
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
class GraphicComponent;
|
||||||
|
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
// class GraphicComponent
|
// class GraphicComponent
|
||||||
//
|
//
|
||||||
// OpenGL renderer GUI components
|
// OpenGL renderer GUI components
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
||||||
class GraphicComponent{
|
class GraphicComponent {
|
||||||
public:
|
public:
|
||||||
static const float animSpeed;
|
static const float animSpeed;
|
||||||
static const float fadeSpeed;
|
static const float fadeSpeed;
|
||||||
|
|
||||||
|
static std::map<std::string, std::map<std::string, GraphicComponent *> > registeredGraphicComponentList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
string text;
|
string text;
|
||||||
|
@ -46,10 +51,17 @@ protected:
|
||||||
static float anim;
|
static float anim;
|
||||||
static float fade;
|
static float fade;
|
||||||
|
|
||||||
|
string instanceName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicComponent();
|
GraphicComponent(std::string containerName="", std::string objName="");
|
||||||
virtual ~GraphicComponent(){}
|
virtual ~GraphicComponent(){}
|
||||||
|
|
||||||
|
void registerGraphicComponent(std::string containerName, std::string objName);
|
||||||
|
static GraphicComponent * findRegisteredComponent(std::string containerName, std::string objName);
|
||||||
|
static void applyAllCustomProperties(std::string containerName);
|
||||||
|
void applyCustomProperties(std::string containerName);
|
||||||
|
|
||||||
void init(int x, int y, int w, int h);
|
void init(int x, int y, int w, int h);
|
||||||
|
|
||||||
int getX() const {return x;}
|
int getX() const {return x;}
|
||||||
|
@ -81,7 +93,7 @@ public:
|
||||||
// class GraphicLabel
|
// class GraphicLabel
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
||||||
class GraphicLabel: public GraphicComponent{
|
class GraphicLabel: public GraphicComponent {
|
||||||
public:
|
public:
|
||||||
static const int defH;
|
static const int defH;
|
||||||
static const int defW;
|
static const int defW;
|
||||||
|
@ -101,7 +113,7 @@ public:
|
||||||
// class GraphicButton
|
// class GraphicButton
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
||||||
class GraphicButton: public GraphicComponent{
|
class GraphicButton: public GraphicComponent {
|
||||||
public:
|
public:
|
||||||
static const int defH;
|
static const int defH;
|
||||||
static const int defW;
|
static const int defW;
|
||||||
|
@ -122,7 +134,7 @@ public:
|
||||||
// class GraphicListBox
|
// class GraphicListBox
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
||||||
class GraphicListBox: public GraphicComponent{
|
class GraphicListBox: public GraphicComponent {
|
||||||
public:
|
public:
|
||||||
static const int defH;
|
static const int defH;
|
||||||
static const int defW;
|
static const int defW;
|
||||||
|
@ -155,7 +167,7 @@ public:
|
||||||
// class GraphicMessageBox
|
// class GraphicMessageBox
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
||||||
class GraphicMessageBox: public GraphicComponent{
|
class GraphicMessageBox: public GraphicComponent {
|
||||||
public:
|
public:
|
||||||
static const int defH;
|
static const int defH;
|
||||||
static const int defW;
|
static const int defW;
|
||||||
|
|
|
@ -45,6 +45,8 @@ struct FormatString {
|
||||||
// class MenuStateConnectedGame
|
// class MenuStateConnectedGame
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
|
const char *MenuStateConnectedGame::containerName = "ClientConnectedGame";
|
||||||
|
|
||||||
MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainMenu,JoinMenu joinMenuInfo, bool openNetworkSlots):
|
MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainMenu,JoinMenu joinMenuInfo, bool openNetworkSlots):
|
||||||
MenuState(program, mainMenu, "connected-game") //← set on connected-game
|
MenuState(program, mainMenu, "connected-game") //← set on connected-game
|
||||||
{
|
{
|
||||||
|
@ -86,23 +88,32 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
int xoffset=0;
|
int xoffset=0;
|
||||||
|
|
||||||
//state
|
//state
|
||||||
|
labelStatus.registerGraphicComponent(containerName,"labelStatus");
|
||||||
labelStatus.init(350, networkHeadPos+30);
|
labelStatus.init(350, networkHeadPos+30);
|
||||||
labelStatus.setText("");
|
labelStatus.setText("");
|
||||||
|
|
||||||
|
labelInfo.registerGraphicComponent(containerName,"labelInfo");
|
||||||
labelInfo.init(30, networkHeadPos+30);
|
labelInfo.init(30, networkHeadPos+30);
|
||||||
labelInfo.setText("");
|
labelInfo.setText("");
|
||||||
labelInfo.setFont(CoreData::getInstance().getMenuFontBig());
|
labelInfo.setFont(CoreData::getInstance().getMenuFontBig());
|
||||||
|
|
||||||
//create
|
//create
|
||||||
|
buttonDisconnect.registerGraphicComponent(containerName,"buttonDisconnect");
|
||||||
buttonDisconnect.init(450, 180, 125);
|
buttonDisconnect.init(450, 180, 125);
|
||||||
|
|
||||||
|
buttonPlayNow.registerGraphicComponent(containerName,"buttonPlayNow");
|
||||||
buttonPlayNow.init(525, 180, 125);
|
buttonPlayNow.init(525, 180, 125);
|
||||||
|
|
||||||
|
|
||||||
xoffset=170;
|
xoffset=170;
|
||||||
// fog - o - war
|
// fog - o - war
|
||||||
// @350 ? 300 ?
|
// @350 ? 300 ?
|
||||||
|
|
||||||
|
labelFogOfWar.registerGraphicComponent(containerName,"labelFogOfWar");
|
||||||
labelFogOfWar.init(xoffset+150, aHeadPos, 80);
|
labelFogOfWar.init(xoffset+150, aHeadPos, 80);
|
||||||
labelFogOfWar.setText(lang.get("FogOfWar"));
|
labelFogOfWar.setText(lang.get("FogOfWar"));
|
||||||
|
|
||||||
|
listBoxFogOfWar.registerGraphicComponent(containerName,"listBoxFogOfWar");
|
||||||
listBoxFogOfWar.init(xoffset+150, aPos, 80);
|
listBoxFogOfWar.init(xoffset+150, aPos, 80);
|
||||||
listBoxFogOfWar.pushBackItem(lang.get("Yes"));
|
listBoxFogOfWar.pushBackItem(lang.get("Yes"));
|
||||||
listBoxFogOfWar.pushBackItem(lang.get("No"));
|
listBoxFogOfWar.pushBackItem(lang.get("No"));
|
||||||
|
@ -110,8 +121,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
listBoxFogOfWar.setEditable(false);
|
listBoxFogOfWar.setEditable(false);
|
||||||
|
|
||||||
|
|
||||||
|
labelAllowObservers.registerGraphicComponent(containerName,"labelAllowObservers");
|
||||||
labelAllowObservers.init(xoffset+50, aHeadPos, 80);
|
labelAllowObservers.init(xoffset+50, aHeadPos, 80);
|
||||||
labelAllowObservers.setText(lang.get("AllowObservers"));
|
labelAllowObservers.setText(lang.get("AllowObservers"));
|
||||||
|
|
||||||
|
listBoxAllowObservers.registerGraphicComponent(containerName,"listBoxAllowObservers");
|
||||||
listBoxAllowObservers.init(xoffset+50, aPos, 80);
|
listBoxAllowObservers.init(xoffset+50, aPos, 80);
|
||||||
listBoxAllowObservers.pushBackItem(lang.get("No"));
|
listBoxAllowObservers.pushBackItem(lang.get("No"));
|
||||||
listBoxAllowObservers.pushBackItem(lang.get("Yes"));
|
listBoxAllowObservers.pushBackItem(lang.get("Yes"));
|
||||||
|
@ -120,7 +134,10 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
|
|
||||||
// Enable Observer Mode
|
// Enable Observer Mode
|
||||||
|
labelEnableObserverMode.registerGraphicComponent(containerName,"labelEnableObserverMode");
|
||||||
labelEnableObserverMode.init(xoffset+250, aHeadPos, 80);
|
labelEnableObserverMode.init(xoffset+250, aHeadPos, 80);
|
||||||
|
|
||||||
|
listBoxEnableObserverMode.registerGraphicComponent(containerName,"listBoxEnableObserverMode");
|
||||||
listBoxEnableObserverMode.init(xoffset+250, aPos, 110);
|
listBoxEnableObserverMode.init(xoffset+250, aPos, 110);
|
||||||
listBoxEnableObserverMode.pushBackItem(lang.get("Yes"));
|
listBoxEnableObserverMode.pushBackItem(lang.get("Yes"));
|
||||||
listBoxEnableObserverMode.pushBackItem(lang.get("No"));
|
listBoxEnableObserverMode.pushBackItem(lang.get("No"));
|
||||||
|
@ -128,8 +145,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
listBoxEnableObserverMode.setEditable(false);
|
listBoxEnableObserverMode.setEditable(false);
|
||||||
labelEnableObserverMode.setText(lang.get("EnableObserverMode"));
|
labelEnableObserverMode.setText(lang.get("EnableObserverMode"));
|
||||||
|
|
||||||
|
labelPathFinderType.registerGraphicComponent(containerName,"labelPathFinderType");
|
||||||
labelPathFinderType.init(xoffset+450, aHeadPos, 80);
|
labelPathFinderType.init(xoffset+450, aHeadPos, 80);
|
||||||
labelPathFinderType.setText(lang.get("PathFinderType"));
|
labelPathFinderType.setText(lang.get("PathFinderType"));
|
||||||
|
|
||||||
|
listBoxPathFinderType.registerGraphicComponent(containerName,"listBoxPathFinderType");
|
||||||
listBoxPathFinderType.init(xoffset+450, aPos, 150);
|
listBoxPathFinderType.init(xoffset+450, aPos, 150);
|
||||||
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRegular"));
|
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRegular"));
|
||||||
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRoutePlanner"));
|
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRoutePlanner"));
|
||||||
|
@ -138,8 +158,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
// Network Frame Period
|
// Network Frame Period
|
||||||
xoffset=0;
|
xoffset=0;
|
||||||
|
labelNetworkFramePeriod.registerGraphicComponent(containerName,"labelNetworkFramePeriod");
|
||||||
labelNetworkFramePeriod.init(xoffset+170, networkHeadPos, 80);
|
labelNetworkFramePeriod.init(xoffset+170, networkHeadPos, 80);
|
||||||
labelNetworkFramePeriod.setText(lang.get("NetworkFramePeriod"));
|
labelNetworkFramePeriod.setText(lang.get("NetworkFramePeriod"));
|
||||||
|
|
||||||
|
listBoxNetworkFramePeriod.registerGraphicComponent(containerName,"listBoxNetworkFramePeriod");
|
||||||
listBoxNetworkFramePeriod.init(xoffset+170, networkPos, 80);
|
listBoxNetworkFramePeriod.init(xoffset+170, networkPos, 80);
|
||||||
listBoxNetworkFramePeriod.pushBackItem("10");
|
listBoxNetworkFramePeriod.pushBackItem("10");
|
||||||
listBoxNetworkFramePeriod.pushBackItem("20");
|
listBoxNetworkFramePeriod.pushBackItem("20");
|
||||||
|
@ -149,8 +172,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
listBoxNetworkFramePeriod.setEditable(false);
|
listBoxNetworkFramePeriod.setEditable(false);
|
||||||
|
|
||||||
// Network Frame Period
|
// Network Frame Period
|
||||||
|
labelNetworkPauseGameForLaggedClients.registerGraphicComponent(containerName,"labelNetworkPauseGameForLaggedClients");
|
||||||
labelNetworkPauseGameForLaggedClients.init(xoffset+420, networkHeadPos, 80);
|
labelNetworkPauseGameForLaggedClients.init(xoffset+420, networkHeadPos, 80);
|
||||||
labelNetworkPauseGameForLaggedClients.setText(lang.get("NetworkPauseGameForLaggedClients"));
|
labelNetworkPauseGameForLaggedClients.setText(lang.get("NetworkPauseGameForLaggedClients"));
|
||||||
|
|
||||||
|
listBoxNetworkPauseGameForLaggedClients.registerGraphicComponent(containerName,"listBoxNetworkPauseGameForLaggedClients");
|
||||||
listBoxNetworkPauseGameForLaggedClients.init(xoffset+420, networkPos, 80);
|
listBoxNetworkPauseGameForLaggedClients.init(xoffset+420, networkPos, 80);
|
||||||
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("No"));
|
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("No"));
|
||||||
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("Yes"));
|
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("Yes"));
|
||||||
|
@ -159,8 +185,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
|
|
||||||
// Enable Server Controlled AI
|
// Enable Server Controlled AI
|
||||||
|
labelEnableServerControlledAI.registerGraphicComponent(containerName,"labelEnableServerControlledAI");
|
||||||
labelEnableServerControlledAI.init(xoffset+640, networkHeadPos, 80);
|
labelEnableServerControlledAI.init(xoffset+640, networkHeadPos, 80);
|
||||||
labelEnableServerControlledAI.setText(lang.get("EnableServerControlledAI"));
|
labelEnableServerControlledAI.setText(lang.get("EnableServerControlledAI"));
|
||||||
|
|
||||||
|
listBoxEnableServerControlledAI.registerGraphicComponent(containerName,"listBoxEnableServerControlledAI");
|
||||||
listBoxEnableServerControlledAI.init(xoffset+640, networkPos, 80);
|
listBoxEnableServerControlledAI.init(xoffset+640, networkPos, 80);
|
||||||
listBoxEnableServerControlledAI.pushBackItem(lang.get("Yes"));
|
listBoxEnableServerControlledAI.pushBackItem(lang.get("Yes"));
|
||||||
listBoxEnableServerControlledAI.pushBackItem(lang.get("No"));
|
listBoxEnableServerControlledAI.pushBackItem(lang.get("No"));
|
||||||
|
@ -171,17 +200,23 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
//map listBox
|
//map listBox
|
||||||
// put them all in a set, to weed out duplicates (gbm & mgm with same name)
|
// put them all in a set, to weed out duplicates (gbm & mgm with same name)
|
||||||
// will also ensure they are alphabetically listed (rather than how the OS provides them)
|
// will also ensure they are alphabetically listed (rather than how the OS provides them)
|
||||||
|
listBoxMap.registerGraphicComponent(containerName,"listBoxMap");
|
||||||
listBoxMap.init(xoffset+100, mapPos, 200);
|
listBoxMap.init(xoffset+100, mapPos, 200);
|
||||||
listBoxMap.setEditable(false);
|
listBoxMap.setEditable(false);
|
||||||
|
|
||||||
|
labelMap.registerGraphicComponent(containerName,"labelMap");
|
||||||
labelMap.init(xoffset+100, mapHeadPos);
|
labelMap.init(xoffset+100, mapHeadPos);
|
||||||
labelMap.setText(lang.get("Map"));
|
labelMap.setText(lang.get("Map"));
|
||||||
|
|
||||||
//tileset listBox
|
//tileset listBox
|
||||||
//listBoxTileset.init(500, 260, 150);
|
//listBoxTileset.init(500, 260, 150);
|
||||||
|
listBoxTileset.registerGraphicComponent(containerName,"listBoxTileset");
|
||||||
listBoxTileset.init(xoffset+350, mapPos, 150);
|
listBoxTileset.init(xoffset+350, mapPos, 150);
|
||||||
listBoxTileset.setEditable(false);
|
listBoxTileset.setEditable(false);
|
||||||
//listBoxTileset.setItems(results);
|
//listBoxTileset.setItems(results);
|
||||||
//labelTileset.init(500, 290);
|
//labelTileset.init(500, 290);
|
||||||
|
|
||||||
|
labelTileset.registerGraphicComponent(containerName,"labelTileset");
|
||||||
labelTileset.init(xoffset+350, mapHeadPos);
|
labelTileset.init(xoffset+350, mapHeadPos);
|
||||||
labelTileset.setText(lang.get("Tileset"));
|
labelTileset.setText(lang.get("Tileset"));
|
||||||
|
|
||||||
|
@ -191,7 +226,11 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
listBoxTechTree.setEditable(false);
|
listBoxTechTree.setEditable(false);
|
||||||
//listBoxTechTree.setItems(results);
|
//listBoxTechTree.setItems(results);
|
||||||
//labelTechTree.init(700, 290);
|
//labelTechTree.init(700, 290);
|
||||||
|
|
||||||
|
listBoxTechTree.registerGraphicComponent(containerName,"listBoxTechTree");
|
||||||
listBoxTechTree.init(xoffset+550, mapPos, 150);
|
listBoxTechTree.init(xoffset+550, mapPos, 150);
|
||||||
|
|
||||||
|
labelTechTree.registerGraphicComponent(containerName,"labelTechTree");
|
||||||
labelTechTree.init(xoffset+550, mapHeadPos);
|
labelTechTree.init(xoffset+550, mapHeadPos);
|
||||||
labelTechTree.setText(lang.get("TechTree"));
|
labelTechTree.setText(lang.get("TechTree"));
|
||||||
|
|
||||||
|
@ -201,27 +240,42 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
xoffset=120;
|
xoffset=120;
|
||||||
int rowHeight=27;
|
int rowHeight=27;
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
||||||
|
labelPlayers[i].registerGraphicComponent(containerName,"labelPlayers" + intToStr(i));
|
||||||
labelPlayers[i].init(xoffset+50, setupPos-30-i*rowHeight);
|
labelPlayers[i].init(xoffset+50, setupPos-30-i*rowHeight);
|
||||||
labelPlayers[i].setEditable(false);
|
labelPlayers[i].setEditable(false);
|
||||||
|
|
||||||
|
labelPlayerNames[i].registerGraphicComponent(containerName,"labelPlayerNames" + intToStr(i));
|
||||||
labelPlayerNames[i].init(xoffset+100,setupPos-30-i*rowHeight);
|
labelPlayerNames[i].init(xoffset+100,setupPos-30-i*rowHeight);
|
||||||
|
|
||||||
|
listBoxControls[i].registerGraphicComponent(containerName,"listBoxControls" + intToStr(i));
|
||||||
listBoxControls[i].init(xoffset+200, setupPos-30-i*rowHeight);
|
listBoxControls[i].init(xoffset+200, setupPos-30-i*rowHeight);
|
||||||
listBoxControls[i].setEditable(false);
|
listBoxControls[i].setEditable(false);
|
||||||
|
|
||||||
|
listBoxFactions[i].registerGraphicComponent(containerName,"listBoxFactions" + intToStr(i));
|
||||||
listBoxFactions[i].init(xoffset+350, setupPos-30-i*rowHeight);
|
listBoxFactions[i].init(xoffset+350, setupPos-30-i*rowHeight);
|
||||||
listBoxFactions[i].setEditable(false);
|
listBoxFactions[i].setEditable(false);
|
||||||
|
|
||||||
|
listBoxTeams[i].registerGraphicComponent(containerName,"listBoxTeams" + intToStr(i));
|
||||||
listBoxTeams[i].init(xoffset+520, setupPos-30-i*rowHeight, 60);
|
listBoxTeams[i].init(xoffset+520, setupPos-30-i*rowHeight, 60);
|
||||||
listBoxTeams[i].setEditable(false);
|
listBoxTeams[i].setEditable(false);
|
||||||
|
|
||||||
|
labelNetStatus[i].registerGraphicComponent(containerName,"labelNetStatus" + intToStr(i));
|
||||||
labelNetStatus[i].init(xoffset+600, setupPos-30-i*rowHeight, 60);
|
labelNetStatus[i].init(xoffset+600, setupPos-30-i*rowHeight, 60);
|
||||||
|
|
||||||
|
grabSlotButton[i].registerGraphicComponent(containerName,"grabSlotButton" + intToStr(i));
|
||||||
grabSlotButton[i].init(xoffset+600, setupPos-30-i*rowHeight, 30);
|
grabSlotButton[i].init(xoffset+600, setupPos-30-i*rowHeight, 30);
|
||||||
grabSlotButton[i].setText(">");
|
grabSlotButton[i].setText(">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
labelControl.registerGraphicComponent(containerName,"labelControl");
|
||||||
labelControl.init(xoffset+200, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
labelControl.init(xoffset+200, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||||
labelControl.setText(lang.get("Control"));
|
labelControl.setText(lang.get("Control"));
|
||||||
|
|
||||||
|
labelFaction.registerGraphicComponent(containerName,"labelFaction");
|
||||||
labelFaction.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
labelFaction.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||||
labelFaction.setText(lang.get("Faction"));
|
labelFaction.setText(lang.get("Faction"));
|
||||||
|
|
||||||
|
labelTeam.registerGraphicComponent(containerName,"labelTeam");
|
||||||
labelTeam.init(xoffset+520, setupPos, 60, GraphicListBox::defH, true);
|
labelTeam.init(xoffset+520, setupPos, 60, GraphicListBox::defH, true);
|
||||||
labelTeam.setText(lang.get("Team"));
|
labelTeam.setText(lang.get("Team"));
|
||||||
|
|
||||||
|
@ -266,6 +320,9 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
listBoxControls[0].setSelectedItemIndex(ctHuman);
|
listBoxControls[0].setSelectedItemIndex(ctHuman);
|
||||||
|
|
||||||
chatManager.init(&console, -1,true);
|
chatManager.init(&console, -1,true);
|
||||||
|
|
||||||
|
GraphicComponent::applyAllCustomProperties(containerName);
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuStateConnectedGame::~MenuStateConnectedGame() {
|
MenuStateConnectedGame::~MenuStateConnectedGame() {
|
||||||
|
|
|
@ -30,8 +30,9 @@ enum JoinMenu{
|
||||||
// class MenuStateConnectedGame
|
// class MenuStateConnectedGame
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
class MenuStateConnectedGame: public MenuState{
|
class MenuStateConnectedGame: public MenuState {
|
||||||
private:
|
private:
|
||||||
|
static const char *containerName;
|
||||||
GraphicButton buttonDisconnect;
|
GraphicButton buttonDisconnect;
|
||||||
GraphicButton buttonPlayNow;
|
GraphicButton buttonPlayNow;
|
||||||
GraphicLabel labelControl;
|
GraphicLabel labelControl;
|
||||||
|
|
|
@ -45,6 +45,8 @@ struct FormatString {
|
||||||
// class MenuStateCustomGame
|
// class MenuStateCustomGame
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
|
const char *MenuStateCustomGame::containerName = "CustomGame";
|
||||||
|
|
||||||
MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, bool openNetworkSlots,bool parentMenuIsMasterserver):
|
MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, bool openNetworkSlots,bool parentMenuIsMasterserver):
|
||||||
MenuState(program, mainMenu, "new-game")
|
MenuState(program, mainMenu, "new-game")
|
||||||
{
|
{
|
||||||
|
@ -65,6 +67,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
|
|
||||||
showFullConsole=false;
|
showFullConsole=false;
|
||||||
|
|
||||||
|
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||||
mainMessageBox.init(lang.get("Ok"));
|
mainMessageBox.init(lang.get("Ok"));
|
||||||
mainMessageBox.setEnabled(false);
|
mainMessageBox.setEnabled(false);
|
||||||
mainMessageBoxState=0;
|
mainMessageBoxState=0;
|
||||||
|
@ -106,8 +109,13 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
vector<string> teamItems, controlItems, results;
|
vector<string> teamItems, controlItems, results;
|
||||||
|
|
||||||
//create
|
//create
|
||||||
|
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
||||||
buttonReturn.init(250, 180, 125);
|
buttonReturn.init(250, 180, 125);
|
||||||
|
|
||||||
|
buttonRestoreLastSettings.registerGraphicComponent(containerName,"buttonRestoreLastSettings");
|
||||||
buttonRestoreLastSettings.init(250+130, 180, 200);
|
buttonRestoreLastSettings.init(250+130, 180, 200);
|
||||||
|
|
||||||
|
buttonPlayNow.registerGraphicComponent(containerName,"buttonPlayNow");
|
||||||
buttonPlayNow.init(250+130+205, 180, 125);
|
buttonPlayNow.init(250+130+205, 180, 125);
|
||||||
|
|
||||||
int labelOffset=23;
|
int labelOffset=23;
|
||||||
|
@ -148,6 +156,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
formattedPlayerSortedMaps[mapInfo.players].push_back(formatString(mapFiles.at(i)));
|
formattedPlayerSortedMaps[mapInfo.players].push_back(formatString(mapFiles.at(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
labelLocalIP.registerGraphicComponent(containerName,"labelLocalIP");
|
||||||
labelLocalIP.init(410, networkHeadPos+labelOffset);
|
labelLocalIP.init(410, networkHeadPos+labelOffset);
|
||||||
|
|
||||||
string ipText = "none";
|
string ipText = "none";
|
||||||
|
@ -166,15 +175,23 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
|
|
||||||
// Map
|
// Map
|
||||||
xoffset=70;
|
xoffset=70;
|
||||||
|
labelMap.registerGraphicComponent(containerName,"labelMap");
|
||||||
labelMap.init(xoffset+100, mapHeadPos);
|
labelMap.init(xoffset+100, mapHeadPos);
|
||||||
labelMap.setText(lang.get("Map")+":");
|
labelMap.setText(lang.get("Map")+":");
|
||||||
|
|
||||||
|
listBoxMap.registerGraphicComponent(containerName,"listBoxMap");
|
||||||
listBoxMap.init(xoffset+100, mapPos, 200);
|
listBoxMap.init(xoffset+100, mapPos, 200);
|
||||||
listBoxMap.setItems(formattedPlayerSortedMaps[0]);
|
listBoxMap.setItems(formattedPlayerSortedMaps[0]);
|
||||||
|
|
||||||
|
labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo");
|
||||||
labelMapInfo.init(xoffset+100, mapPos-labelOffset, 200, 40);
|
labelMapInfo.init(xoffset+100, mapPos-labelOffset, 200, 40);
|
||||||
|
|
||||||
// MapFilter
|
// MapFilter
|
||||||
|
labelMapFilter.registerGraphicComponent(containerName,"labelMapFilter");
|
||||||
labelMapFilter.init(xoffset+310, mapHeadPos);
|
labelMapFilter.init(xoffset+310, mapHeadPos);
|
||||||
labelMapFilter.setText(lang.get("MapFilter")+":");
|
labelMapFilter.setText(lang.get("MapFilter")+":");
|
||||||
|
|
||||||
|
listBoxMapFilter.registerGraphicComponent(containerName,"listBoxMapFilter");
|
||||||
listBoxMapFilter.init(xoffset+310, mapPos, 80);
|
listBoxMapFilter.init(xoffset+310, mapPos, 80);
|
||||||
listBoxMapFilter.pushBackItem("-");
|
listBoxMapFilter.pushBackItem("-");
|
||||||
for(int i=1; i<GameConstants::maxPlayers+1; ++i){
|
for(int i=1; i<GameConstants::maxPlayers+1; ++i){
|
||||||
|
@ -189,8 +206,12 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
}
|
}
|
||||||
tilesetFiles= results;
|
tilesetFiles= results;
|
||||||
std::for_each(results.begin(), results.end(), FormatString());
|
std::for_each(results.begin(), results.end(), FormatString());
|
||||||
|
|
||||||
|
listBoxTileset.registerGraphicComponent(containerName,"listBoxTileset");
|
||||||
listBoxTileset.init(xoffset+460, mapPos, 150);
|
listBoxTileset.init(xoffset+460, mapPos, 150);
|
||||||
listBoxTileset.setItems(results);
|
listBoxTileset.setItems(results);
|
||||||
|
|
||||||
|
labelTileset.registerGraphicComponent(containerName,"labelTileset");
|
||||||
labelTileset.init(xoffset+460, mapHeadPos);
|
labelTileset.init(xoffset+460, mapHeadPos);
|
||||||
labelTileset.setText(lang.get("Tileset"));
|
labelTileset.setText(lang.get("Tileset"));
|
||||||
|
|
||||||
|
@ -202,14 +223,21 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
}
|
}
|
||||||
techTreeFiles= results;
|
techTreeFiles= results;
|
||||||
std::for_each(results.begin(), results.end(), FormatString());
|
std::for_each(results.begin(), results.end(), FormatString());
|
||||||
|
|
||||||
|
listBoxTechTree.registerGraphicComponent(containerName,"listBoxTechTree");
|
||||||
listBoxTechTree.init(xoffset+650, mapPos, 150);
|
listBoxTechTree.init(xoffset+650, mapPos, 150);
|
||||||
listBoxTechTree.setItems(results);
|
listBoxTechTree.setItems(results);
|
||||||
|
|
||||||
|
labelTechTree.registerGraphicComponent(containerName,"labelTechTree");
|
||||||
labelTechTree.init(xoffset+650, mapHeadPos);
|
labelTechTree.init(xoffset+650, mapHeadPos);
|
||||||
labelTechTree.setText(lang.get("TechTree"));
|
labelTechTree.setText(lang.get("TechTree"));
|
||||||
|
|
||||||
// Allow Observers
|
// Allow Observers
|
||||||
|
labelAllowObservers.registerGraphicComponent(containerName,"labelAllowObservers");
|
||||||
labelAllowObservers.init(xoffset+100, aHeadPos, 80);
|
labelAllowObservers.init(xoffset+100, aHeadPos, 80);
|
||||||
labelAllowObservers.setText(lang.get("AllowObservers"));
|
labelAllowObservers.setText(lang.get("AllowObservers"));
|
||||||
|
|
||||||
|
listBoxAllowObservers.registerGraphicComponent(containerName,"listBoxAllowObservers");
|
||||||
listBoxAllowObservers.init(xoffset+100, aPos, 80);
|
listBoxAllowObservers.init(xoffset+100, aPos, 80);
|
||||||
listBoxAllowObservers.pushBackItem(lang.get("No"));
|
listBoxAllowObservers.pushBackItem(lang.get("No"));
|
||||||
listBoxAllowObservers.pushBackItem(lang.get("Yes"));
|
listBoxAllowObservers.pushBackItem(lang.get("Yes"));
|
||||||
|
@ -217,31 +245,43 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
|
|
||||||
// fog - o - war
|
// fog - o - war
|
||||||
// @350 ? 300 ?
|
// @350 ? 300 ?
|
||||||
|
labelFogOfWar.registerGraphicComponent(containerName,"labelFogOfWar");
|
||||||
labelFogOfWar.init(xoffset+310, aHeadPos, 80);
|
labelFogOfWar.init(xoffset+310, aHeadPos, 80);
|
||||||
labelFogOfWar.setText(lang.get("FogOfWar"));
|
labelFogOfWar.setText(lang.get("FogOfWar"));
|
||||||
|
|
||||||
|
listBoxFogOfWar.registerGraphicComponent(containerName,"listBoxFogOfWar");
|
||||||
listBoxFogOfWar.init(xoffset+310, aPos, 80);
|
listBoxFogOfWar.init(xoffset+310, aPos, 80);
|
||||||
listBoxFogOfWar.pushBackItem(lang.get("Yes"));
|
listBoxFogOfWar.pushBackItem(lang.get("Yes"));
|
||||||
listBoxFogOfWar.pushBackItem(lang.get("No"));
|
listBoxFogOfWar.pushBackItem(lang.get("No"));
|
||||||
listBoxFogOfWar.setSelectedItemIndex(0);
|
listBoxFogOfWar.setSelectedItemIndex(0);
|
||||||
|
|
||||||
// View Map At End Of Game
|
// View Map At End Of Game
|
||||||
|
labelEnableObserverMode.registerGraphicComponent(containerName,"labelEnableObserverMode");
|
||||||
labelEnableObserverMode.init(xoffset+460, aHeadPos, 80);
|
labelEnableObserverMode.init(xoffset+460, aHeadPos, 80);
|
||||||
|
|
||||||
|
listBoxEnableObserverMode.registerGraphicComponent(containerName,"listBoxEnableObserverMode");
|
||||||
listBoxEnableObserverMode.init(xoffset+460, aPos, 80);
|
listBoxEnableObserverMode.init(xoffset+460, aPos, 80);
|
||||||
listBoxEnableObserverMode.pushBackItem(lang.get("Yes"));
|
listBoxEnableObserverMode.pushBackItem(lang.get("Yes"));
|
||||||
listBoxEnableObserverMode.pushBackItem(lang.get("No"));
|
listBoxEnableObserverMode.pushBackItem(lang.get("No"));
|
||||||
listBoxEnableObserverMode.setSelectedItemIndex(0);
|
listBoxEnableObserverMode.setSelectedItemIndex(0);
|
||||||
|
|
||||||
// Which Pathfinder
|
// Which Pathfinder
|
||||||
|
labelPathFinderType.registerGraphicComponent(containerName,"labelPathFinderType");
|
||||||
labelPathFinderType.init(xoffset+650, aHeadPos, 80);
|
labelPathFinderType.init(xoffset+650, aHeadPos, 80);
|
||||||
labelPathFinderType.setText(lang.get("PathFinderType"));
|
labelPathFinderType.setText(lang.get("PathFinderType"));
|
||||||
|
|
||||||
|
listBoxPathFinderType.registerGraphicComponent(containerName,"listBoxPathFinderType");
|
||||||
listBoxPathFinderType.init(xoffset+650, aPos, 150);
|
listBoxPathFinderType.init(xoffset+650, aPos, 150);
|
||||||
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRegular"));
|
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRegular"));
|
||||||
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRoutePlanner"));
|
listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRoutePlanner"));
|
||||||
listBoxPathFinderType.setSelectedItemIndex(0);
|
listBoxPathFinderType.setSelectedItemIndex(0);
|
||||||
|
|
||||||
// Advanced Options
|
// Advanced Options
|
||||||
|
labelAdvanced.registerGraphicComponent(containerName,"labelAdvanced");
|
||||||
labelAdvanced.init(810, 80, 80);
|
labelAdvanced.init(810, 80, 80);
|
||||||
labelAdvanced.setText(lang.get("AdvancedGameOptions"));
|
labelAdvanced.setText(lang.get("AdvancedGameOptions"));
|
||||||
|
|
||||||
|
listBoxAdvanced.registerGraphicComponent(containerName,"listBoxAdvanced");
|
||||||
listBoxAdvanced.init(810, 80-labelOffset, 80);
|
listBoxAdvanced.init(810, 80-labelOffset, 80);
|
||||||
listBoxAdvanced.pushBackItem(lang.get("No"));
|
listBoxAdvanced.pushBackItem(lang.get("No"));
|
||||||
listBoxAdvanced.pushBackItem(lang.get("Yes"));
|
listBoxAdvanced.pushBackItem(lang.get("Yes"));
|
||||||
|
@ -253,8 +293,12 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
xoffset=0;
|
xoffset=0;
|
||||||
else
|
else
|
||||||
xoffset=90;
|
xoffset=90;
|
||||||
|
|
||||||
|
labelPublishServer.registerGraphicComponent(containerName,"labelPublishServer");
|
||||||
labelPublishServer.init(xoffset+50, networkHeadPos, 100);
|
labelPublishServer.init(xoffset+50, networkHeadPos, 100);
|
||||||
labelPublishServer.setText(lang.get("PublishServer"));
|
labelPublishServer.setText(lang.get("PublishServer"));
|
||||||
|
|
||||||
|
listBoxPublishServer.registerGraphicComponent(containerName,"listBoxPublishServer");
|
||||||
listBoxPublishServer.init(xoffset+50, networkPos, 100);
|
listBoxPublishServer.init(xoffset+50, networkPos, 100);
|
||||||
listBoxPublishServer.pushBackItem(lang.get("Yes"));
|
listBoxPublishServer.pushBackItem(lang.get("Yes"));
|
||||||
listBoxPublishServer.pushBackItem(lang.get("No"));
|
listBoxPublishServer.pushBackItem(lang.get("No"));
|
||||||
|
@ -264,9 +308,11 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
listBoxPublishServer.setSelectedItemIndex(1);
|
listBoxPublishServer.setSelectedItemIndex(1);
|
||||||
|
|
||||||
// Port
|
// Port
|
||||||
|
labelPublishServerExternalPort.registerGraphicComponent(containerName,"labelPublishServerExternalPort");
|
||||||
labelPublishServerExternalPort.init(xoffset+210, networkHeadPos, 150);
|
labelPublishServerExternalPort.init(xoffset+210, networkHeadPos, 150);
|
||||||
labelPublishServerExternalPort.setText(lang.get("PublishServerExternalPort"));
|
labelPublishServerExternalPort.setText(lang.get("PublishServerExternalPort"));
|
||||||
|
|
||||||
|
listBoxPublishServerExternalPort.registerGraphicComponent(containerName,"listBoxPublishServerExternalPort");
|
||||||
listBoxPublishServerExternalPort.init(xoffset+210, networkPos, 100);
|
listBoxPublishServerExternalPort.init(xoffset+210, networkPos, 100);
|
||||||
string supportExternalPortList = config.getString("MasterServerExternalPortList",intToStr(GameConstants::serverPort).c_str());
|
string supportExternalPortList = config.getString("MasterServerExternalPortList",intToStr(GameConstants::serverPort).c_str());
|
||||||
std::vector<std::string> externalPortList;
|
std::vector<std::string> externalPortList;
|
||||||
|
@ -281,8 +327,11 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
//listBoxPublishServer.setSelectedItemIndex(0);
|
//listBoxPublishServer.setSelectedItemIndex(0);
|
||||||
|
|
||||||
// Network Frame Period
|
// Network Frame Period
|
||||||
|
labelNetworkFramePeriod.registerGraphicComponent(containerName,"labelNetworkFramePeriod");
|
||||||
labelNetworkFramePeriod.init(xoffset+350, networkHeadPos, 80);
|
labelNetworkFramePeriod.init(xoffset+350, networkHeadPos, 80);
|
||||||
labelNetworkFramePeriod.setText(lang.get("NetworkFramePeriod"));
|
labelNetworkFramePeriod.setText(lang.get("NetworkFramePeriod"));
|
||||||
|
|
||||||
|
listBoxNetworkFramePeriod.registerGraphicComponent(containerName,"listBoxNetworkFramePeriod");
|
||||||
listBoxNetworkFramePeriod.init(xoffset+350, networkPos, 80);
|
listBoxNetworkFramePeriod.init(xoffset+350, networkPos, 80);
|
||||||
listBoxNetworkFramePeriod.pushBackItem("10");
|
listBoxNetworkFramePeriod.pushBackItem("10");
|
||||||
listBoxNetworkFramePeriod.pushBackItem("20");
|
listBoxNetworkFramePeriod.pushBackItem("20");
|
||||||
|
@ -291,8 +340,11 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
listBoxNetworkFramePeriod.setSelectedItem("20");
|
listBoxNetworkFramePeriod.setSelectedItem("20");
|
||||||
|
|
||||||
// Network Frame Period
|
// Network Frame Period
|
||||||
|
labelNetworkPauseGameForLaggedClients.registerGraphicComponent(containerName,"labelNetworkPauseGameForLaggedClients");
|
||||||
labelNetworkPauseGameForLaggedClients.init(xoffset+520, networkHeadPos, 80);
|
labelNetworkPauseGameForLaggedClients.init(xoffset+520, networkHeadPos, 80);
|
||||||
labelNetworkPauseGameForLaggedClients.setText(lang.get("NetworkPauseGameForLaggedClients"));
|
labelNetworkPauseGameForLaggedClients.setText(lang.get("NetworkPauseGameForLaggedClients"));
|
||||||
|
|
||||||
|
listBoxNetworkPauseGameForLaggedClients.registerGraphicComponent(containerName,"listBoxNetworkPauseGameForLaggedClients");
|
||||||
listBoxNetworkPauseGameForLaggedClients.init(xoffset+520, networkPos, 80);
|
listBoxNetworkPauseGameForLaggedClients.init(xoffset+520, networkPos, 80);
|
||||||
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("No"));
|
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("No"));
|
||||||
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("Yes"));
|
listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("Yes"));
|
||||||
|
@ -300,8 +352,11 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
|
|
||||||
|
|
||||||
// Enable Server Controlled AI
|
// Enable Server Controlled AI
|
||||||
|
labelEnableServerControlledAI.registerGraphicComponent(containerName,"labelEnableServerControlledAI");
|
||||||
labelEnableServerControlledAI.init(xoffset+670, networkHeadPos, 80);
|
labelEnableServerControlledAI.init(xoffset+670, networkHeadPos, 80);
|
||||||
labelEnableServerControlledAI.setText(lang.get("EnableServerControlledAI"));
|
labelEnableServerControlledAI.setText(lang.get("EnableServerControlledAI"));
|
||||||
|
|
||||||
|
listBoxEnableServerControlledAI.registerGraphicComponent(containerName,"listBoxEnableServerControlledAI");
|
||||||
listBoxEnableServerControlledAI.init(xoffset+670, networkPos, 80);
|
listBoxEnableServerControlledAI.init(xoffset+670, networkPos, 80);
|
||||||
listBoxEnableServerControlledAI.pushBackItem(lang.get("Yes"));
|
listBoxEnableServerControlledAI.pushBackItem(lang.get("Yes"));
|
||||||
listBoxEnableServerControlledAI.pushBackItem(lang.get("No"));
|
listBoxEnableServerControlledAI.pushBackItem(lang.get("No"));
|
||||||
|
@ -311,20 +366,34 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
xoffset=120;
|
xoffset=120;
|
||||||
int rowHeight=27;
|
int rowHeight=27;
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
||||||
|
labelPlayers[i].registerGraphicComponent(containerName,"labelPlayers" + intToStr(i));
|
||||||
labelPlayers[i].init(xoffset+50, setupPos-30-i*rowHeight);
|
labelPlayers[i].init(xoffset+50, setupPos-30-i*rowHeight);
|
||||||
|
|
||||||
|
labelPlayerNames[i].registerGraphicComponent(containerName,"labelPlayerNames" + intToStr(i));
|
||||||
labelPlayerNames[i].init(xoffset+100,setupPos-30-i*rowHeight);
|
labelPlayerNames[i].init(xoffset+100,setupPos-30-i*rowHeight);
|
||||||
|
|
||||||
|
listBoxControls[i].registerGraphicComponent(containerName,"listBoxControls" + intToStr(i));
|
||||||
listBoxControls[i].init(xoffset+200, setupPos-30-i*rowHeight);
|
listBoxControls[i].init(xoffset+200, setupPos-30-i*rowHeight);
|
||||||
|
|
||||||
|
listBoxFactions[i].registerGraphicComponent(containerName,"listBoxFactions" + intToStr(i));
|
||||||
listBoxFactions[i].init(xoffset+350, setupPos-30-i*rowHeight, 150);
|
listBoxFactions[i].init(xoffset+350, setupPos-30-i*rowHeight, 150);
|
||||||
|
|
||||||
|
listBoxTeams[i].registerGraphicComponent(containerName,"listBoxTeams" + intToStr(i));
|
||||||
listBoxTeams[i].init(xoffset+520, setupPos-30-i*rowHeight, 60);
|
listBoxTeams[i].init(xoffset+520, setupPos-30-i*rowHeight, 60);
|
||||||
|
|
||||||
|
labelNetStatus[i].registerGraphicComponent(containerName,"labelNetStatus" + intToStr(i));
|
||||||
labelNetStatus[i].init(xoffset+600, setupPos-30-i*rowHeight, 60);
|
labelNetStatus[i].init(xoffset+600, setupPos-30-i*rowHeight, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
labelControl.registerGraphicComponent(containerName,"labelControl");
|
||||||
labelControl.init(xoffset+200, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
labelControl.init(xoffset+200, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||||
labelControl.setText(lang.get("Control"));
|
labelControl.setText(lang.get("Control"));
|
||||||
|
|
||||||
|
labelFaction.registerGraphicComponent(containerName,"labelFaction");
|
||||||
labelFaction.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
labelFaction.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||||
labelFaction.setText(lang.get("Faction"));
|
labelFaction.setText(lang.get("Faction"));
|
||||||
|
|
||||||
|
labelTeam.registerGraphicComponent(containerName,"labelTeam");
|
||||||
labelTeam.init(xoffset+520, setupPos, 50, GraphicListBox::defH, true);
|
labelTeam.init(xoffset+520, setupPos, 50, GraphicListBox::defH, true);
|
||||||
labelTeam.setText(lang.get("Team"));
|
labelTeam.setText(lang.get("Team"));
|
||||||
|
|
||||||
|
@ -423,6 +492,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
//chatManager.init(&console, world.getThisTeamIndex());
|
//chatManager.init(&console, world.getThisTeamIndex());
|
||||||
chatManager.init(&console, -1,true);
|
chatManager.init(&console, -1,true);
|
||||||
|
|
||||||
|
GraphicComponent::applyAllCustomProperties(containerName);
|
||||||
|
|
||||||
publishToMasterserverThread = new SimpleTaskThread(this,0,25);
|
publishToMasterserverThread = new SimpleTaskThread(this,0,25);
|
||||||
publishToMasterserverThread->setUniqueID(__FILE__);
|
publishToMasterserverThread->setUniqueID(__FILE__);
|
||||||
publishToMasterserverThread->start();
|
publishToMasterserverThread->start();
|
||||||
|
|
|
@ -24,6 +24,9 @@ namespace Glest{ namespace Game{
|
||||||
|
|
||||||
class MenuStateCustomGame : public MenuState, public SimpleTaskCallbackInterface {
|
class MenuStateCustomGame : public MenuState, public SimpleTaskCallbackInterface {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static const char *containerName;
|
||||||
|
|
||||||
GraphicButton buttonReturn;
|
GraphicButton buttonReturn;
|
||||||
GraphicButton buttonPlayNow;
|
GraphicButton buttonPlayNow;
|
||||||
GraphicButton buttonRestoreLastSettings;
|
GraphicButton buttonRestoreLastSettings;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user