本文整理汇总了Java中com.badlogic.gdx.utils.IntMap.Entry类的典型用法代码示例。如果您正苦于以下问题:Java Entry类的具体用法?Java Entry怎么用?Java Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entry类属于com.badlogic.gdx.utils.IntMap包,在下文中一共展示了Entry类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: copyAllItemsTo
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
/**
* Copies all items from this inventory into the destination inventory
*/
public void copyAllItemsTo(Inventory destinationInventory) {
for (BagType bag : BagType.values()) {
IntMap<InventoryItem> sourceBag = getBag(bag);
for (Entry<InventoryItem> slot : sourceBag.entries()) {
InventoryItem item = slot.value;
if (item != null) {
InventoryItem newCopy = item.createNewInstance();
if (item.getStackSize() > 1) {
for (int i = 1; i < item.getStackSize(); ++i) {
newCopy.addToStack(newCopy.createNewInstance());
}
}
destinationInventory.addToBag(bag, newCopy, slot.key);
}
}
}
}
开发者ID:mganzarcik,项目名称:fabulae,代码行数:21,代码来源:Inventory.java
示例2: gatherControllers
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
private void gatherControllers(boolean sendEvent) {
// gather all joysticks and gamepads, remove any disconnected ones
IntMap<AndroidController> removedControllers = new IntMap<AndroidController>();
removedControllers.putAll(controllerMap);
for(int deviceId: InputDevice.getDeviceIds()) {
InputDevice device = InputDevice.getDevice(deviceId);
AndroidController controller = controllerMap.get(deviceId);
if(controller != null) {
removedControllers.remove(deviceId);
} else {
addController(deviceId, sendEvent);
}
}
for(Entry<AndroidController> entry: removedControllers.entries()) {
removeController(entry.key);
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:20,代码来源:AndroidControllers.java
示例3: map
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
private static IntMap<BlockPair> map(Object...objects){
IntMap<BlockPair> colors = new IntMap<>();
for(int i = 0; i < objects.length/2; i ++){
colors.put(Color.rgba8888(Color.valueOf((String)objects[i*2])), (BlockPair)objects[i*2+1]);
pairs.add((BlockPair)objects[i*2+1]);
}
for(Entry<BlockPair> e : colors.entries()){
reverseColors.put(e.value.wall == Blocks.air ? e.value.floor : e.value.wall, e.key);
}
return colors;
}
开发者ID:Anuken,项目名称:Mindustry,代码行数:12,代码来源:ColorMapper.java
示例4: findAcceptableSlot
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
private int findAcceptableSlot(IntMap<InventoryItem> bag, InventoryItem item) {
int slot = 0;
// first check for occupied slot that's stackable with the item
for (Entry<InventoryItem> entry: bag.entries()) {
if (entry.value.isStackable(item)) {
return entry.key;
}
}
// then search for an embty slot
while (bag.containsKey(slot)) {
++slot;
}
return slot;
}
开发者ID:mganzarcik,项目名称:fabulae,代码行数:15,代码来源:Inventory.java
示例5: clear
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的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
示例6: writeToXML
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
/**
* Writes the Inventory into XML using the supplied XmlWriter.
*
* The output XML will look like this:
*
* <pre>
* <Inventory>
* <BagType>
* <Item id="itemId" slot="inventorySlot" />
* ...
* </BagType>
* </Inventory>
* </pre>
*/
@Override
public void writeToXML(XmlWriter writer) throws IOException {
writer.element(Inventory.XML_INVENTORY);
for (BagType bagType : BagType.values()) {
IntMap<InventoryItem> bag = getBag(bagType);
if (bag.size > 0) {
writer.element(bagType.toString().toLowerCase(Locale.ENGLISH));
Entries<InventoryItem> bagIterator = bag.entries();
while (bagIterator.hasNext) {
Entry<InventoryItem> entry = bagIterator.next();
writer.element(Inventory.XML_ITEM)
.attribute(XMLUtil.XML_ATTRIBUTE_ID, entry.value.getId())
.attribute(XML_ATTRIBUTE_SLOT, entry.key)
.attribute(XML_ATTRIBUTE_STACK_SIZE,
entry.value.getStackSize());
ItemOwner itemOwner = entry.value.getOwner();
String ownerId =itemOwner.getOwnerCharacterId();
if (ownerId != null) {
writer.attribute(XML_ATTRIBUTE_OWNER_CHARACTER, ownerId);
}
Faction faction = itemOwner.getOwnerFaction();
if (faction != null) {
writer.attribute(XML_ATTRIBUTE_OWNER_FACTION, faction);
}
writer.pop();
}
writer.pop();
}
}
writer.pop();
}
开发者ID:mganzarcik,项目名称:fabulae,代码行数:49,代码来源:Inventory.java
示例7: getPlayerForConnection
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
public Player getPlayerForConnection (Object connectionInformation) {
Iterator<Entry<Player>> entries = players.iterator();
Entry<Player> entry = null;
if (entries.hasNext())
while ((entry = entries.next()) != null) {
if (entry.value.connectionInformation == connectionInformation) {
return entry.value;
}
}
return null;
}
开发者ID:Quexten,项目名称:RavTech,代码行数:13,代码来源:Lobby.java
示例8: cloneObject
import com.badlogic.gdx.utils.IntMap.Entry; //导入依赖的package包/类
@Override
protected IntMap cloneObject (IntMap original, IDeepCloner cloner, Map<Object, Object> clones) {
IntMap map = new IntMap(original.size);
for (Object object : original.entries()) {
Entry entry = (Entry) object;
map.put(entry.key, cloner.deepClone(entry.value, clones));
}
return map;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:12,代码来源:IntMapCloner.java
注:本文中的com.badlogic.gdx.utils.IntMap.Entry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论