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


Java Entry类代码示例

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


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

示例1: loadProfile

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的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: AnimationMap

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
public AnimationMap(AnimationMap<T> toCopy) {
	this.animationInfoMap = new ObjectMap<Integer, Array<AnimationDescription>>();
	
	for (Entry<Integer, Array<AnimationDescription>> entry : toCopy.animationInfoMap.entries()) {
		Array<AnimationDescription> descriptions = new Array<AnimationDescription>();
		animationInfoMap.put(entry.key, descriptions);
		for (AnimationDescription description : entry.value) {
			descriptions.add(description);
		}
	}
	
	frameWidth = toCopy.frameWidth;
	frameHeight = toCopy.frameHeight;
	frameDuration = toCopy.frameDuration;
	animationTexturePath = toCopy.animationTexturePath;
	middleOffsets = new ObjectMap<T, Vector2>(toCopy.middleOffsets);
	middleOffset = toCopy.middleOffset;
	objectWidth = toCopy.objectWidth;
	objectHeight = toCopy.objectHeight;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:21,代码来源:AnimationMap.java

示例3: undispose

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
/**
 * Recreates all disposables.
 */
public void undispose() {
	if (!isDisposed) {
		return;
	}
	box2DDebugRenderer = new Box2DDebugRenderer(true, true, true, true, true, true);
	fogOfWarWorld = new World(new Vector2(0, 0), true);
	lightsWorld = new World(new Vector2(0, 0), true);
	createFogOfWarRayHandler();
	createLightsRayHandler();
	createViewConesRayHandler();
	
	isDisposed = false;
	
	for (int i = 0; i < gameObjects.size; ++i) {
		gameObjects.get(i).undispose();
	}
	
	for (Entry<TrapLocation, FilledPolygonRenderer> entry : traps.entries()) {
		traps.put(entry.key, entry.key.createRenderer());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:25,代码来源:GameMap.java

示例4: spreadCrimeInfo

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的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

示例5: updateTemporaryHostility

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
private void updateTemporaryHostility() {
	// only update this outside of combat
	if (gameState.getCurrentMap() == null || GameState.isCombatInProgress()) {
		return;
	}
	Iterator<Entry<Faction, Pair<GameCalendarDate,Integer>>> iterator = temporaryHostility.entries().iterator();
	GameCalendarDate currDate = GameState.getCurrentGameDate();
	boolean changed = false;
	while (iterator.hasNext()) {
		Entry<Faction, Pair<GameCalendarDate,Integer>> entry = iterator.next();
		GameCalendarDate startDate = new GameCalendarDate(entry.value.getLeft());
		Integer durationHours = entry.value.getRight();
		
		startDate.addToHour(durationHours);
		if (startDate.compareTo(currDate) < 0) {
			iterator.remove();
			changed = true;
		}
	}
	if (changed) {
		resetCharacterCircleColor();
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:AbstractGameCharacter.java

示例6: buildActivationRequirements

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的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

示例7: load

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
@Override
public void load(AssetManager am) {
	unload(am);
	if (storySequence != null) {
		for (AudioTrack<?> music : storySequence.getMusic()) {
			music.gatherAssets(loadedAssets);
		}
		for (StoryPage page : storySequence.getPages()) {
			if (page.isApplicable()) {
				loadedAssets.put(page.getImage(), Texture.class);
			}
		}
	}
	
	for (Entry<String, Class<?>> entry : loadedAssets) {
		am.load(entry.key, entry.value);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:19,代码来源:StorySequencePanelLoader.java

示例8: load

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
/**
 * This uses AssetManager to asynchronously load the map and all assets.
 * 
 * It will return true only once everything is loaded.
 * 
 * This should be called repeatedly from the render method until true is
 * returned.
 * 
 * 
 * @return
 */
public String load() {
	if (!mapLoaded) {
		if (Assets.getAssetManager().update()) {
			mapLoaded = true;				
			AssetMap assetsToLoad = new AssetMap();
			newMap.gatherAssets(assetsToLoad);

			for (Entry<String, Class<?>> entry : assetsToLoad) {
				if (!Configuration.isGlobalAsset(entry.key)) {
					Assets.getAssetManager().load(entry.key,
							entry.value);
				}
			}
			return Strings.getString(UIManager.STRING_TABLE, "mapAssets");
		}
	} else {
		if (Assets.getAssetManager().update()) {
			return null;
		}
		return Strings.getString(UIManager.STRING_TABLE, "mapAssets");
	}
	return Strings.getString(UIManager.STRING_TABLE, "map");
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:35,代码来源:LoadingMapScreen.java

示例9: iterator

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的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

示例10: injectFields

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
/** Invoked when all skins are loaded. Injects skin assets.
 *
 * @param interfaceService used to retrieve skins.
 * @return {@link OnMessage#REMOVE}. */
@SuppressWarnings("unchecked")
@OnMessage(AutumnMessage.SKINS_LOADED)
public boolean injectFields(final InterfaceService interfaceService) {
    for (final Entry<Pair<String, String>, Array<Pair<Field, Object>>> entry : fieldsToInject) {
        final Skin skin = interfaceService.getParser().getData().getSkin(entry.key.getSecond());
        final String assetId = entry.key.getFirst();
        if (skin == null) {
            throw new ContextInitiationException(
                    "Unable to inject asset: " + assetId + ". Unknown skin ID: " + entry.key.getSecond());
        }
        for (final Pair<Field, Object> injection : entry.value) {
            try {
                Reflection.setFieldValue(injection.getFirst(), injection.getSecond(),
                        skin.get(assetId, injection.getFirst().getType()));
            } catch (final ReflectionException exception) {
                throw new GdxRuntimeException("Unable to inject skin asset: " + assetId + " from skin: " + skin
                        + " to field: " + injection.getFirst() + " of component: " + injection.getSecond(),
                        exception);
            }
        }
    }
    fieldsToInject.clear();
    return OnMessage.REMOVE;
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn-mvc,代码行数:29,代码来源:SkinAssetAnnotationProcessor.java

示例11: processCellAttributes

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
/** This is meant to handle cell attributes that will modify the extracted cell.
 *
 * @param attributes named attributes of the macro.
 * @param processedAttributes already processed attributes. Should be ignored.
 * @param table owner of the cell.
 * @param cell cell of the row. Should have its defaults set. */
protected void processCellAttributes(final ObjectMap<String, String> attributes,
        final ObjectSet<String> processedAttributes, final Table table, final Cell<?> cell) {
    final LmlSyntax syntax = getParser().getSyntax();
    for (final Entry<String, String> attribute : attributes) {
        if (processedAttributes.contains(attribute.key)) {
            continue;
        }
        final LmlAttribute<?> cellAttribute = syntax.getAttributeProcessor(table, attribute.key);
        if (cellAttribute instanceof AbstractCellLmlAttribute) {
            ((AbstractCellLmlAttribute) cellAttribute).process(getParser(), getParent(), table, cell,
                    attribute.value);
        } else {
            if (!isInternalMacroAttribute(attribute.key)) {
                getParser().throwErrorIfStrict(getTagName()
                        + " macro can process only cell attributes. Found unknown or invalid attribute: "
                        + attribute.key);
            }
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:27,代码来源:TableCellLmlMacroTag.java

示例12: processBuildingAttributes

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
private void processBuildingAttributes(final LmlActorBuilder builder, final ObjectSet<String> processedAttributes) {
    if (getNamedAttributes() == null) {
        return;
    }
    final LmlSyntax syntax = getParser().getSyntax();
    for (final Entry<String, String> attribute : getNamedAttributes()) {
        // Processing building attributes:
        final LmlBuildingAttribute<LmlActorBuilder> buildingAttributeProcessor = syntax
                .getBuildingAttributeProcessor(builder, attribute.key);
        if (buildingAttributeProcessor != null // This is the actual processing method:
                && buildingAttributeProcessor.process(getParser(), this, builder, attribute.value)) {
            // If processing returns true, the attribute is fully parsed and can be omitted during attribute parsing
            // after the actor is initiated. If it returns false, it is expected that the attribute will be
            // eventually parsed by a second processor, after the widget is created.
            processedAttributes.add(attribute.key);
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:19,代码来源:AbstractActorLmlTag.java

示例13: appendMacroTags

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
protected void appendMacroTags(final Appendable builder, final LmlParser parser) throws IOException {
    if (appendComments) {
        builder.append("<!-- Macro tags: -->\n");
    }
    final String macroMarker = String.valueOf(parser.getSyntax().getMacroMarker());
    if (!macroMarker.matches(XML_ELEMENT_REGEX)) {
        log("Error: current macro marker (" + macroMarker
                + ") is an invalid XML character. Override getMacroMarker in your current LmlSyntax implementation and provide a correct character to create valid DTD file.");
    }
    final ObjectMap<String, LmlTagProvider> macroTags = parser.getSyntax().getMacroTags();
    for (final Entry<String, LmlTagProvider> macroTag : macroTags) {
        appendDtdElement(builder, getTagClassName(macroTag.value), macroMarker, macroTag.key);
        // If the tag is conditional, it should provide an extra name:else tag:
        try {
            final LmlTag tag = macroTag.value.create(parser, null, new StringBuilder(macroTag.key));
            if (tag instanceof AbstractConditionalLmlMacroTag) {
                appendDtdElement(builder, "'Else' helper tag of: " + macroTag.key, macroMarker,
                        macroTag.key + AbstractConditionalLmlMacroTag.ELSE_SUFFIX, "EMPTY");
            }
        } catch (final Exception expected) {
            // Tag might need a parent or additional attributes and cannot be checked. It's OK.
            Exceptions.ignore(expected);
            log("Unable to create a macro tag instance using: " + macroTag.value.getClass().getSimpleName());
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:27,代码来源:Dtd.java

示例14: processAttributes

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
/** Utility method that processes all named attributes of the selected type.
 *
 * @param widget widget (validator, actor - processed element) that will be used to process attributes.
 * @param tag contains attributes.
 * @param parser will be used to parse attributes.
 * @param processedAttributes already processed attribute names. These attributes will be ignored. Optional, can be
 *            null.
 * @param throwExceptionIfAttributeUnknown if true and unknown attribute is found, a strict parser will throw an
 *            exception.
 * @param <Type> type of processed widget. Its class tree will be used to retrieve attributes. */
public static <Type> void processAttributes(final Type widget, final LmlTag tag, final LmlParser parser,
        final ObjectSet<String> processedAttributes, final boolean throwExceptionIfAttributeUnknown) {
    if (GdxMaps.isEmpty(tag.getNamedAttributes())) {
        return;
    }
    final LmlSyntax syntax = parser.getSyntax();
    final boolean hasProcessedAttributes = processedAttributes != null;
    for (final Entry<String, String> attribute : tag.getNamedAttributes()) {
        if (attribute == null || hasProcessedAttributes && processedAttributes.contains(attribute.key)) {
            continue;
        }
        final LmlAttribute<Type> attributeProcessor = syntax.getAttributeProcessor(widget, attribute.key);
        if (attributeProcessor == null) {
            if (throwExceptionIfAttributeUnknown) {
                parser.throwErrorIfStrict("Unknown attribute: \"" + attribute.key + "\" for widget type: "
                        + widget.getClass().getName());
            }
            continue;
        }
        attributeProcessor.process(parser, tag, widget, attribute.value);
        if (hasProcessedAttributes) {
            processedAttributes.add(attribute.key);
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:36,代码来源:LmlUtilities.java

示例15: sendHttpRequest

import com.badlogic.gdx.utils.ObjectMap.Entry; //导入依赖的package包/类
@Override
public void sendHttpRequest(HttpRequest httpRequest, HttpResponseListener httpResponseListener) {

	URI uri = URI.create(httpRequest.getUrl());

	if (cookieMgr != null && !cookieMgr.isEmpty()) {
		String tempCookie = cookieMgr.getHeaderPayload(uri);
		httpRequest.setHeader(HttpClient.HeaderFields.COOKIE, tempCookie);
	}

	if (headerFields.size > 0) {
		for (Entry<String, String> entry : headerFields.entries()) {
			httpRequest.setHeader(entry.key, entry.value);
		}
	}
	// Listener instantiation below...
	Gdx.net.sendHttpRequest(httpRequest, new ResponseWrapper(httpResponseListener, uri));
}
 
开发者ID:failcoDave,项目名称:gdx-http,代码行数:19,代码来源:DefaultHttpClient.java


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