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


Java DanmakuUtils.willHitInDuration方法代码示例

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


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

示例1: fix

import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入方法依赖的package包/类
public void fix(BaseDanmaku drawItem, IDisplayer disp, Verifier verifier) {
    if (!drawItem.isOutside()) {
        boolean shown = drawItem.isShown();
        float topPos = drawItem.getTop();
        int lines = 0;
        boolean willHit = (drawItem.isShown() || this.mVisibleDanmakus.isEmpty()) ? false : true;
        boolean isOutOfVerticalEdge = false;
        if (topPos < 0.0f) {
            topPos = ((float) disp.getHeight()) - drawItem.paintHeight;
        }
        BaseDanmaku removeItem = null;
        BaseDanmaku firstItem = null;
        if (!shown) {
            this.mCancelFixingFlag = false;
            IDanmakuIterator it = this.mVisibleDanmakus.iterator();
            while (!this.mCancelFixingFlag && it.hasNext()) {
                lines++;
                BaseDanmaku item = it.next();
                if (item == drawItem) {
                    removeItem = null;
                    willHit = false;
                    break;
                }
                if (firstItem == null) {
                    firstItem = item;
                    if (firstItem.getBottom() != ((float) disp.getHeight())) {
                        break;
                    }
                }
                if (topPos < 0.0f) {
                    removeItem = null;
                    break;
                }
                willHit = DanmakuUtils.willHitInDuration(disp, item, drawItem, drawItem.getDuration(), drawItem.getTimer().currMillisecond);
                if (!willHit) {
                    removeItem = item;
                    break;
                }
                topPos = item.getTop() - drawItem.paintHeight;
            }
            isOutOfVerticalEdge = isOutVerticalEdge(false, drawItem, disp, topPos, firstItem, null);
            if (isOutOfVerticalEdge) {
                topPos = ((float) disp.getHeight()) - drawItem.paintHeight;
                willHit = true;
            } else if (topPos >= 0.0f) {
                willHit = false;
            }
        }
        if (verifier == null || !verifier.skipLayout(drawItem, topPos, lines, willHit)) {
            if (isOutOfVerticalEdge) {
                clear();
            }
            drawItem.layout(disp, drawItem.getLeft(), topPos);
            if (!shown) {
                this.mVisibleDanmakus.removeItem(removeItem);
                this.mVisibleDanmakus.addItem(drawItem);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:61,代码来源:DanmakusRetainer.java

示例2: fix

import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入方法依赖的package包/类
@Override
public void fix(BaseDanmaku drawItem, IDisplayer disp, Verifier verifier) {
    if (drawItem.isOutside())
        return;
    boolean shown = drawItem.isShown();
    float topPos = drawItem.getTop();
    int lines = 0;
    boolean willHit = !drawItem.isShown() && !mVisibleDanmakus.isEmpty();
    boolean isOutOfVerticalEdge = false;
    if (topPos < 0) {
        topPos = disp.getHeight() - drawItem.paintHeight;
    }
    BaseDanmaku removeItem = null, firstItem = null;
    if (!shown) {
        mCancelFixingFlag = false;
        IDanmakuIterator it = mVisibleDanmakus.iterator();
        while (!mCancelFixingFlag && it.hasNext()) {
            lines++;
            BaseDanmaku item = it.next();
            if (item == drawItem) {
                removeItem = null;
                willHit = false;
                break;
            }

            if (firstItem == null) {
                firstItem = item;
                if (firstItem.getBottom() != disp.getHeight()) {
                    break;
                }
            }

            if (topPos < 0) {
                removeItem = null;
                break;
            }

            // 检查碰撞
            willHit = DanmakuUtils.willHitInDuration(disp, item, drawItem,
                    drawItem.getDuration(), drawItem.getTimer().currMillisecond);
            if (!willHit) {
                removeItem = item;
                // topPos = item.getBottom() - drawItem.paintHeight;
                break;
            }

            topPos = item.getTop() - drawItem.paintHeight;

        }

        isOutOfVerticalEdge = isOutVerticalEdge(false, drawItem, disp, topPos, firstItem, null);
        if (isOutOfVerticalEdge) {
            topPos = disp.getHeight() - drawItem.paintHeight;
            willHit = true;
        } else if (topPos >= 0) {
            willHit = false;
        }

    }

    if (verifier != null && verifier.skipLayout(drawItem, topPos, lines, willHit)) {
        return;
    }

    if (isOutOfVerticalEdge) {
        clear();
    }

    drawItem.layout(disp, drawItem.getLeft(), topPos);

    if (!shown) {
        mVisibleDanmakus.removeItem(removeItem);
        mVisibleDanmakus.addItem(drawItem);
    }

}
 
开发者ID:dingdingyr,项目名称:DanmakuFlameMaster-,代码行数:77,代码来源:DanmakusRetainer.java

示例3: fix

import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入方法依赖的package包/类
@Override
public void fix(BaseDanmaku drawItem, IDisplayer disp) {
    if (drawItem.isOutside())
        return;
    boolean shown = drawItem.isShown();
    float topPos = drawItem.getTop();
    if (topPos < 0) {
        topPos = disp.getHeight() - drawItem.paintHeight;
    }
    BaseDanmaku removeItem = null, firstItem = null;
    if (!shown) {
        IDanmakuIterator it = mVisibleDanmakus.iterator();
        while (it.hasNext()) {
            BaseDanmaku item = it.next();

            if (item == drawItem) {
                removeItem = null;
                break;
            }

            if (firstItem == null) {
                firstItem = item;
                if (firstItem.getBottom() != disp.getHeight()) {
                    break;
                }
            }

            if (topPos < 0) {
                removeItem = null;
                break;
            }

            // 检查碰撞
            boolean willHit = DanmakuUtils.willHitInDuration(disp, item, drawItem,
                    drawItem.getDuration(), drawItem.getTimer().currMillisecond);
            if (!willHit) {
                removeItem = item;
                // topPos = item.getBottom() - drawItem.paintHeight;
                break;
            }

            topPos = item.getTop() - drawItem.paintHeight;

        }

        topPos = checkVerticalEdge(false, drawItem, disp, topPos, firstItem, null);

    }

    drawItem.layout(disp, drawItem.getLeft(), topPos);

    if (!shown) {
        mVisibleDanmakus.removeItem(removeItem);
        mVisibleDanmakus.addItem(drawItem);
    }

}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:58,代码来源:DanmakusRetainer.java


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