当前位置: 首页>>代码示例>>Java>>正文


Java AssetLoaderParameters类代码示例

本文整理汇总了Java中com.badlogic.gdx.assets.AssetLoaderParameters的典型用法代码示例。如果您正苦于以下问题:Java AssetLoaderParameters类的具体用法?Java AssetLoaderParameters怎么用?Java AssetLoaderParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AssetLoaderParameters类属于com.badlogic.gdx.assets包,在下文中一共展示了AssetLoaderParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadAsset

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
private static <T, P extends AssetLoaderParameters<T>> void loadAsset(String filePath, Class<T> type, AssetLoader<T, P> loader) {
if (filePath == null || filePath.trim().isEmpty()) {
    Gdx.app.debug(TAG, "Trying to load a " + type.getSimpleName() + " with empty filePath");
    return;
}

if (fileResolver.resolve(filePath).exists()) {
    assetManager.setLoader(type, loader);
    assetManager.load(filePath, type);

    assetManager.finishLoading();
    Gdx.app.debug(TAG, type.getSimpleName() + " loaded: " + filePath);
} else {
    Gdx.app.debug(TAG, type.getSimpleName() + " does not exist: " + filePath);
}
   }
 
开发者ID:Quillraven,项目名称:Quilly-s-Castle,代码行数:17,代码来源:Utils.java

示例2: loadAsync

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override @SuppressWarnings("unchecked") public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Levels> parameter) {
    Yaml yaml = new Yaml();
    ObjectMap<String, BaseLevelDescription> data = new ObjectMap<String, BaseLevelDescription>();
    for (Object o : yaml.loadAll(resolve(fileName).read())) {
        HashMap<String, Object> value = (HashMap<String, Object>) o;
        String type = MapHelper.get(value, "type", "level");
        try {
            BaseLevelDescription desc = types.get(type).getConstructor(Map.class).newInstance(value);
            data.put(desc.name, desc);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
    levels = new Levels(data);
    Config.levels = levels;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:18,代码来源:LevelsLoader.java

示例3: handleImports

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
public static <T, P extends AssetLoaderParameters<T>> void handleImports(
		AssetLoader<T, P> loader, P parameter,
		@SuppressWarnings("rawtypes") Array<AssetDescriptor> dependencies, FileHandle parentFile,
		Element root) throws IOException {
	Array<Element> imports = root.getChildrenByName(XMLUtil.XML_IMPORT);
	for (Element singleImport : imports) {
		String filename = singleImport.get(XMLUtil.XML_FILENAME);
		FileHandle file = parentFile.parent().child(filename);
		if (!file.exists()) {
			throw new GdxRuntimeException("Import " + file.path()
					+ " from import for " + parentFile.name()
					+ " does not exist.");
		}
		dependencies.addAll(loader.getDependencies(filename, file, parameter));
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:17,代码来源:LoaderUtil.java

示例4: getLoadParams

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override
@Nullable
protected AssetLoaderParameters<Texture> getLoadParams(FilePath imagePath) {
    IImageDefinition imageDef = getImageDef(imagePath);
    if (imageDef == null) {
        return null;
    }

    TextureParameter params = new TextureParameter();

    params.minFilter = GdxTextureUtil.toGdxFilter(imageDef.getMinifyFilter());
    params.magFilter = GdxTextureUtil.toGdxFilter(imageDef.getMagnifyFilter());

    params.wrapU = GdxTextureUtil.toGdxWrap(imageDef.getTilingModeX());
    params.wrapV = GdxTextureUtil.toGdxWrap(imageDef.getTilingModeY());

    return params;
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:19,代码来源:GdxTextureStore.java

示例5: load

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
public <T> T load (String resource, Class<T> type, AssetLoader loader, AssetLoaderParameters<T> params) {	
	String resolvedPath = new String(resource).replaceAll("\\\\", "/");
	boolean exist = assetManager.isLoaded(resolvedPath, type);
	T oldAsset = null;
	if(exist){
		oldAsset = assetManager.get(resolvedPath, type);
		for(int i=assetManager.getReferenceCount(resolvedPath); i > 0; --i)
			assetManager.unload(resolvedPath);
	}
	
	AssetLoader<T, AssetLoaderParameters<T>> currentLoader = assetManager.getLoader(type);
	if(loader != null)
		assetManager.setLoader(type, loader); 

	assetManager.load(resource, type, params);
	assetManager.finishLoading();
	T res = assetManager.get(resolvedPath);
	if(currentLoader != null)
		assetManager.setLoader(type, currentLoader);
	
	if(exist)
		EventManager.get().fire(EVT_ASSET_RELOADED, new Object[]{oldAsset, res});
	
	return res;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:26,代码来源:FlameMain.java

示例6: makeAssetLoaderParameter

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
private <T> AssetLoaderParameters<T> makeAssetLoaderParameter(String fileName, Class<T> type) {
	AssetLoaderParameters<T> parameter;
	if (type.equals(Texture.class)) {
		parameter = (AssetLoaderParameters<T>) new TextureLoader.TextureParameter();
	} else if (type.equals(TextureAtlas.class)) {
		parameter = (AssetLoaderParameters<T>) new TextureAtlasLoader.TextureAtlasParameter();
	} else if (type.equals(Sound.class)) {
		parameter = (AssetLoaderParameters<T>) new SoundLoader.SoundParameter();
	} else if (type.equals(BitmapFont.class)) {
		parameter = (AssetLoaderParameters<T>) new BitmapFontLoader.BitmapFontParameter();
	} else if (type.equals(Pixmap.class)) {
		parameter = (AssetLoaderParameters<T>) new PixmapLoader.PixmapParameter();
	} else if (type.equals(Music.class)) {
		parameter = (AssetLoaderParameters<T>) new MusicLoader.MusicParameter();
	} else {
		parameter = null;
	}

	return parameter;
}
 
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:21,代码来源:MemoryTrackingAssetManager.java

示例7: loadAsync

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override
public void loadAsync(AssetManager manager, String fileName,
		FileHandle file, AssetLoaderParameters<T> parameter) {
	// FIXME temporary fix. Some of the files has erroneous '
	String contents = file
			.readString()
			.replaceAll(
					"'(https?:\\/\\/)([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?(\\?.*)?'",
					"\"http\"");

	object = gameAssets.fromJson(clazz == Object.class ? null : clazz,
			contents);
	if (object == null) {
		throw new RuntimeException(fileName
				+ " name is an empty file. Impossible to load json");
	}
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:18,代码来源:JsonLoader.java

示例8: loadAndGet

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
public synchronized <T> T loadAndGet(String fileName, Class<T> type, AssetLoaderParameters<T> parameter) {
	if (!isLoaded(fileName)) {
		load(fileName, type, parameter);
		finishLoadingAsset(fileName);
	}
	return super.get(fileName, type);
}
 
开发者ID:CherokeeLanguage,项目名称:cll1-gdx,代码行数:8,代码来源:AbstractScreen.java

示例9: loadAsync

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Professions> parameter) {
    Yaml yaml = new Yaml();
    ObjectMap<String, ProfessionDescription> data = new ObjectMap<String, ProfessionDescription>();
    for (Object o : yaml.loadAll(resolve(fileName).read())) {
        Map professionData = (Map) o;
        ProfessionDescription profession = new ProfessionDescription(professionData);
        data.put(profession.name, profession);
    }
    professions = new Professions(data);
    Config.professions = professions;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:12,代码来源:ProfessionsLoader.java

示例10: loadAsync

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Array> parameter) {
    Iterable<Object> data = new Yaml().loadAll(file.read());
    Array<Object> list = new Array<Object>();
    for(Object o : data){
        list.add(o);
    }
    this.list = list;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:9,代码来源:YamlAllLoader.java

示例11: loadAsync

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override @SuppressWarnings("unchecked") public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Abilities> parameter) {
    Yaml yaml = new Yaml();
    ObjectMap<String, Ability> data = new ObjectMap<String, Ability>();
    for (Object o : yaml.loadAll(resolve(fileName).read())) {
        HashMap<String, Object> value = (HashMap<String, Object>) o;
        Ability description = new Ability(value);
        data.put(description.name, description);
    }
    abilities = new Abilities(data);
    Config.abilities = abilities;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:12,代码来源:AbilitiesLoader.java

示例12: loadAsync

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Items> parameter) {
    Constructor constructor = new Constructor(Item.class);
    Yaml yaml = new Yaml(constructor);
    ObjectMap<String, Item> data = new ObjectMap<String, Item>();
    for (Object o : yaml.loadAll(resolve(fileName).read())) {
        Item item = (Item) o;
        data.put(item.name, item);
    }
    items = new Items(data);
    Config.items = items;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:12,代码来源:ItemsLoader.java

示例13: load

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@Override
public synchronized <T> void load(String fileName, Class<T> type,
		AssetLoaderParameters<T> parameter) {
	if (fileName.contains(TEXTURE_REGION_SEPARATOR)) {
		fileName = fileName.substring(0, fileName.lastIndexOf(TEXTURE_REGION_SEPARATOR)+TEXTURE_REGION_SEPARATOR_LENGTH-1);
		super.load(fileName, TextureAtlas.class, null);
	} else {
		super.load(fileName, type, parameter);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:11,代码来源:AtlassedAssetManager.java

示例14: getDependencies

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, AssetLoaderParameters<Scene> parameter) {
	scene = new Json().fromJson(Scene.class, serializedScene);
	Array<AssetDescriptor> assetDependencies = new Array<AssetDescriptor>();
	for (int i = 0; i < scene.gameObjects.size; i++)
		scene.gameObjects.get(i).load(assetDependencies);
	return assetDependencies;
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:10,代码来源:DummySceneLoader.java

示例15: getDependencies

import com.badlogic.gdx.assets.AssetLoaderParameters; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, AssetLoaderParameters<Project> parameter) {
	project = new Json().fromJson(Project.class, file.readString());
	Array<AssetDescriptor> assetDependencies = new Array<AssetDescriptor>();
	return assetDependencies;
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:8,代码来源:ProjectLoader.java


注:本文中的com.badlogic.gdx.assets.AssetLoaderParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。