@Override public void create() { // TODO Auto-generated method stub super.create(); assetManager = new AssetManager(); GameHelper.getInstance().registerService(AssetManager.class, assetManager); loader = new MyAssetLoadingFacade(assetManager, new GdxInternalFileReader()); JsonParser parser = new JsonParser(); JsonArray arr = parser.parse(Gdx.files.internal("assets/entitiesInfo.json").reader()).getAsJsonArray(); for (JsonElement elem : arr) { String path = elem.getAsString(); loader.getLoadingDefFilePathes().add(path); } loader.getLoadingSpriteFilePathes().add("assets/spritesInfo.json"); font = new BitmapFont(); GameHelper.getInstance().registerService(ISpriteInfoMap.class, SpriteInfoMap.getInstance()); }
@Override protected void onUpdate(float dt) { // TODO Auto-generated method stub if (state == 0) { if (loader.updateForDefLoading(dt)) { state = 1; } } else if (state == 1) { try { if (loader.updateForSpriteLoading(dt)) { state = 2; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { SceneManager.getInstance().changeScene(new TiledStageScene()); } super.onUpdate(dt); }