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


Java ObjectSet.addAll方法代码示例

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


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

示例1: loadInvitations

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void loadInvitations(InvitationBuffer invitations) {
    ObjectSet<String> tmp = Pools.obtain(ObjectSet.class);
    tmp.addAll(invites);
    invites.clear();
    for (Invitation invitation : invitations) {
        invites.add(invitation.getInvitationId());
        if (!tmp.contains(invitation.getInvitationId())) {
            showInvitation(invitation);
        }
    }
    tmp.clear();
    Pools.free(tmp);
    Gdx.app.postRunnable(new Runnable() {
        @Override public void run() {
            invitesDispatcher.setState(invites.size);
        }
    });
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:20,代码来源:GameServicesMultiplayer.java

示例2: autoPlace

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void autoPlace() {
    if (placed.size > 0) {
        ObjectSet<Creature> tmp = Pools.obtain(ObjectSet.class);
        tmp.addAll(placed);
        for (Creature c : tmp) {
            removeFromPlaced(c);
        }
        tmp.clear();
        Pools.free(tmp);
    }
    Array<Grid2D.Coordinate> coordinates = Pools.obtain(Array.class);
    Set<Map.Entry<Grid2D.Coordinate, Fraction>> spawns = world.level.getElements(LevelElementType.spawn);
    for (Map.Entry<Grid2D.Coordinate, Fraction> e : spawns) {
        if (e.getValue() == world.viewer.fraction) {
            coordinates.add(e.getKey());
        }
    }
    coordinates.shuffle();
    int usedCount = Math.min(creatures.size, coordinates.size);
    Array<Creature> toPlace = Pools.obtain(Array.class);
    toPlace.addAll(creatures);
    toPlace.shuffle();
    toPlace.truncate(usedCount);
    for (Creature creature : toPlace) {
        Grid2D.Coordinate coordinate = coordinates.pop();
        place(creature, coordinate.x(), coordinate.y());
    }
    toPlace.clear();
    coordinates.clear();
    Pools.free(toPlace);
    Pools.free(coordinates);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:34,代码来源:SpawnController.java

示例3: unionTo

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param set will contain all values present in passed sets.
 * @return first set argument will all values present in other passed sets. */
public static <Type> ObjectSet<Type> unionTo(final ObjectSet<Type> set, final ObjectSet<Type>... sets) {
    if (sets == null || sets.length == 0) {
        return set;
    }
    for (final ObjectSet<Type> unionedSet : sets) {
        set.addAll(unionedSet);
    }
    return set;
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:12,代码来源:GdxSets.java

示例4: unionTo

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param set will contain all values present in passed sets. Will be returned.
 * @param sets cannot be null.
 * @return first set argument will all values present in other passed sets.
 * @param <Type> type of stored values. */
public static <Type> ObjectSet<Type> unionTo(final ObjectSet<Type> set, final ObjectSet<Type>... sets) {
    if (sets == null || sets.length == 0) {
        return set;
    }
    for (final ObjectSet<Type> unionedSet : sets) {
        set.addAll(unionedSet);
    }
    return set;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:14,代码来源:GdxSets.java


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