本文整理汇总了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);
}
});
}
示例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);
}
示例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;
}
示例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;
}