Java 类com.badlogic.gdx.utils.ObjectMap.Entry 实例源码

项目:Quilly-s-Castle    文件:ProfileManager.java   
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!");
   }
项目:fabulae    文件:AnimationMap.java   
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;
}
项目:fabulae    文件:GameMap.java   
/**
 * 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());
    }
}
项目:fabulae    文件:CrimeManager.java   
/**
 * 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);
    }
}
项目:fabulae    文件:AbstractGameCharacter.java   
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();
    }
}
项目:fabulae    文件:SpellTooltip.java   
@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);
        }
    }
}
项目:fabulae    文件:StorySequencePanelLoader.java   
@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);
    }
}
项目:fabulae    文件:LoadingMapScreen.java   
/**
 * 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");
}
项目:fabulae    文件:AssetMap.java   
@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;
        }
    };
}
项目:gdx-autumn-mvc    文件:SkinAssetAnnotationProcessor.java   
/** 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;
}
项目:gdx-lml    文件:TableCellLmlMacroTag.java   
/** 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);
            }
        }
    }
}
项目:gdx-lml    文件:AbstractActorLmlTag.java   
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);
        }
    }
}
项目:gdx-lml    文件:Dtd.java   
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());
        }
    }
}
项目:gdx-lml    文件:LmlUtilities.java   
/** 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);
        }
    }
}
项目:gdx-lml    文件:SkinAssetAnnotationProcessor.java   
/** 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;
}
项目:gdx-http    文件:DefaultHttpClient.java   
@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));
}
项目:libgdxcn    文件:PropertiesUtils.java   
private static void storeImpl (ObjectMap<String, String> properties, Writer writer, String comment, boolean escapeUnicode)
    throws IOException {
    if (comment != null) {
        writeComment(writer, comment);
    }
    writer.write("#");
    writer.write(new Date().toString());
    writer.write(LINE_SEPARATOR);

    StringBuilder sb = new StringBuilder(200);
    for (Entry<String, String> entry : properties.entries()) {
        dumpString(sb, entry.key, true, escapeUnicode);
        sb.append('=');
        dumpString(sb, entry.value, false, escapeUnicode);
        writer.write(LINE_SEPARATOR);
        writer.write(sb.toString());
        sb.setLength(0);
    }
    writer.flush();
}
项目:libgdxcn    文件:SkinLoader.java   
@Override
public Skin loadSync (AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) {
    String textureAtlasPath;
    ObjectMap<String, Object> resources;
    if (parameter == null) {
        textureAtlasPath = file.pathWithoutExtension() + ".atlas";
        resources = null;
    } else {
        textureAtlasPath = parameter.textureAtlasPath;
        resources = parameter.resources;
    }
    TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class);
    Skin skin = new Skin(atlas);
    if (resources != null) {
        for (Entry<String, Object> entry : resources.entries()) {
            skin.add(entry.key, entry.value);
        }
    }
    skin.load(file);
    return skin;
}
项目:Ashley    文件:Engine.java   
private void updateFamilyMembership(Entity entity) {
    for (Entry<Family, Array<Entity>> entry : families.entries()) {
        Family family = entry.key;
        Array<Entity> entities = entry.value;
        int familyIndex = family.getIndex();

        boolean belongsToFamily = entity.getFamilyBits().get(familyIndex);
        boolean matches = family.matches(entity);

        if (!belongsToFamily && matches) {
            entities.add(entity);
            entity.getFamilyBits().set(familyIndex);

            notifyFamilyListenersAdd(family, entity);
        } else if (belongsToFamily && !matches) {
            entities.removeValue(entity, true);
            entity.getFamilyBits().clear(familyIndex);

            notifyFamilyListenersRemove(family, entity);
        }
    }
}
项目:ead    文件:ExtendedSkinLoader.java   
@Override
public Skin loadSync(AssetManager manager, String fileName,
        FileHandle file, SkinParameter parameter) {
    String textureAtlasPath;
    ObjectMap<String, Object> resources;
    if (parameter == null) {
        textureAtlasPath = file.pathWithoutExtension() + ".atlas";
        resources = null;
    } else {
        textureAtlasPath = parameter.textureAtlasPath;
        resources = parameter.resources;
    }
    TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class);
    Skin skin = new ExtendedSkin(assets, atlas);
    if (resources != null) {
        for (Entry<String, Object> entry : resources.entries()) {
            skin.add(entry.key, entry.value);
        }
    }
    skin.load(file);
    return skin;
}
项目:ead    文件:ShaderComponent.java   
public void prepare() {
    for (Entry<String, String[]> entry : uniforms.entries()) {
        switch (entry.value.length) {
        case 1:
            shaderProgram.setUniformf(entry.key, values(entry.value)[0]);
            break;
        case 2:
            shaderProgram.setUniform2fv(entry.key, values(entry.value), 0,
                    2);
            break;
        case 3:
            shaderProgram.setUniform3fv(entry.key, values(entry.value), 0,
                    3);
            break;
        case 4:
            shaderProgram.setUniform4fv(entry.key, values(entry.value), 0,
                    4);
            break;
        }
    }
}
项目:ead    文件:AnimationsEditor.java   
@Override
protected void read(ModelEntity entity, ModelComponent component) {
    for (Entry<String, TransformAnimationEditor> entry : editors.entries()) {
        entry.value.setEntity(entity);

        ModelComponent animation = Q.getComponentById(entity, entry.key);
        if (animation == null) {
            entry.value.setEnable(false);
        } else {
            entry.value.setEnable(true);
            entry.value.read((TransformAnimation) animation);
        }
        entry.value.close(false);
    }

}
项目:shadow-engine    文件:NetStream.java   
/**
 * Queues the given object or sends directly when needed.
 * @param o Object to send
 * @param target Target, for example an Connection in KryoNet
 * @param priority true whether to send now, false if the operation should be queued.
 */
public final void send(Object o, Object target, boolean priority) {
    if (priority) {
        Data data;

        if (o instanceof Data) {
            data = (Data) o;
        } else {
            data = new DataObject(o);
        }

        if (data.getOrdered()) {
            sendTCP(data, target);
        } else {
            sendUDP(data, target);
        }
    } else {
        Entry entry = new Entry();
        entry.key = target;
        entry.value = o;
        queueSend.add(entry);
    }
}
项目:RuinsOfRevenge    文件:JsonDOM.java   
@SuppressWarnings("unchecked")
public void readJsonObject(JsonObject element, OrderedMap<String, Object> jsonData) {
    Entries<String, Object> entries = jsonData.entries();
    for (Entry<String, Object> entry : entries) {
        if (entry.value instanceof OrderedMap) {
            JsonObject obj = new JsonObject();
            element.elements.put(entry.key, obj);

            // unchecked, but safe:
            readJsonObject(obj, (OrderedMap<String, Object>) entry.value);
        } else if (entry.value instanceof Array) {
            JsonArray arr = new JsonArray();
            element.elements.put(entry.key, arr);

            // unchecked, but safe:
            readJsonArray(arr, (Array<OrderedMap<String, Object>>) entry.value);
        } else {
            element.values.put(entry.key, entry.value.toString());
        }
    }
}
项目:ingress-indonesia-dev    文件:Skin$2.java   
private void readNamedObjects(Json paramJson, Class paramClass, ObjectMap<String, ObjectMap> paramObjectMap)
{
  if (paramClass == Skin.TintedDrawable.class);
  for (Object localObject1 = Drawable.class; ; localObject1 = paramClass)
  {
    Iterator localIterator = paramObjectMap.entries().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
        return;
      ObjectMap.Entry localEntry = (ObjectMap.Entry)localIterator.next();
      String str = (String)localEntry.key;
      Object localObject2 = paramJson.readValue(paramClass, localEntry.value);
      if (localObject2 != null)
        try
        {
          this.this$0.add(str, localObject2, (Class)localObject1);
        }
        catch (Exception localException)
        {
          throw new SerializationException("Error reading " + paramClass.getSimpleName() + ": " + (String)localEntry.key, localException);
        }
    }
  }
}
项目:ingress-indonesia-dev    文件:Skin$2.java   
public Skin read(Json paramJson, Object paramObject, Class paramClass)
{
  Iterator localIterator = ((ObjectMap)paramObject).entries().iterator();
  while (localIterator.hasNext())
  {
    ObjectMap.Entry localEntry = (ObjectMap.Entry)localIterator.next();
    String str = (String)localEntry.key;
    ObjectMap localObjectMap = (ObjectMap)localEntry.value;
    try
    {
      readNamedObjects(paramJson, Class.forName(str), localObjectMap);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new SerializationException(localClassNotFoundException);
    }
  }
  return this.val$skin;
}
项目:typing-label    文件:TypingLabel.java   
/** 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);
    }
}
项目:typing-label    文件:TypingLabel.java   
/** Registers a set of variables and their respective replacement values to this label. */
public void setVariables (java.util.Map<String, String> variableMap) {
    this.variables.clear();
    for (java.util.Map.Entry<String, String> entry : variableMap.entrySet()) {
        this.variables.put(entry.getKey().toUpperCase(), entry.getValue());
    }
}
项目:skin-composer    文件:StyleData.java   
public StyleData(StyleData styleData, String styleName, Main main) {
    name = styleName;
    this.main = main;

    clazz = styleData.clazz;
    properties = new OrderedMap<>();
    for (Entry<String, StyleProperty> entry : styleData.properties.entries()) {
        properties.put(entry.key, new StyleProperty(entry.value));
    }
    deletable = true;
}
项目:Inspiration    文件:BehaviorTreeParser.java   
private void checkRequiredAttributes (StackedTask<E> stackedTask) {
    // Check the minimum number of children
    Entries<String, AttrInfo> entries = stackedTask.metadata.attributes.iterator();
    while (entries.hasNext()) {
        Entry<String, AttrInfo> entry = entries.next();
        if (entry.value.required && !encounteredAttributes.contains(entry.key))
            throw stackedTaskException(stackedTask, "missing required attribute '" + entry.key + "'");
    }
}
项目:fabulae    文件:GameMap.java   
public void getTrapsToDraw(ObjectMap<TrapLocation, FilledPolygonRenderer> returnValue, Rectangle cullingRectangle) {
    returnValue.clear();
    for (Entry<TrapLocation, FilledPolygonRenderer> entry : traps.entries()) {
        if (!entry.key.getTrap().isDisarmed() && entry.key.getTrap().isDetected()) {
            // TODO: this is not exactly precise and would not work
            // if the trap was larger than the culling rectangle without any
            // vertices in it 
            if (MathUtil.containsAnyVertex(cullingRectangle, entry.key.s_polygon)) {
                returnValue.put(entry.key, entry.value);
            }
        }
    }
}
项目:fabulae    文件:Spell.java   
/**
 * Gathers all Spells and registers them in the AssetManager so that they can
 * be later loaded by the asset loader.
 * 
 * @throws IOException
 */
public static void gatherSpellImages() throws IOException {
    AssetMap assetStore = new AssetMap(); 
    for (String id: spells.keys()) {
        getSpell(id).gatherAssets(assetStore);
    }
    for(Entry<String, Class<?>> entry : assetStore) {
        Assets.getAssetManager().load(entry.key, entry.value);
    }
}
项目:fabulae    文件:Spell.java   
@Override
public void executeEffects(AbstractGameCharacter user, TargetType target) {
    super.executeEffects(user, target);
    if (user instanceof InventoryContainer) {
        Inventory inventory = ((InventoryContainer) user).getInventory();
        for (Entry<String, Boolean> focusEntry : foci)  {
            if (focusEntry.value) {
                InventoryItem item = inventory.removeItem(focusEntry.key);
                if (item != null) {
                    Log.logLocalized("itemDestroyed", LogType.INVENTORY, item.getName());
                }
            }
        }
    }
}
项目:fabulae    文件:Weapon.java   
@Override
public InventoryItem createNewInstance() {
    Weapon newInstance = (Weapon) super.createNewInstance();
    newInstance.effects = new OrderedMap<Effect, Array<EffectParameter>>();
    for (Entry<Effect, Array<EffectParameter>> entry : this.effects.entries()) {
        newInstance.effects.put(entry.key, entry.value);
    }
    return newInstance;     
}
项目:fabulae    文件:Formation.java   
@Override
public void writeToXML(XmlWriter writer) throws IOException {
    writer.element(XML_FORMATION);
    writer.attribute(XML_FORMATION_ORIENTATION, orientation);
    for(Entry<Integer, Tile> entry : formation.entries()) {
        writer.element(CharacterGroup.XML_MEMBER).attribute(XML_ATTRIBUTE_INDEX, entry.key.toString()).attribute(XML_ATTRIBUTE_XOFFSET, entry.value.getX()).attribute(XML_ATTRIBUTE_YOFFSET, entry.value.getY()).pop();
    }
    writer.pop();
}
项目:fabulae    文件:PlayerCharacterGroupGameObject.java   
@Override
public void update(float deltaTime) {
    super.update(deltaTime);
    if (getMap() != null) {
        float gameSeconds = deltaTime * getMap().getGameTimeMultiplier();
        float effectDurationDelta = gameSeconds / Configuration.getCombatTurnDurationInGameSeconds();
        Array<GameCharacter> pcs = group.getPlayerCharacters();
        for (int i = 0; i < pcs.size; ++i) {
            GameCharacter character = pcs.get(i);
            if (character.isActive()) {
                character.updateSurvival(gameSeconds);
            }

            character.updatePersistentEffects(effectDurationDelta);
        }

        Entries<GameCharacter, Array<Action>> entries = pcActionsToUpdate.entries();

        for (Entry<GameCharacter, Array<Action>> entry : entries) {
            Iterator<Action> actions = entry.value.iterator();
            while (actions.hasNext()) {
                Action action = actions.next();
                if (action.isPaused()) {
                    continue;
                }
                action.update(deltaTime);
                if (action.isFinished()) {
                    actions.remove();
                    entry.key.removeAction(action);
                }
            }
            if (entry.value.size < 1) {
                entries.remove();
            }
        }

    }
}
项目:fabulae    文件:Perk.java   
/**
 * Gathers all Perks and registers them in the AssetManager so that they can
 * be later loaded by the asset loader.
 * 
 * @throws IOException
 */
public static void gatherPerkImages() throws IOException {
    AssetMap assetStore = new AssetMap(); 
    for (String id: perks.keys()) {
        getPerk(id).gatherAssets(assetStore);
    }
    for(Entry<String, Class<?>> entry : assetStore) {
        Assets.getAssetManager().load(entry.key, entry.value);
    }
}
项目:fabulae    文件:AbstractGameCharacter.java   
@Override
public void writeToXML(XmlWriter writer) throws IOException {
    super.writeToXML(writer);

    brain.writeToXML(writer);

    if (temporaryHostility.size > 0) {
        writer.element(XML_TEMPORARY_HOSTILITY);
        for(Entry<Faction, Pair<GameCalendarDate, Integer>> hostility : temporaryHostility) {
            writer.element(hostility.key.getId());
            writer.element(XML_START);
            hostility.value.getLeft().writeToXML(writer);
            writer.pop();
            writer.element(XML_DURATION, hostility.value.getRight());
            writer.pop();
        }
        writer.pop();
    }

    if (visitedLocations.size() > 0) {
        writer.element(XML_VISITED);
        StringBuilder text = StringUtil.getFSB();
        int i = 0;
        for (String location : visitedLocations) {
            ++i;
            text.append(location);
            if (i < visitedLocations.size()) {
                text.append(", "); 
            }
        }
        writer.text(text);
        StringUtil.freeFSB(text);
        writer.pop();
    }
}
项目:fabulae    文件:AIScriptPackage.java   
public Action run(GameObject go) {
    if (aiScript != null) {
        Binding binding = new Binding();
        binding.setVariable("character", go);
        for (Entry<String, Object> parameter : parameters.entries()) {
            binding.setVariable(parameter.key, parameter.value);
        }
        return (Action) aiScript.run(binding);
    }
    return null;
}
项目:fabulae    文件:ModuleLoadingScreen.java   
private void loadGlobalAssets() {
    if (!assetsGathered.contains(AssetsToLoad.GlobalAssets)) {
        final AssetMap assetsToLoad = new AssetMap();
        Configuration.gatherGlobalAssets(assetsToLoad);
        for (final Entry<String, Class<?>> entry : assetsToLoad) {
            am.load(entry.key, entry.value);
        }
        assetsGathered.add(AssetsToLoad.GlobalAssets);
    }
    if (am.update()) {
        loaded.add(AssetsToLoad.GlobalAssets);
    }
}