Skip to content
New issue

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

本人发送的弹幕如何不丢失 #71

Open
13167281921 opened this issue Aug 21, 2017 · 2 comments
Open

本人发送的弹幕如何不丢失 #71

13167281921 opened this issue Aug 21, 2017 · 2 comments

Comments

@13167281921
Copy link

弹幕分为:从后台拿过来的弹幕barrageModel+本人发送的弹幕;
要求:本人发送的弹幕不能丢失;
为了防碰撞,您加入了:
if (hasBestTrack) {
_destination.x = (self.direction == BarrageWalkDirectionL2R)?rect.origin.x + rect.size.width:rect.origin.x - self.size.width;
} else {
_destination.x = (self.direction == BarrageWalkDirectionL2R)?origin.x-1:origin.x+1;
}
但当前面已经有5行弹幕(最多5行)并排走,然后我又要发送一条弹幕的时候,发送的弹幕就丢失了;能否设一个delay 延时处理呢?使得本人发送的弹幕既不碰撞,也不会丢失?

@unash
Copy link
Owner

unash commented Aug 21, 2017

继承覆盖 - (CGPoint)originInBounds:(CGRect)rect withSprites:(NSArray *)sprites
方法,可以粘贴过来 BarrageWalkSprite 的大部分代码。自己发送弹幕的时候,传入一个flag标志,然后在 - (CGPoint)originInBounds:(CGRect)rect withSprites:(NSArray *)sprites 方法里面判断这个 flag。如果是自己发送的弹幕,就令 hasBestTrack = YES.

@13167281921
Copy link
Author

我也考虑了这样做,可是如果 hasBestTrack = YES.的话,那么我发送的这个弹幕,就会撞上前面的弹幕了。产品的意见是:要么延时,要么就从第6行出来!可是如果是延时处理的话,延时多少合适呢!从第6行出来也不好处理??不知大神您这边有何良策?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants