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


Java ObjectMap.entries方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.ObjectMap.entries方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMap.entries方法的具体用法?Java ObjectMap.entries怎么用?Java ObjectMap.entries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.ObjectMap的用法示例。


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

示例1: loadProfile

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public void loadProfile(String profile) {
final String fileName = profile + SAVE_GAME_SUFFIX;

if (!Gdx.files.internal(fileName).exists()) {
    Gdx.app.debug(TAG, "Trying to load non-existing profile: " + profile);
    return;
}

currentProfileName = profile;
Gdx.app.debug(TAG, "Loading profile " + currentProfileName + " ...");

ObjectMap<?, ?> loadedProperties = Utils.fromJson(ObjectMap.class, profiles.get(currentProfileName));

profileProperties.clear();

for (Entry<?, ?> entry : loadedProperties.entries()) {
    profileProperties.put((String) entry.key, entry.value);
}

fireLoad(this);
Gdx.app.debug(TAG, "Loading profile successful!");
   }
 
开发者ID:Quillraven,项目名称:Quilly-s-Castle,代码行数:23,代码来源:ProfileManager.java

示例2: spreadCrimeInfo

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
 * This will spread information about crimes known to fromFaction but
 * unknown to toFaction from the one to the other.
 * 
 * @param fromFaction
 * @param toFaction
 */
public void spreadCrimeInfo(Faction fromFaction, Faction toFaction) {
	Array<Crime<?>> crimesKnownToFromFaction = trackedCrimes.get(fromFaction);
	
	if (crimesKnownToFromFaction == null) {
		return;
	}
	
	ObjectMap<Faction, Integer> penalties = new ObjectMap<Faction, Integer>();
	for (Crime<?> crime : crimesKnownToFromFaction) {
		if (addCrime(crime, toFaction)) {
			Faction perpFaction = crime.getPerpetrator().getFaction(); 
			int penalty = crime.getDispositionPenalty()/2;
			if (penalties.containsKey(perpFaction)) {
				penalties.put(perpFaction, penalties.get(perpFaction)+penalty);
			} else {
				penalties.put(perpFaction, penalty);
			}
		}
	}
	for (Entry<Faction, Integer> entry : penalties.entries()) { 
		toFaction.modifyDisposition(entry.key, -entry.value);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:31,代码来源:CrimeManager.java

示例3: buildActivationRequirements

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
protected void buildActivationRequirements(GameCharacter character,
		StringBuilder fsb) {
	super.buildActivationRequirements(character, fsb);
	ObjectMap<String, Boolean> foci = spell.getFoci();
	
	if (foci.size > 0) {
		addLine();
		addLine(Strings.getString(Spell.STRING_TABLE, "foci"), style.headingStyle);
		
		Inventory inventory = character.getInventory();
		for (Entry<String, Boolean> entry : foci.entries()) {
			fsb.append(InventoryItem.getItemPrototype(entry.key).getName());
			if (entry.value) {
				fsb.append(" (");
				fsb.append(Strings.getString(Spell.STRING_TABLE, "consumed"));
				fsb.append(")");
			}
			addLine(fsb.toString(),
					inventory.getItem(entry.key) != null ? style.reqsReachedStyle
							: style.reqsNotReachedStyle);
			fsb.setLength(0);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:26,代码来源:SpellTooltip.java

示例4: reload

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void reload () {
	RavTech.files.loadAsset("keybindings.json", String.class);
	RavTech.files.finishLoading();
	
	if ((!RavTech.settings.has("keybindings")))
		RavTech.settings.setValue("keybindings", RavTech.files.getAsset("keybindings.json", String.class));
	this.actionMaps.clear();
	Json json = new Json();

	ObjectMap<String, JsonValue> serializedActionMaps = json.fromJson(ObjectMap.class,
		RavTech.settings.getString("keybindings"));
	for (ObjectMap.Entry<String, JsonValue> entry : serializedActionMaps.entries()) {
		ActionMap actionMap = new ActionMap();
		actionMap.read(json, entry.value);
		this.actionMaps.put(entry.key, actionMap);
	}
	this.actionMaps.putAll(actionMaps);

	this.players.clear();
	Player player = new Player();
	for (int i = 0; i < inputDevices.size; i++)
		player.assignDevice(inputDevices.get(i), this.getActionMapForDevice(inputDevices.get(i)));
	players.add(player);
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:26,代码来源:RavInput.java

示例5: setVariables

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/** Registers a set of variables and their respective replacement values to this label. */
public void setVariables (ObjectMap<String, String> variableMap) {
	this.variables.clear();
	for (Entry<String, String> entry : variableMap.entries()) {
		this.variables.put(entry.key.toUpperCase(), entry.value);
	}
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:8,代码来源:TypingLabel.java

示例6: onWin

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override public void onWin(BaseLevelDescription level, LevelResult result, ObjectMap<Player, IParticipant> playersToParticipants, final PvpPlayState.RestartCallback callback) {
    Array<RewardResult> rewards = app.applyLevelResult(level, result, true);
    Array<IParticipant> opponents = new Array<IParticipant>();
    for (ObjectMap.Entry<Player, IParticipant> e : playersToParticipants.entries()) {
        if (e.key.inRelation(result.viewer, PlayerRelation.enemy)) {
            opponents.add(e.value);
        }
    }
    String shareText = Config.thesaurus.localize(
        "pvp-share",
        Thesaurus.params()
            .with("opponents", Thesaurus.Util.enumerate(Config.thesaurus, opponents, IParticipant.STRINGIFIER))
            .with("pvp-cant-stop-me", opponents.size > 1 ? "pvp-cant-stop-me.many" : "pvp-cant-stop-me.one")
    );
    Config.mobileApi.services().incrementScore("CgkIsNnQ2ZcKEAIQFw", 1).addListener(new IFutureListener<Boolean>() {
        @Override public void onHappened(Boolean success) {
            Logger.debug("todo");
        }
    });
    winWindow = new PvpWinWindow();
    winWindow.show(new PvpWinWindow.Params(rewards, shareText, result, new PvpWinWindow.Callback() {

        @Override public void onClose() {
            winWindow = null;
            app.setState(app.gameMapState);
        }

        @Override public void onRestart() {
            winWindow = null;
            callback.onRestart();
        }
    }, app.userData));
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:34,代码来源:PvpPlayStateCallback.java

示例7: 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

示例8: loadSync

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public Skin loadSync (AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) {
	String textureAtlasPath = file.pathWithoutExtension() + ".atlas";
	ObjectMap<String, Object> resources = null;
	if (parameter != null) {
		if (parameter.textureAtlasPath != null){
			textureAtlasPath = parameter.textureAtlasPath;
		}
		if (parameter.resources != null){
			resources = parameter.resources;
		}
	}
	TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class);
	Skin skin = new SkinWithTrueTypeFonts(atlas);
	if (resources != null) {
		for (Entry<String, Object> entry : resources.entries()) {
			skin.add(entry.key, entry.value);
		}
	}
	
	for (AssetDescriptor<Sound> sound : sounds) {
		skin.add(sound.file.nameWithoutExtension(), Gdx.audio.newSound(sound.file), Sound.class);
	}
	
	skin.load(file);
	return skin;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:28,代码来源:SkinLoaderWithSounds.java

示例9: replaceParameters

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public static String replaceParameters(String string, ObjectMap<String, String> parameters) {
	for (Entry<String, String> entry : parameters.entries()) {
		string = replaceWithCapitalisation(string, "\\<"+entry.key+"\\>", entry.value);
	}
	return string;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:7,代码来源:StringUtil.java

示例10: load

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public TextureAtlas load(AssetManager assetManager, String fileName, FileHandle file, TextureAtlasLoader.TextureAtlasParameter parameter) {
    TextureAtlas atlas = new TextureAtlas();
    atlas.getTextures().add(texture);
    ObjectMap<String, Object> frames = (ObjectMap<String, Object>) map.get("frames");
    for (ObjectMap.Entry<String, Object> entry : frames.entries()) {
        String pageName = entry.key;
        ObjectMap<String, Object> params = (ObjectMap<String, Object>) entry.value;
        Rectangle frame = LyU.parseRect((String) params.get("frame"));
        GridPoint2 offset = LyU.parsePoint((String) params.get("offset"));
        boolean rotated = Boolean.parseBoolean((String) params.get("rotated"));
        GridPoint2 sourceSize = LyU.parsePoint((String) params.get("sourceSize"));
        Rectangle sourceColorRect = LyU.parseRect((String) params.get("sourceColorRect"));
        TextureAtlas.TextureAtlasData.Region region = new TextureAtlas.TextureAtlasData.Region();
        region.name = pageName.substring(0, pageName.lastIndexOf('.'));
        region.rotate = rotated;
        region.offsetX = offset.x;
        region.offsetY = offset.y;
        region.originalWidth = sourceSize.x;
        region.originalHeight = sourceSize.y;
        region.left = (int) frame.x;
        region.top = (int) frame.y;
        region.width = (int) frame.getWidth();
        region.height = (int) frame.getHeight();
        int width = region.width;
        int height = region.height;
        TextureAtlas.AtlasRegion atlasRegion = new TextureAtlas.AtlasRegion(texture, 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);
        }
        atlas.getRegions().add(atlasRegion);
    }
    texture = null;
    map = null;
    return atlas;
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:47,代码来源:CCTextureAtlasLoader.java


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