本文整理汇总了Java中master.flame.danmaku.danmaku.model.IDanmakus.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java IDanmakus.iterator方法的具体用法?Java IDanmakus.iterator怎么用?Java IDanmakus.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类master.flame.danmaku.danmaku.model.IDanmakus
的用法示例。
在下文中一共展示了IDanmakus.iterator方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeTimeoutDanmakus
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
private final void removeTimeoutDanmakus(IDanmakus danmakus, long limitTime) {
IDanmakuIterator it = danmakus.iterator();
long startTime = SystemClock.uptimeMillis();
while (it.hasNext()) {
try {
if (it.next().isTimeOut()) {
it.remove();
if (SystemClock.uptimeMillis() - startTime > limitTime) {
return;
}
}
return;
} catch (Exception e) {
return;
}
}
}
示例2: touchHitDanmaku
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
public IDanmakus touchHitDanmaku(float x, float y) {
IDanmakus hitDanmakus = new Danmakus();
this.mDanmakuBounds.setEmpty();
IDanmakus danmakus = this.danmakuView.getCurrentVisibleDanmakus();
if (danmakus != null && !danmakus.isEmpty()) {
IDanmakuIterator iterator = danmakus.iterator();
while (iterator.hasNext()) {
BaseDanmaku danmaku = iterator.next();
if (danmaku != null) {
this.mDanmakuBounds.set(danmaku.getLeft(), danmaku.getTop() - 30.0f, danmaku.getRight(), danmaku.getBottom() + 30.0f);
if (this.mDanmakuBounds.contains(x, y)) {
danmaku.clickX = x;
danmaku.clickY = y;
danmaku.setRectF(this.mDanmakuBounds);
hitDanmakus.addItem(danmaku);
break;
}
}
}
}
return hitDanmakus;
}
示例3: getVisibleDanmakusOnTime
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
@Override
public IDanmakus getVisibleDanmakusOnTime(long time) {
long beginMills = time - mContext.mDanmakuFactory.MAX_DANMAKU_DURATION - 100;
long endMills = time + mContext.mDanmakuFactory.MAX_DANMAKU_DURATION;
IDanmakus subDanmakus = danmakuList.subnew(beginMills, endMills);
IDanmakus visibleDanmakus = new Danmakus();
if (null != subDanmakus && !subDanmakus.isEmpty()) {
IDanmakuIterator iterator = subDanmakus.iterator();
while (iterator.hasNext()) {
BaseDanmaku danmaku = iterator.next();
if (danmaku.isShown() && !danmaku.isOutside()) {
visibleDanmakus.addItem(danmaku);
}
}
}
return visibleDanmakus;
}
示例4: removeTimeoutDanmakus
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
private final void removeTimeoutDanmakus(final IDanmakus danmakus, long limitTime) {
IDanmakuIterator it = danmakus.iterator();
long startTime = SystemClock.uptimeMillis();
while (it.hasNext()) {
try {
BaseDanmaku item = it.next();
if (item.isTimeOut()) {
it.remove();
} else {
break;
}
} catch (Exception e) {
break;
}
if (SystemClock.uptimeMillis() - startTime > limitTime) {
break;
}
}
}
示例5: touchHitDanmaku
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
private IDanmakus touchHitDanmaku(float x, float y) {
IDanmakus hitDanmakus = new Danmakus();
mDanmakuBounds.setEmpty();
IDanmakus danmakus = danmakuView.getCurrentVisibleDanmakus();
if (null != danmakus && !danmakus.isEmpty()) {
IDanmakuIterator iterator = danmakus.iterator();
while (iterator.hasNext()) {
BaseDanmaku danmaku = iterator.next();
if (null != danmaku) {
mDanmakuBounds.set(danmaku.getLeft(), danmaku.getTop(), danmaku.getRight(), danmaku.getBottom());
if (mDanmakuBounds.contains(x, y)) {
hitDanmakus.addItem(danmaku);
}
}
}
}
return hitDanmakus;
}
示例6: getVisibleDanmakusOnTime
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
@Override
public IDanmakus getVisibleDanmakusOnTime(long time) {
long beginMills = time - mContext.mDanmakuFactory.MAX_DANMAKU_DURATION - 100;
long endMills = time + mContext.mDanmakuFactory.MAX_DANMAKU_DURATION;
IDanmakus subDanmakus = danmakuList.sub(beginMills, endMills);
IDanmakus visibleDanmakus = new Danmakus();
if (null != subDanmakus && !subDanmakus.isEmpty()) {
IDanmakuIterator iterator = subDanmakus.iterator();
while (iterator.hasNext()) {
BaseDanmaku danmaku = iterator.next();
if (danmaku.isShown() && !danmaku.isOutside()) {
visibleDanmakus.addItem(danmaku);
}
}
}
return visibleDanmakus;
}
示例7: removeTimeoutDanmakus
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
private final void removeTimeoutDanmakus(final IDanmakus danmakus, long limitTime) {
IDanmakuIterator it = danmakus.iterator();
long startTime = System.currentTimeMillis();
while (it.hasNext()) {
try {
BaseDanmaku item = it.next();
if (item.isTimeOut()) {
it.remove();
} else {
break;
}
} catch (Exception e) {
break;
}
if (System.currentTimeMillis() - startTime > limitTime) {
break;
}
}
}
示例8: getVisibleDanmakusOnTime
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
public IDanmakus getVisibleDanmakusOnTime(long time) {
IDanmakus subDanmakus = this.danmakuList.subnew((time - this.mContext.mDanmakuFactory.MAX_DANMAKU_DURATION) - 100, time + this.mContext.mDanmakuFactory.MAX_DANMAKU_DURATION);
IDanmakus visibleDanmakus = new Danmakus();
if (!(subDanmakus == null || subDanmakus.isEmpty())) {
IDanmakuIterator iterator = subDanmakus.iterator();
while (iterator.hasNext()) {
BaseDanmaku danmaku = iterator.next();
if (danmaku.isShown() && !danmaku.isOutside()) {
visibleDanmakus.addItem(danmaku);
}
}
}
return visibleDanmakus;
}
示例9: draw
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRenderTime) {
int lastTotalDanmakuCount = this.mRenderingState.totalDanmakuCount;
this.mRenderingState.reset();
IDanmakuIterator itr = danmakus.iterator();
int orderInScreen = 0;
this.mStartTimer.update(SystemClock.uptimeMillis());
int sizeInScreen = danmakus.size();
BaseDanmaku drawItem = null;
while (itr.hasNext()) {
drawItem = itr.next();
if (!drawItem.hasPassedFilter()) {
this.mContext.mDanmakuFilters.filter(drawItem, orderInScreen, sizeInScreen, this.mStartTimer, false, this.mContext);
}
if (drawItem.time >= startRenderTime && (!(drawItem.priority == (byte) 0 && drawItem.isFiltered()) && drawItem.time >= startRenderTime)) {
if (!drawItem.isDanmakuTypeFiltered || !drawItem.isFiltered()) {
if (drawItem.isLate()) {
if (this.mCacheManager == null || drawItem.hasDrawingCache()) {
break;
}
this.mCacheManager.addDanmaku(drawItem);
} else {
orderInScreen++;
if (!drawItem.isMeasured()) {
drawItem.measure(disp, false);
}
this.mDanmakusRetainer.fix(drawItem, disp, this.mVerifier);
if (!drawItem.isOutside() && drawItem.isShown()) {
if (drawItem.lines != null || drawItem.getBottom() <= ((float) disp.getHeight())) {
int renderingType = drawItem.draw(disp);
RenderingState renderingState;
if (renderingType == 1) {
renderingState = this.mRenderingState;
renderingState.cacheHitCount++;
} else if (renderingType == 2) {
renderingState = this.mRenderingState;
renderingState.cacheMissCount++;
if (this.mCacheManager != null) {
this.mCacheManager.addDanmaku(drawItem);
}
}
this.mRenderingState.addCount(drawItem.getType(), 1);
this.mRenderingState.addTotalCount(1);
if (!(this.mOnDanmakuShownListener == null || drawItem.firstShownFlag == this.mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG)) {
drawItem.firstShownFlag = this.mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG;
this.mOnDanmakuShownListener.onDanmakuShown(drawItem);
}
}
}
}
}
}
}
this.mRenderingState.nothingRendered = this.mRenderingState.totalDanmakuCount == 0;
this.mRenderingState.endTime = drawItem != null ? drawItem.time : -1;
if (this.mRenderingState.nothingRendered) {
this.mRenderingState.beginTime = -1;
}
this.mRenderingState.incrementCount = this.mRenderingState.totalDanmakuCount - lastTotalDanmakuCount;
this.mRenderingState.consumingTime = this.mStartTimer.update(SystemClock.uptimeMillis());
return this.mRenderingState;
}
示例10: draw
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
@Override
public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRenderTime) {
int lastTotalDanmakuCount = mRenderingState.totalDanmakuCount;
mRenderingState.reset();
IDanmakuIterator itr = danmakus.iterator();
int orderInScreen = 0;
mStartTimer.update(SystemClock.uptimeMillis());
int sizeInScreen = danmakus.size();
BaseDanmaku drawItem = null;
while (itr.hasNext()) {
drawItem = itr.next();
if (!drawItem.hasPassedFilter()) {
mContext.mDanmakuFilters.filter(drawItem, orderInScreen, sizeInScreen, mStartTimer, false, mContext);
}
if (drawItem.time < startRenderTime
|| (drawItem.priority == 0 && drawItem.isFiltered())) {
continue;
}
if (drawItem.isLate()) {
if (mCacheManager != null && !drawItem.hasDrawingCache()) {
mCacheManager.addDanmaku(drawItem);
}
break;
}
if (drawItem.getType() == BaseDanmaku.TYPE_SCROLL_RL){
// 同屏弹幕密度只对滚动弹幕有效
orderInScreen++;
}
// measure
if (!drawItem.isMeasured()) {
drawItem.measure(disp, false);
}
// layout
mDanmakusRetainer.fix(drawItem, disp, mVerifier);
// draw
if (!drawItem.isOutside() && drawItem.isShown()) {
if (drawItem.lines == null && drawItem.getBottom() > disp.getHeight()) {
continue; // skip bottom outside danmaku
}
int renderingType = drawItem.draw(disp);
if(renderingType == IRenderer.CACHE_RENDERING) {
mRenderingState.cacheHitCount++;
} else if(renderingType == IRenderer.TEXT_RENDERING) {
mRenderingState.cacheMissCount++;
if (mCacheManager != null) {
mCacheManager.addDanmaku(drawItem);
}
}
mRenderingState.addCount(drawItem.getType(), 1);
mRenderingState.addTotalCount(1);
if (mOnDanmakuShownListener != null
&& drawItem.firstShownFlag != mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG) {
drawItem.firstShownFlag = mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG;
mOnDanmakuShownListener.onDanmakuShown(drawItem);
}
}
}
mRenderingState.nothingRendered = (mRenderingState.totalDanmakuCount == 0);
mRenderingState.endTime = drawItem != null ? drawItem.time : RenderingState.UNKNOWN_TIME;
if (mRenderingState.nothingRendered) {
mRenderingState.beginTime = RenderingState.UNKNOWN_TIME;
}
mRenderingState.incrementCount = mRenderingState.totalDanmakuCount - lastTotalDanmakuCount;
mRenderingState.consumingTime = mStartTimer.update(SystemClock.uptimeMillis());
return mRenderingState;
}
示例11: draw
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
@Override
public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRenderTime) {
int lastTotalDanmakuCount = mRenderingState.totalDanmakuCount;
mRenderingState.reset();
IDanmakuIterator itr = danmakus.iterator();
int orderInScreen = 0;
mStartTimer.update(SystemClock.uptimeMillis());
int sizeInScreen = danmakus.size();
BaseDanmaku drawItem = null;
while (itr.hasNext()) {
drawItem = itr.next();
if (!drawItem.hasPassedFilter()) {
mContext.mDanmakuFilters.filter(drawItem, orderInScreen, sizeInScreen, mStartTimer, false, mContext);
}
if (drawItem.time < startRenderTime
|| (drawItem.priority == 0 && drawItem.isFiltered())) {
continue;
}
if (drawItem.isLate()) {
IDrawingCache<?> cache = drawItem.getDrawingCache();
if (mCacheManager != null && (cache == null || cache.get() == null)) {
mCacheManager.addDanmaku(drawItem);
}
break;
}
if (drawItem.getType() == BaseDanmaku.TYPE_SCROLL_RL){
// 同屏弹幕密度只对滚动弹幕有效
orderInScreen++;
}
// measure
if (!drawItem.isMeasured()) {
drawItem.measure(disp, false);
}
// layout
mDanmakusRetainer.fix(drawItem, disp, mVerifier);
// draw
if (!drawItem.isOutside() && drawItem.isShown()) {
if (drawItem.lines == null && drawItem.getBottom() > disp.getHeight()) {
continue; // skip bottom outside danmaku
}
int renderingType = drawItem.draw(disp);
if(renderingType == IRenderer.CACHE_RENDERING) {
mRenderingState.cacheHitCount++;
} else if(renderingType == IRenderer.TEXT_RENDERING) {
mRenderingState.cacheMissCount++;
if (mCacheManager != null) {
mCacheManager.addDanmaku(drawItem);
}
}
mRenderingState.addCount(drawItem.getType(), 1);
mRenderingState.addTotalCount(1);
if (mOnDanmakuShownListener != null
&& drawItem.firstShownFlag != mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG) {
drawItem.firstShownFlag = mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG;
mOnDanmakuShownListener.onDanmakuShown(drawItem);
}
}
}
mRenderingState.nothingRendered = (mRenderingState.totalDanmakuCount == 0);
mRenderingState.endTime = drawItem != null ? drawItem.time : RenderingState.UNKNOWN_TIME;
if (mRenderingState.nothingRendered) {
mRenderingState.beginTime = RenderingState.UNKNOWN_TIME;
}
mRenderingState.incrementCount = mRenderingState.totalDanmakuCount - lastTotalDanmakuCount;
mRenderingState.consumingTime = mStartTimer.update(SystemClock.uptimeMillis());
return mRenderingState;
}
示例12: draw
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
@Override
public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRenderTime) {
int lastTotalDanmakuCount = mRenderingState.totalDanmakuCount;
mRenderingState.reset();
IDanmakuIterator itr = danmakus.iterator();
int orderInScreen = 0;
mStartTimer.update(System.currentTimeMillis());
int sizeInScreen = danmakus.size();
BaseDanmaku drawItem = null;
while (itr.hasNext()) {
drawItem = itr.next();
if (drawItem.isLate()) {
break;
}
if (!drawItem.hasPassedFilter()) {
mContext.mDanmakuFilters.filter(drawItem, orderInScreen, sizeInScreen, mStartTimer, false, mContext);
}
if (drawItem.time < startRenderTime
|| (drawItem.priority == 0 && drawItem.isFiltered())) {
continue;
}
if (drawItem.getType() == BaseDanmaku.TYPE_SCROLL_RL){
// 同屏弹幕密度只对滚动弹幕有效
orderInScreen++;
}
// measure
if (!drawItem.isMeasured()) {
drawItem.measure(disp);
}
// layout
mDanmakusRetainer.fix(drawItem, disp, mVerifier);
// draw
if (!drawItem.isOutside() && drawItem.isShown()) {
if (drawItem.lines == null && drawItem.getBottom() > disp.getHeight()) {
continue; // skip bottom outside danmaku
}
int renderingType = drawItem.draw(disp);
if(renderingType == IRenderer.CACHE_RENDERING) {
mRenderingState.cacheHitCount++;
} else if(renderingType == IRenderer.TEXT_RENDERING) {
mRenderingState.cacheMissCount++;
}
mRenderingState.addCount(drawItem.getType(), 1);
mRenderingState.addTotalCount(1);
}
}
mRenderingState.nothingRendered = (mRenderingState.totalDanmakuCount == 0);
mRenderingState.endTime = drawItem != null ? drawItem.time : RenderingState.UNKNOWN_TIME;
if (mRenderingState.nothingRendered) {
mRenderingState.beginTime = RenderingState.UNKNOWN_TIME;
}
mRenderingState.incrementCount = mRenderingState.totalDanmakuCount - lastTotalDanmakuCount;
mRenderingState.consumingTime = mStartTimer.update(System.currentTimeMillis());
return mRenderingState;
}
示例13: draw
import master.flame.danmaku.danmaku.model.IDanmakus; //导入方法依赖的package包/类
@Override
public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRenderTime) {
mRenderingState.reset();
float left = disp.getWidth(),top = disp.getHeight(), right = 0 ,bottom = 0;
boolean fullScreenRefreshing = false;
IDanmakuIterator itr = danmakus.iterator();
int orderInScreen = 0;
mStartTimer.update(System.currentTimeMillis());
int sizeInScreen = danmakus.size();
while (itr.hasNext()) {
BaseDanmaku drawItem = itr.next();
if (drawItem.time < startRenderTime
|| (drawItem.priority == 0 && DanmakuFilters.getDefault().filter(drawItem,
orderInScreen, sizeInScreen, mStartTimer))) {
continue;
}
if(drawItem.getType() == BaseDanmaku.TYPE_SCROLL_RL){
// 同屏弹幕密度只对滚动弹幕有效
orderInScreen++;
}
// measure
if (!drawItem.isMeasured()) {
drawItem.measure(disp);
}
// layout
DanmakusRetainer.fix(drawItem, disp);
// draw
if (!drawItem.isOutside() && drawItem.isShown()) {
drawItem.draw(disp);
mRenderingState.add(drawItem.getType(), 1);
mRenderingState.add(1);
}
if (fullScreenRefreshing)
continue;
// calculate the refreshing area
if (drawItem.getType() == BaseDanmaku.TYPE_SPECIAL
&& (drawItem.rotationY != 0 || drawItem.rotationZ != 0)) {
left = 0;
top = 0;
right = disp.getWidth();
bottom = disp.getHeight();
fullScreenRefreshing = true;
continue;
}
float dtop = 0, dbottom = 0;
float dleft = drawItem.getLeft();
float dright = drawItem.getRight();
dtop = drawItem.getTop();
dbottom = drawItem.getBottom();
left = Math.min(dleft, left);
top = Math.min(dtop, top);
right = Math.max(dright, right);
bottom = Math.max(dbottom, bottom);
}
float borderWidth = disp.getStrokeWidth() * 2;
mRefreshArea.set(left, top, right + borderWidth, bottom + borderWidth);
mRenderingState.consumingTime = mStartTimer.update(System.currentTimeMillis());
return mRenderingState;
}