Java 类com.badlogic.gdx.assets.AssetLoaderParameters.LoadedCallback 实例源码

项目:fabulae    文件:LoadingMapScreen.java   
public void init(String newMapId, GameMap oldMap, Tile startPos, boolean isLoadingSavegame,
        CombatMapInitializationData combatMapData, LoadedCallback callback) {
    // if we are already loading this map, do nothing
    if (this.mapId != null && this.mapId.equalsIgnoreCase(newMapId)) {
        return;
    }
    // turn off input
    Gdx.input.setInputProcessor(null);

    mapId = newMapId;
    this.oldMap = oldMap;

    this.startPos = startPos;

    this.removedFromOld = false;

    prepareForLoading(newMapId, combatMapData, callback);

    removeActions = !isLoadingSavegame;
    this.isLoadingSavegame = isLoadingSavegame;
    if (background != null) {
        background.reset(Configuration
                .getLoadingScreensConfiguration()
                .getConfigurationForScreenType("locations"), mapId);
    }
}
项目:fabulae    文件:LoadingMapScreen.java   
/**
 * Sets the ID of the map to load. This is just the ID, not the internal id.
 * 
 * @param mapId
 * @param combatMapData
 */
public void prepareForLoading(String mapId, CombatMapInitializationData combatMapData, LoadedCallback callback) {
    Music.stopPlayingMusic();
    mapId = mapId.toLowerCase(Locale.ENGLISH);
    newMap = gameState.getMapById(mapId);
    boolean loadTransactional = false;

    if (newMap == null) {
        if (combatMapData == null) {
            newMap = new GameMap(mapId);
        } else {
            newMap = new CombatGameMap(mapId);
        }
        loadTransactional = true;
    } else {
        newMap.undispose();
    }

    if (combatMapData != null) {
        ((CombatGameMap) newMap).init(combatMapData);
    }

    if (!gameState.belongsToUndisposed(newMap)) {
        Assets.getAssetManager().load(
                Configuration.getFolderMaps() + mapId + ".tmx", TiledMap.class, new GameMapLoader.Parameters(newMap, loadTransactional, callback));
        mapLoaded = false;
    } else {
        mapLoaded = true;
    }
}
项目:fabulae    文件:FishchickenGame.java   
/**
 * This will make the game first load the map 
 * (displaying the LoadingMapScreen) and then 
 * actually display the map
 * @param newMapId
 */
public void switchToMap(String newMapId, GameMap oldMap, Tile startPos, boolean isLoadingSavegame, CombatMapInitializationData data, LoadedCallback callback) {
    if (loadingMapScreen == null) {
        loadingMapScreen = new LoadingMapScreen(this, gameState);
    } 

    loadingMapScreen.init(newMapId, oldMap, startPos, isLoadingSavegame, data, callback);
    setScreen(loadingMapScreen);
}
项目:ead    文件:Assets.java   
public Assets(Files files) {
    setEnumNames(false);
    this.files = files;
    listeners = new Array<AssetLoadingListener>();
    assetManager = new AssetManager(this);
    assetManager.setErrorListener(this);
    i18n = new I18N(this);
    setLoader(Skin.class, new ExtendedSkinLoader(this));
    setLoader(Texture.class, new URLTextureLoader(this));
    setLoader(SkeletonData.class, new SkeletonLoader(this));
    assetManager.setErrorListener(new AssetErrorListener() {
        @Override
        public void error(AssetDescriptor asset, Throwable throwable) {
            AssetLoaderParameters params = asset.params;
            if (params != null) {
                LoadedCallback loadedCallback = params.loadedCallback;
                if (loadedCallback instanceof ErrorCallback) {
                    ((ErrorCallback) loadedCallback).errored(
                            asset.fileName, asset.type, throwable);
                }
            } else {
                Gdx.app.error("Assets", "Exception loading asset",
                        throwable);
            }
        }
    });
}
项目:fabulae    文件:FishchickenGame.java   
/**
 * This will make the game first load the map 
 * (displaying the LoadingMapScreen) and then 
 * actually display the map
 * @param mapId
 */
public void switchToMapAfterLoading(String mapId,LoadedCallback callback) {
    switchToMap(mapId, null, null, true, null, callback);
}