本文整理汇总了Java中com.badlogic.gdx.utils.ObjectMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMap.put方法的具体用法?Java ObjectMap.put怎么用?Java ObjectMap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.ObjectMap
的用法示例。
在下文中一共展示了ObjectMap.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFinishedLoading
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void onFinishedLoading() {
BitmapFont main19Font = assetManager.get(MAIN_FONT_19_PATH());
BitmapFont main22Font = assetManager.get(MAIN_FONT_22_PATH());
BitmapFont letter20Font = assetManager.get(LETTER_FONT_20_PATH());
BitmapFont handwritten20Font = assetManager
.get(HANDWRITTEN_FONT_20_PATH());
ObjectMap<String, Object> fontMap = new ObjectMap<String, Object>();
fontMap.put("main-19", main19Font);
fontMap.put("main-22", main22Font);
fontMap.put("letter-20", letter20Font);
fontMap.put("handwritten-20", handwritten20Font);
assetManager.load(SKIN_PATH, Skin.class,
new SkinLoader.SkinParameter(SKIN_TEXTURE_ATLAS_PATH, fontMap));
assetManager.finishLoadingAsset(SKIN_PATH);
// game.setUISkin(assetManager.get(SKIN_PATH));
VisUI.load();
game.setUISkin(VisUI.getSkin());
// Notify loaded screens
game.getScreen("serverBrowser").finishLoading();
game.pushScreen("mainMenu");
}
示例2: parseMatches
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public static ObjectMap<TextParam, String> parseMatches(String input) {
ObjectMap<TextParam, String> params = new ObjectMap<>();
Matcher regex = CATCH_PATTERN.matcher(input);
while (regex.find()) {
String[] splits = regex.group().split("(\\]\\[)");
for (String param : splits) {
String[] array = param.replaceAll("[\\[\\]]", "").split("=");
TextParam textParam = TextParam.of(array[0]);
if (textParam == TextParam.UNDEFINED) {
continue;
}
String value;
if (array.length < 2 || array[1].isEmpty()) {
value = "";
} else {
value = array[1];
}
params.put(textParam, value);
}
}
return params;
}
示例3: loadFromXML
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) throws IOException {
ObjectMap<String, Crime<?>> savedCrimes = new ObjectMap<String, Crime<?>>();
Element crimesElement = root.getChildByName(XML_CRIMES);
for (int i = 0; i < crimesElement.getChildCount(); ++i) {
Crime<?> crime = Crime.readCrime(crimesElement.getChild(i));
savedCrimes.put(crime.getId(), crime);
}
Element factionsElement = root.getChildByName(XML_FACTIONS);
for (int i = 0; i < factionsElement.getChildCount(); ++i) {
Element factionElement = factionsElement.getChild(i);
Faction faction = Faction.getFaction(factionElement.getName());
for (int j = 0; j < factionElement.getChildCount(); ++j) {
addCrime(savedCrimes.get(factionElement.getChild(j).getText()), faction);
}
}
}
示例4: initEnvironment
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void initEnvironment() {
ObjectMap<String, Object> values = new ObjectMap<String, Object>();
values.put("Keys", Keys.class);
values.put("Input", RavTech.input);
values.put("Debug", Debug.class);
values.put("Vector2", Vector2.class);
values.put("Color", Color.class);
values.put("Buttons", Buttons.class);
values.put("GameObject", GameObject.class);
values.put("ComponentType", ComponentType.class);
values.put("RavTech", RavTech.class);
values.put("Settings", RavTech.settings);
values.put("Graphics", Gdx.graphics);
values.put("Box2DWorld", RavTech.sceneHandler.box2DWorld);
values.put("Net", Gdx.net);
this.environment = values;
}
示例5: getText
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public String getText(ObjectMap<String, String> parameters) {
if (parameters == null) {
parameters = new ObjectMap<String, String>();
}
if (dialogue.getPCAtDialogue() != null) {
parameters.put(SPECIAL_PCNAME, dialogue.getPCAtDialogue().getName());
parameters.put(SPECIAL_PC_PRONOUN, dialogue.getPCAtDialogue().stats().getGender().getPronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_PC_POSSESIVE_PRONOUN, dialogue.getPCAtDialogue().stats().getGender().getPossesivePronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_PC_OBJECT_PRONOUN, dialogue.getPCAtDialogue().stats().getGender().getObjectPronoun().toLowerCase(Locale.ENGLISH));
}
if (dialogue.getNPCAtDialogue() != null) {
parameters.put(SPECIAL_NPCNAME, dialogue.getNPCAtDialogue().getName());
parameters.put(SPECIAL_NPC_PRONOUN, dialogue.getNPCAtDialogue().stats().getGender().getPronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_NPC_POSSESIVE_PRONOUN, dialogue.getNPCAtDialogue().stats().getGender().getPossesivePronoun().toLowerCase(Locale.ENGLISH));
parameters.put(SPECIAL_NPC_OBJECT_PRONOUN, dialogue.getNPCAtDialogue().stats().getGender().getObjectPronoun().toLowerCase(Locale.ENGLISH));
}
String returnValue = StringUtil.replaceParameters(Strings.getString(text), parameters);
returnValue = StringUtil.replaceCharacterNames(returnValue);
return returnValue;
}
示例6: load
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void load(TextureAtlasData data) {
ObjectMap<TextureAtlasData.Page, Texture> pageToTexture = new ObjectMap<TextureAtlasData.Page, Texture>();
for (TextureAtlasData.Page page : data.getPages()) {
Texture texture = TextureDecryptor.loadTexture(crypto, page.textureFile, page.format, page.useMipMaps);
texture.setFilter(page.minFilter, page.magFilter);
texture.setWrap(page.uWrap, page.vWrap);
getTextures().add(texture);
pageToTexture.put(page, texture);
}
// Same as libGDX source
for (TextureAtlasData.Region region : data.getRegions()) {
int width = region.width;
int height = region.height;
AtlasRegion atlasRegion = new AtlasRegion(pageToTexture.get(region.page), region.left, region.top,
region.rotate ? height : width, region.rotate ? width : height);
atlasRegion.index = region.index;
atlasRegion.name = region.name;
atlasRegion.offsetX = region.offsetX;
atlasRegion.offsetY = region.offsetY;
atlasRegion.originalHeight = region.originalHeight;
atlasRegion.originalWidth = region.originalWidth;
atlasRegion.rotate = region.rotate;
atlasRegion.splits = region.splits;
atlasRegion.pads = region.pads;
if (region.flip) atlasRegion.flip(false, true);
getRegions().add(atlasRegion);
}
}
示例7: load
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public TiledMap load(String fileName, AtlasTiledMapLoaderParameters parameter) {
try {
if (parameter != null) {
convertObjectToTileSpace = parameter.convertObjectToTileSpace;
flipY = parameter.flipY;
} else {
convertObjectToTileSpace = false;
flipY = true;
}
FileHandle tmxFile = resolve(fileName);
root = xml.parse(tmxFile);
ObjectMap<String, TextureAtlas> atlases = new ObjectMap<String, TextureAtlas>();
FileHandle atlasFile = Gdx.files
.internal(KyperBoxGame.IMAGE_FOLDER + KyperBoxGame.FILE_SEPARATOR + KyperBoxGame.GAME_ATLAS);
if (atlasFile == null) {
throw new GdxRuntimeException("Couldn't load atlas");
}
TextureAtlas atlas = new TextureAtlas(atlasFile);
atlases.put(atlasFile.path(), atlas);
AtlasResolver.DirectAtlasResolver atlasResolver = new AtlasResolver.DirectAtlasResolver(atlases);
TiledMap map = loadMap(root, tmxFile, atlasResolver);
map.setOwnedResources(atlases.values().toArray());
setTextureFilters(parameter.textureMinFilter, parameter.textureMagFilter);
return map;
} catch (IOException e) {
throw new GdxRuntimeException("Couldn't load tilemap '" + fileName + "'", e);
}
}
示例8: loadWithIdentifiers
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
* Internal method.
*
* <p>Simply hides the mess of parameters in favor of
* the two simple parameters required by the public
* method.</p>
*
* @see #loadWithIdentifiers(File, FileFilter)
*/
private static ObjectMap<String, File> loadWithIdentifiers(ObjectMap<String, File> parentMap,
boolean recursive, String append, File root, FileFilter filter) {
if (!root.exists()) {
root.mkdirs();
}
if (!root.isDirectory()) {
throw new IllegalArgumentException("Provided File reference was not a directory");
}
for (File file : root.listFiles((FileFilter) file -> {
return file.isDirectory() || (filter != null ? filter.accept(file) : true);
})) {
String identifier =
(append == null ? "" : append + ".") + file.getName().split("\\.")[0].replaceAll(" ", "_");
if (file.isDirectory()) {
if(recursive) {
loadWithIdentifiers(parentMap, true, identifier, file, filter);
}
} else {
parentMap.put(identifier, file);
}
}
return parentMap;
}
示例9: getAssetFiles
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public static ObjectMap<String, FileHandle> getAssetFiles(String assetFolderPath, String fileExtension, FileType fileType) {
ObjectMap<String, FileHandle> returnValue = new ObjectMap<String, FileHandle>();
boolean isInBin = false;
FileHandle assetFolder = Gdx.files.getFileHandle(assetFolderPath, fileType);
if (!assetFolder.isDirectory()) {
assetFolder = Gdx.files.getFileHandle(Assets.BIN_FOLDER+assetFolderPath, fileType);
isInBin = true;
}
FileHandle[] assetFiles = fileExtension != null ? assetFolder.list( "."+fileExtension) : assetFolder.list();
for (FileHandle assetFile : assetFiles) {
returnValue.put(isInBin ? assetFile.path().substring(Assets.BIN_FOLDER.length()) : assetFile.path(), assetFile);
}
return returnValue;
}
示例10: addToFileList
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
protected void addToFileList(ObjectMap<String, FileHandle> map, ServerFile path, ServerFile workingDir, List<File> files) {
for (File file : files) {
if (file.isFile()) {
if(file.getName().equals(".DS_Store"))continue; //don't store
map.put(path.getTransferPath(workingDir, file), Gdx.files.absolute(file.getAbsolutePath()));
} else if (file.isDirectory()) {
List<File> subFiles = new ArrayList<>();
ServerFile subDir = path.child(file.getName(), true);
for (File f : file.listFiles())
subFiles.add(f);
addToFileList(map, subDir, workingDir, subFiles);
}
}
}
示例11: prepare
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public void prepare(LevelDescription level, ObjectMap<IParticipant, Fraction> fractions, int seed) {
if (prepareFuture != null) prepareFuture.happen();
this.level = level;
ObjectMap<Fraction, Player> players = new ObjectMap<Fraction, Player>();
Player viewer = null;
for (ObjectMap.Entry<IParticipant, Fraction> e : fractions.entries()) {
Fraction f = e.value;
Player player = new Player(f, level.relations.get(f));
if (e.key == session.getMe()) {
viewer = player;
}
participantsToPlayers.put(e.key, player);
playersToParticipants.put(player, e.key);
players.put(f, player);
}
if (viewer == null)
throw new IllegalStateException("WTF! viewer is null!");
viewer.setPotions(userData.potions);
for (Die die : userData.dice()) {
viewer.addDie(die);
}
world = new World(viewer, players, PlayerHelper.defaultColors, level, stage);
world.addController(ViewController.class);
world.addController(CreatureInfoController.class);
world.init();
world.addController(PvpLoadLevelController.class);
world.addController(SpawnController.class);
world.addController(new RandomController(world, seed));
world.dispatcher.add(SpawnController.START, new EventListener<Void>() {
@Override public void handle(EventType<Void> type, Void aVoid) {
world.removeController(SpawnController.class);
showPrepareWindow();
listener.sendToServer(new SpawnedToServer(world.viewer));
}
});
}
示例12: gatherAssets
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public static void gatherAssets(String assetFolderPath, String fileExtension, Class<?> assetClass, ObjectMap<String, String> idFileMap, FileType fileType) {
for (Entry<String, FileHandle> entry : getAssetFiles(assetFolderPath, fileExtension, fileType)) {
assetManager.load(entry.key, assetClass);
if (idFileMap != null) {
idFileMap.put(entry.value.nameWithoutExtension().toLowerCase(Locale.ENGLISH), entry.key);
}
}
}
示例13: addToArrayMap
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public static <K, V> void addToArrayMap(ObjectMap<K, Array<V>> map, K key, V value) {
Array<V> array = map.get(key);
if (array == null) {
array = new Array<V>();
map.put(key, array);
}
array.add(value);
}
示例14: loadAsync
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的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;
}
示例15: addModifierToReturnValue
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addModifierToReturnValue(ObjectMap<ModifiableStat, Array<Modifier>> returnValue, ModifiableStat stat, Modifier modifier) {
Array<Modifier> modifiers;
if (!returnValue.containsKey(stat)) {
modifiers = new Array<Modifier>();
returnValue.put(stat, modifiers);
} else {
modifiers = returnValue.get(stat);
}
modifiers.add(modifier);
}