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


Java ObjectMap.Entry方法代码示例

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


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

示例1: add

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/** Add a Batchable to the queue. */
public void add (T batchable) {
	if (batchable.isOpaque()) {
		for (ObjectMap.Entry<T, ObjectSet<T>> entry : opaqueBatchables) {
			if (batchable.hasEquivalentTextures(entry.key)) {
				entry.value.add((T)batchable);
				return;
			}
		}
		ObjectSet<T> set = objectSetPool.obtain();
		set.add(batchable);
		opaqueBatchables.put(batchable, set);
	} else {
		blendedBatchables.add(batchable);
	}
	needSort = true;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:18,代码来源:BatchableSorter.java

示例2: iterator

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public Iterator<Entry<String, Class<?>>> iterator() {
	return new Iterator<ObjectMap.Entry<String,Class<?>>>() {

		private Entry<String, Class<?>> entry = new Entry<String, Class<?>>();
		private int index = 0;
		
		@Override
		public boolean hasNext() {
			return index < assets.size;
		}

		@Override
		public Entry<String, Class<?>> next() {
			Pair<String, Class<?>> value = assets.get(index++);
			entry.key = value.getLeft();
			entry.value = value.getRight();
			return entry;
		}
	};
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:22,代码来源:AssetMap.java

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

示例4: write

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, T map) {
    int length = map.size;
    output.writeVarInt(length, true);
    output.writeBoolean(false); // whether type is written (in case future version of ObjectMap supports type awareness)

    Serializer keySerializer = null;
    if (keyGenericType != null) {
        if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
        keyGenericType = null;
    }
    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        ObjectMap.Entry entry = (ObjectMap.Entry)iter.next();
        if (keySerializer != null) {
            kryo.writeObject(output, entry.key, keySerializer);
        } else
            kryo.writeClassAndObject(output, entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:29,代码来源:ObjectMapSerializer.java

示例5: write

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, ArrayMap map) {
    output.writeBoolean(map.ordered);
    int length = map.size;
    output.writeVarInt(length, true);
    kryo.writeClass(output, map.keys.getClass().getComponentType());
    kryo.writeClass(output, map.values.getClass().getComponentType());

    Serializer keySerializer = null;
    if (keyGenericType != null) {
        if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
        keyGenericType = null;
    }
    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        ObjectMap.Entry entry = (ObjectMap.Entry)iter.next();
        if (keySerializer != null) {
            kryo.writeObject(output, entry.key, keySerializer);
        } else
            kryo.writeClassAndObject(output, entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:31,代码来源:ArrayMapSerializer.java

示例6: update

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public synchronized boolean update () {
    boolean done = super.update();
    if (done) {
        // assign references to Asset fields of queuedContainers
        for (Object assetContainer : queuedContainers) {
            ObjectMap<Field, AssetDescriptor<?>> fieldsToAssets = containersFieldsToAssets.get(assetContainer);
            for (ObjectMap.Entry<Field, AssetDescriptor<?>> fieldEntry : fieldsToAssets) {
                Field field = fieldEntry.key;
                makeAccessible(field);
                try {
                    field.set(assetContainer, get(fieldEntry.value));
                } catch (ReflectionException e) {
                    throw new GdxRuntimeException("Failed to assign loaded asset " + field.getName(), e);
                }
            }
            ObjectMap<Object[], AssetDescriptor<?>[]> fieldsToAssetArrays = containersFieldsToAssetArrays.get(assetContainer);
            for (ObjectMap.Entry<Object[], AssetDescriptor<?>[]> arrayEntry : fieldsToAssetArrays) {
                Object[] destinationArray = arrayEntry.key;
                AssetDescriptor<?>[] descriptors = arrayEntry.value;
                for (int i = 0; i < descriptors.length; i++) {
                    destinationArray[i] = get(descriptors[i]);
                }
            }

            if (assetContainer instanceof AssetContainer)
                ((AssetContainer) assetContainer).onAssetsLoaded();
        }

        loadedContainers.addAll(queuedContainers);
        queuedContainers.clear();
    }
    return done;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:35,代码来源:AssignmentAssetManager.java

示例7: toProperties

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public Properties toProperties() {
    Properties properties = new Properties();
    for (ObjectMap.Entries<String, Object> iter = arguments.entries(); iter.hasNext(); ) {
        ObjectMap.Entry<String, Object> entr = iter.next();
        properties.put(entr.key, entr.value);
    }
    return properties;
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:9,代码来源:EntityArguments.java

示例8: applyPercentage

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public void applyPercentage(StatComponent stats) {
    for (ObjectMap.Entry<StatComponent.BaseStat, Float> percentageChange : percentageStats.entries()) {
        float value = stats.getCurrentStat(percentageChange.key);
        stats.setCurrentStat(percentageChange.key, value + value * percentageChange.value);
    }
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:8,代码来源:StatusEffect.java

示例9: applyBasePercentage

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public void applyBasePercentage(StatComponent stats) {
    for (ObjectMap.Entry<StatComponent.BaseStat, Float> percentageBaseChange : percentageBaseStats.entries()) {
        float value = stats.getBaseStat(percentageBaseChange.key);
        stats.setCurrentStat(percentageBaseChange.key, stats.getCurrentStat(percentageBaseChange.key) + value * percentageBaseChange.value);
    }
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:8,代码来源:StatusEffect.java

示例10: handleInput

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
 * Calls the responsible {@link InputEvent} for the key, or none if no {@link InputEvent} for this key exists.
 *
 * @param key the key input to be handled
 */
public void handleInput(int key) {
    for (ObjectMap.Entry<IInputConfig.InputKeys, InputEvent> ent : inputEvents.entries())
        if (IInputConfig.InputKeys.getFromKey(ent.key, inputConfig) == key) {
            ent.value.onInput();
            break;
        }
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:13,代码来源:InputMapper.java

示例11: setActiveEnvironment

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
 * Sets the current active {@link Environment}.
 * 
 * @param env the new active Environment
 */
public void setActiveEnvironment(Environment env) {
    this.activeEnvironment = null;

    for (ObjectMap.Entry<String, Environment> entry : this.environments.entries()) {
        if (entry.value.equals(env)) {
            this.activeEnvironment = entry.key;
            break;
        }
    }
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:16,代码来源:EnvironmentManager.java

示例12: getDependencies

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, P parameters) {
    final Array<AssetDescriptor> deps = new Array();
    ModelData data = loadModelData(file, parameters);
    if (data == null) return deps;

    ObjectMap.Entry<String, ModelData> item = new ObjectMap.Entry<String, ModelData>();
    item.key = fileName;
    item.value = data;

    synchronized (items) {
        items.add(item);
    }

    TextureLoader.TextureParameter textureParameter = (parameters != null)
            ? parameters.textureParameter
            : defaultParameters.textureParameter;

    for (final ModelMaterial modelMaterial : data.materials) {
        if (modelMaterial.textures != null) {
            for (final ModelTexture modelTexture : modelMaterial.textures) {
                String fName = modelTexture.fileName;

                if (fName.contains("/")) {
                    fName = fName.substring(fName.lastIndexOf("/") + 1);
                }

                deps.add(new AssetDescriptor(currentAsset.dependenciesPath + fName, Texture.class, textureParameter));
            }
        }
    }

    return deps;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:35,代码来源:NhgModelLoader.java

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

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

示例15: clear

import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
 * Removes all items from all bags of this inventory.
 */
public void clear() {
	for (ObjectMap.Entry<BagType, IntMap<InventoryItem>> bag : bags.entries()) {
		Iterator<Entry<InventoryItem>> iterator = bag.value.iterator();
		while (iterator.hasNext()) {
			InventoryItem item = iterator.next().value;
			item.setInventory(null);
			onItemRemove(item, bag.key);
			iterator.remove();
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:15,代码来源:Inventory.java


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