本文整理汇总了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!");
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
示例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));
}
示例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));
}
});
}
示例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;
}
示例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;
}
示例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;
}