-
Notifications
You must be signed in to change notification settings - Fork 1
ロングタップのみを実装するように変更 #1
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
base: master
Are you sure you want to change the base?
Conversation
| [RequireComponent(typeof(Graphic))] | ||
| public class LongTapEventHandler : MonoBehaviour | ||
| { | ||
| [SerializeField] private Graphic _raycastImage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[RequireComponent(typeof(Graphic))]があるので無駄なシリアライズを削除しました
| var time = Time.time; | ||
| await _raycastImage.OnPointerUpAsObservable().Take(1).ToUniTask(cancellationToken: cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1回だけポインターアップのイベントが発行されるのを待つ
他にもポインターが領域外に行くとか色々ダメになる条件はあるけど
それ系の追加はサボりました
| await _raycastImage.OnPointerUpAsObservable().Take(1).ToUniTask(cancellationToken: cancellationToken); | ||
|
|
||
| try | ||
| if (_delayStartLongTap + _fireLongTapTime < Time.time - time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
公開するイベントがロングタップだけなら _fireLongTapTimeだけでヨサソウ
サンプルの実装を見てなくて押下後の経過時間などに一ミリも対応できてないので全然使えないです
ロングタップの部分だけもっと簡潔に書けそうだなーと思ってPR作成したので参考になれば!