We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果这个item没有被draw,它的mContainerWidth就是0,这导致willHit()总是返回true。一条航道只能画一个弹幕。
public boolean willHit(IDanmakuItem runningItem) { if (runningItem.getWidth() + runningItem.getCurrX() > mContainerWidth) { return true; } if (runningItem.getSpeedFactor()>= mFactor) { return false; } float len1 = runningItem.getCurrX() + runningItem.getWidth(); float t1 = len1 / (runningItem.getSpeedFactor() * DanmakuItem.sBaseSpeed); float len2 = t1 * mFactor * DanmakuItem.sBaseSpeed; if (len2 > len1) { return true; } else { return false; } }
The text was updated successfully, but these errors were encountered:
建议写法是在调用willHit的时候把控件宽度传进来
if (!item.willHit(di, getWidth())) { return (i + ind) % mMaxRow; }
修改接口willHit(IDanmakuItem runningItem, int viewWidth)和实现
public boolean willHit(IDanmakuItem runningItem, int viewWidth) { // 修改成viewWidth*0.95是因为需要保持两条弹幕的间距 if (runningItem.getWidth() + runningItem.getCurrX() > viewWidth * 0.95) { return true; } if (runningItem.getSpeedFactor() >= mFactor) { return false; } float len1 = runningItem.getCurrX() + runningItem.getWidth(); float t1 = len1 / (runningItem.getSpeedFactor() * DanmakuItem.sBaseSpeed); float len2 = t1 * mFactor * DanmakuItem.sBaseSpeed; if (len2 > len1) { return true; } else { return false; } }
Sorry, something went wrong.
Yes i found this too!
No branches or pull requests
如果这个item没有被draw,它的mContainerWidth就是0,这导致willHit()总是返回true。一条航道只能画一个弹幕。
The text was updated successfully, but these errors were encountered: