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

ACTION_MOVE的时候每次都调用erase()函数是不是太浪费系统资源了? #3

Closed
DearZack opened this issue Sep 11, 2016 · 2 comments

Comments

@DearZack
Copy link

我觉得在ACTION_UP的时候去调用一下就好了。
我的理解是,erase()函数目的就是去判断一下刮奖有没有结束,完全可以只在ACTION_UP的时候去调用,而且在move的时候跳出了一个中奖结果用户体验也不太好,还是抬手后再判断比较好。

我试了下,在我的测试机mate8中,刮5%的情况下。
原来的思路CPU要26S后才会计算完所有的东西,而新的思路是抬手后的两秒。
内存倒区别不大。
详情见下面两图:
1
ACTION_MOVE的时候每次都调用erase()函数
2
ACTION_UP的时候调用

@D-clock
Copy link
Owner

D-clock commented Sep 11, 2016

@DearZack erase()函数目的是刮去图层,onErase()函数才是判断是否结束,我觉得你这个思路不错,我优化下!

@D-clock
Copy link
Owner

D-clock commented Sep 15, 2016

@DearZack 代码已优化,感谢提出宝贵的建议!

@D-clock D-clock closed this as completed Sep 15, 2016
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