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


Java ObjectMap.put方法代码示例

本文整理汇总了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");
}
 
开发者ID:eskalon,项目名称:ProjektGG,代码行数:26,代码来源:LoadingScreen.java

示例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;
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:27,代码来源:TextParser.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:19,代码来源:CrimeManager.java

示例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;
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:18,代码来源:ScriptLoader.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:DialogueItem.java

示例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);
    }
}
 
开发者ID:akivamu,项目名称:libgdx-crypt-texture,代码行数:30,代码来源:CryptTextureAtlas.java

示例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);
		}
	}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:33,代码来源:KyperMapLoader.java

示例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;
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:36,代码来源:FileUtil.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:15,代码来源:Assets.java

示例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);
        }
    }
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:15,代码来源:FileBrowserClint.java

示例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));
        }
    });
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:37,代码来源:PvpPlayState.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:Assets.java

示例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);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:CoreUtil.java

示例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;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:12,代码来源:ProfessionsLoader.java

示例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);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:11,代码来源:Stats.java


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