本文整理汇总了Java中com.badlogic.gdx.utils.ObjectSet.clear方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectSet.clear方法的具体用法?Java ObjectSet.clear怎么用?Java ObjectSet.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.ObjectSet
的用法示例。
在下文中一共展示了ObjectSet.clear方法的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: clearAll
import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param sets will all be cleared, with an additional null-check before the clearing. */
public static void clearAll(final ObjectSet<?>... sets) {
for (final ObjectSet<?> set : sets) {
if (set != null) {
set.clear();
}
}
}
示例4: reset
import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
protected void reset (ObjectSet<T> object) {
object.clear();
}