mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
loading unit models when atteching InGameAppState
This commit is contained in:
@@ -0,0 +1 @@
|
||||
PATH = "/home/dominykas/c++/Battleship/Assets/"
|
||||
@@ -2,10 +2,12 @@
|
||||
#include <button.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <assetManager.h>
|
||||
|
||||
#include <stateManager.h>
|
||||
|
||||
#include "inGameAppState.h"
|
||||
#include "unitDataManager.h"
|
||||
#include "consoleCommand.h"
|
||||
#include "aircraftCarrier.h"
|
||||
#include "vessel.h"
|
||||
@@ -218,6 +220,14 @@ namespace battleship{
|
||||
guiState = ((GuiAppState*)stateManager->getAppStateByType((int)AppStateType::GUI_STATE));
|
||||
activeState = new ActiveGameState(guiState, map, players, playerId);
|
||||
stateManager->attachAppState(activeState);
|
||||
|
||||
UnitDataManager *unitDataManager = UnitDataManager::getSingleton();
|
||||
int numUnits = unitDataManager->getNumUnits();
|
||||
string *basePaths = unitDataManager->getBasePath();
|
||||
string *meshPaths = unitDataManager->getMeshPath();
|
||||
|
||||
for(int i = 0; i < numUnits; ++i)
|
||||
AssetManager::getSingleton()->load(basePaths[i] + meshPaths[i]);
|
||||
}
|
||||
|
||||
void InGameAppState::onDettached() {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ namespace battleship{
|
||||
|
||||
UnitDataManager::UnitDataManager(){
|
||||
LuaManager *luaManager = LuaManager::getSingleton();
|
||||
luaManager->buildScript(vector<string>{configData::PATH + "defPaths.lua", configData::PATH + "unitData.lua"});
|
||||
luaManager->buildScript(vector<string>{configData::PATH + "Scripts/defPaths.lua", configData::PATH + "Scripts/unitData.lua"});
|
||||
|
||||
numUnits = luaManager->getInt("numUnits");
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ namespace battleship{
|
||||
class UnitDataManager{
|
||||
public:
|
||||
static UnitDataManager* getSingleton();
|
||||
inline int getNumUnits(){return numUnits;}
|
||||
inline std::string* getBasePath(){return basePath;}
|
||||
inline std::string* getMeshPath(){return meshPath;}
|
||||
private:
|
||||
UnitDataManager();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user