com.badlogic.gdx.assets.AssetLoaderParameters Java Examples

The following examples show how to use com.badlogic.gdx.assets.AssetLoaderParameters. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LevelsLoader.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: ItemsLoader.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #3
Source File: ProfessionsLoader.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #4
Source File: AbilitiesLoader.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #5
Source File: YamlAllLoader.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #6
Source File: MidiSequenceLoader.java    From gdx-pd with Apache License 2.0 5 votes vote down vote up
@Override
public MidiSequence loadSync(AssetManager manager, String fileName, FileHandle file,
		AssetLoaderParameters<MidiSequence> parameter) {
	MidiSequence sequence = this.sequence;
	this.sequence = null;
	return sequence;
}
 
Example #7
Source File: MidiSequenceLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file,
		AssetLoaderParameters<MidiSequence> parameter) {
	// no dependencies
	return null;
}
 
Example #8
Source File: PvpModesLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<PvpModes> parameter) {
    return null;
}
 
Example #9
Source File: PvpModesLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<PvpModes> parameter) {
    Iterable<Map> loaded = (Iterable<Map>) (Object) new Yaml().loadAll(resolve(fileName).read());
    modes = new PvpModes(loaded);
    Config.pvpModes = modes;
}
 
Example #10
Source File: PvpModesLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public PvpModes loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<PvpModes> parameter) {
    return modes;
}
 
Example #11
Source File: MidiSequenceLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file,
		AssetLoaderParameters<MidiSequence> parameter) {
	sequence = new MidiSequence(file);
}
 
Example #12
Source File: ItemsLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<Items> parameter) {
    return null;
}
 
Example #13
Source File: PatchLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file,
		AssetLoaderParameters<PdPatch> parameter) {
	patch = Pd.audio.open(file);
}
 
Example #14
Source File: PatchLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public PdPatch loadSync(AssetManager manager, String fileName, FileHandle file,
		AssetLoaderParameters<PdPatch> parameter) {
	return patch;
}
 
Example #15
Source File: PatchLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file,
		AssetLoaderParameters<PdPatch> parameter) {
	// no deps
	return null;
}
 
Example #16
Source File: MidiMusicLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file,
		AssetLoaderParameters<Music> parameter) {
	music = Pd.midi.createMidiMusic(file);
}
 
Example #17
Source File: MidiMusicLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public Music loadSync(AssetManager manager, String fileName, FileHandle file,
		AssetLoaderParameters<Music> parameter) {
	return music;
}
 
Example #18
Source File: MidiMusicLoader.java    From gdx-pd with Apache License 2.0 4 votes vote down vote up
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file,
		AssetLoaderParameters<Music> parameter) {
	// no dependencies
	return null;
}
 
Example #19
Source File: ItemsLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Items loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Items> parameter) {
    return items;
}
 
Example #20
Source File: AbilitiesLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Abilities loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Abilities> parameter) {
    return abilities;
}
 
Example #21
Source File: AbilitiesLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<Abilities> parameter) {
    return null;
}
 
Example #22
Source File: YamlMapLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Map loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Map> parameter) {
    return map;
}
 
Example #23
Source File: YamlMapLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public void loadAsync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Map> parameter) {
    map = (Map) new Yaml().load(file.read());
}
 
Example #24
Source File: YamlMapLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<Map> parameter) {
    return null;
}
 
Example #25
Source File: YamlAllLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Array> parameter) {
    return list;
}
 
Example #26
Source File: YamlAllLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<Array> parameter) {
    return null;
}
 
Example #27
Source File: LevelsLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Levels loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Levels> parameter) {
    return levels;
}
 
Example #28
Source File: LevelsLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<Levels> parameter) {
    return null;
}
 
Example #29
Source File: ProfessionsLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AssetLoaderParameters<Professions> parameter) {
    return null;
}
 
Example #30
Source File: ProfessionsLoader.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public Professions loadSync(AssetManager manager, String fileName, FileHandle file, AssetLoaderParameters<Professions> parameter) {
    return professions;
}