本文整理匯總了Java中com.badlogic.gdx.utils.Array.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java Array.addAll方法的具體用法?Java Array.addAll怎麽用?Java Array.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.utils.Array
的用法示例。
在下文中一共展示了Array.addAll方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getInteractionQueue
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
@NotNull
private Array<WorldObject> getInteractionQueue() {
Array<WorldObject> objects = new Array<>();
// get level, and don't interact if level is not found
Level level = Level.getEntityLevel(this);
if(level == null) return objects;
Rectangle interactionBounds = getInteractionRect();
objects.addAll(level.getOverlappingEntities(interactionBounds, this));
Tile tile = level.getClosestTile(interactionBounds);
if(tile != null)
objects.add(tile);
return objects;
}
示例2: getProperties
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
public Array<TypeProperty> getProperties(){
Array<TypeProperty> ret_properties = new Array<TiledObjectTypes.TypeProperty>();
ret_properties.addAll(template_type.getProperties());
if(parent_type!=null) {
Array<TypeProperty> parent_properties = parent_type.getProperties();
for(int i = 0;i < parent_properties.size;i++) {
boolean added = false;
for(int l = 0;l < ret_properties.size;l++) {
if(parent_properties.get(i).getName().equals(ret_properties.get(l).getName())) {
added = true;
break;
}
}
if(!added)
ret_properties.add(parent_properties.get(i));
}
}
return ret_properties;
}
示例3: query
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
public void query(Rectangle rect, Array<IQuadTreeObject> ret) {
if(type == -1) {
// this is root node
ret.addAll(objs);
}
if(!rect.overlaps(_rect)) { //������ýڵ㲻�ཻ��ֱ���˳�
return;
}
// System.out.println("query node : success -------------------");
//�ڵ�ռ�Ҳ��Ŷ���ͨ���ཻ������ȫ�����
for(int i = objs.size - 1; i >= 0; --i) {
ret.add(objs.get(i));
}
// ret.addAll(objs);
if(sides != null) {
//�����߿ռ�
for(int i = 0; i < sides.length; ++i) {
//��Ҫ�߶��Լ�ȥ�ж��Ƿ���������
sides[i].query(rect, ret);
}
}
if(children != null) {
for(int i = 0; i < children.length; ++i) {
children[i].query(rect, ret);
}
}
}
示例4: query
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
public void query(Rectangle rect, Array<IQuadTreeObject> ret) {
if(type == -1) {
// this is root node
ret.addAll(objs);
}
if(!rect.overlaps(_rect)) { //������ýڵ㲻�ཻ��ֱ���˳�
return;
}
// System.out.println("query node : success -------------------");
if(this.children == null || sides == null) {
//û���ӽڵ� ������ж�����˳�
ret.addAll(objs);
return;
}
if(sides != null) {
//�����߿ռ�
for(int i = 0; i < sides.length; ++i) {
//��Ҫ�߶��Լ�ȥ�ж��Ƿ���������
sides[i].query(rect, ret);
}
}
if(children != null) {
for(int i = 0; i < children.length; ++i) {
children[i].query(rect, ret);
}
}
}
示例5: update
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
@Override
public void update(float delta) {
Level level = getLevel();
if(level == null) return;
Array<WorldObject> objects = new Array<>();
objects.addAll(level.getOverlappingEntities(getBounds(), this));
Tile tile = level.getClosestTile(getBounds());
if(tile != null) objects.add(tile);
for(WorldObject obj: objects)
obj.touching(this);
}
示例6: convertToOneDimensionArray
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
private static <T> Array<T> convertToOneDimensionArray(T[][] frames)
{
int size = frames.length * frames[0].length;
Array<T> newArray = new Array<>(true, size);
for(T[] framesTable : frames)
newArray.addAll(framesTable);
return newArray;
}
示例7: dispatchTouchEvent
import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Touch event needs to be processed different with other events since it needs support ALL_AT_ONCE and ONE_BY_NONE mode. */
public void dispatchTouchEvent(EventTouch event) {
sortEventListeners(EventListenerTouchOneByOne.LISTENER_ID);
sortEventListeners(EventListenerTouchAllAtOnce.LISTENER_ID);
EventListenerVector oneByOneListeners = getListeners(EventListenerTouchOneByOne.LISTENER_ID);
EventListenerVector allAtOnceListeners = getListeners(EventListenerTouchAllAtOnce.LISTENER_ID);
// If there aren't any touch listeners, return directly.
if (null == oneByOneListeners && null == allAtOnceListeners) {return;}
boolean isNeedsMutableSet = (oneByOneListeners != null && allAtOnceListeners != null);
final Array<Touch> originalTouches = event.getTouches();
//TODO stack
_poolTouchArray.clear();
Array<Touch> mutableTouches = _poolTouchArray;
mutableTouches.clear();
mutableTouches.addAll(originalTouches);
//
// process the target handlers 1st
//
if (oneByOneListeners != null) {
int mutableTouchesIter = 0;
int touchesIter = 0;
for (; touchesIter < originalTouches.size; ++touchesIter)
{
boolean isSwallowed = false;
Touch currTouch = originalTouches.get(touchesIter);
//
onTouchEvent.init(event, currTouch, isNeedsMutableSet, isSwallowed,
mutableTouches, mutableTouchesIter);
dispatchTouchEventToListeners(oneByOneListeners, onTouchEvent);
isSwallowed = onTouchEvent.isSwallowed;
mutableTouchesIter = onTouchEvent.mutableTouchesIter;
if (event.isStopped()) {return;}
if (!isSwallowed) {++mutableTouchesIter;}
}
}
//
// process standard handlers 2nd
//
if (allAtOnceListeners != null && mutableTouches.size > 0) {
onTouchesEvent.init(event, mutableTouches);
dispatchTouchEventToListeners(allAtOnceListeners, onTouchesEvent);
if (event.isStopped()) {return;}
}
updateListeners(event);
}