mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
loading the map after loading the assets
This commit is contained in:
@@ -17,7 +17,7 @@ gui = {
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
pos = {x = initPos.x, y = initPos.y + Size.y, z = initPos.z},
|
||||
size = Size,
|
||||
color = {x = 0, y = 0, z = 0, w = 1}
|
||||
color = {x = .3, y = .3, z = .3, w = 1}
|
||||
},
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
|
||||
Vendored
+1
-1
Submodule external/vb01 updated: 044828c7cf...89389589de
+5
-2
@@ -48,18 +48,21 @@ namespace battleship{
|
||||
Console::execute(wstringToString(textbox->getText()));
|
||||
}
|
||||
|
||||
InGameAppState::InGameAppState() : AbstractAppState(
|
||||
InGameAppState::InGameAppState(std::string mn) : AbstractAppState(
|
||||
AppStateType::IN_GAME_STATE,
|
||||
configData::calcSumBinds(AppStateType::IN_GAME_STATE, true),
|
||||
configData::calcSumBinds(AppStateType::IN_GAME_STATE, false),
|
||||
GameManager::getSingleton()->getPath() + scripts[(int)ScriptFiles::OPTIONS]
|
||||
),
|
||||
mapName(mn),
|
||||
playerId(0){}
|
||||
|
||||
void InGameAppState::onAttached() {
|
||||
AbstractAppState::onAttached();
|
||||
|
||||
Map::getSingleton()->loadPlayerGameObjects();
|
||||
Map *map = Map::getSingleton();
|
||||
map->load(mapName);
|
||||
map->loadPlayerGameObjects();
|
||||
|
||||
Camera *cam = Root::getSingleton()->getCamera();
|
||||
cam->setPosition(Map::getSingleton()->getSpawnPoint(playerId) + Vector3(1, 1, 1) * configData::CAMERA_DISTANCE);
|
||||
|
||||
+2
-1
@@ -39,7 +39,7 @@ namespace battleship{
|
||||
private:
|
||||
};
|
||||
|
||||
InGameAppState();
|
||||
InGameAppState(std::string);
|
||||
~InGameAppState(){}
|
||||
void onAttached();
|
||||
void onDettached();
|
||||
@@ -53,6 +53,7 @@ namespace battleship{
|
||||
std::vector<std::string> modelPaths;
|
||||
Player *mainPlayer;
|
||||
int playerId;
|
||||
std::string mapName = "";
|
||||
ActiveGameState* activeState;
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,8 +27,8 @@ namespace battleship{
|
||||
{}
|
||||
|
||||
void LoadingAppState::onDettached(){
|
||||
GameManager::getSingleton()->getStateManager()->attachAppState(newState);
|
||||
ConcreteGuiManager::getSingleton()->readLuaScreenScript(newScreen);
|
||||
GameManager::getSingleton()->getStateManager()->attachAppState(newState);
|
||||
|
||||
AbstractAppState::onDettached();
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,7 +18,6 @@ namespace battleship{
|
||||
PlayButton::PlayButton(Listbox *ml, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate), mapListbox(ml) {}
|
||||
|
||||
void PlayButton::onClick() {
|
||||
|
||||
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
|
||||
vector<Listbox*> factionsListboxes, difficultiesListboxes, colorsListboxes, teamsListboxes;
|
||||
|
||||
@@ -36,10 +35,7 @@ namespace battleship{
|
||||
|
||||
int selectedMap = mapListbox->getSelectedOption();
|
||||
string mapName = wstringToString(mapListbox->getContents()[selectedMap]);
|
||||
|
||||
Map *map = Map::getSingleton();
|
||||
map->load(mapName);
|
||||
int numPlayers = map->getNumSpawnPoints();
|
||||
int numPlayers = Map::getSingleton()->getNumMapSpawnPoints(mapName);
|
||||
|
||||
for(int i = 0; i < numPlayers; i++){
|
||||
int factionChoice = factionsListboxes[i]->getSelectedOption();
|
||||
@@ -71,6 +67,6 @@ namespace battleship{
|
||||
game->addPlayer(new Player(difficulty, faction, team, color, cpuPlayer, i, name));
|
||||
}
|
||||
|
||||
handleLoadingGui(new LoadingAppState(new InGameAppState(), "inGame.lua"));
|
||||
handleLoadingGui(new LoadingAppState(new InGameAppState(mapName), "inGame.lua"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user