| | 1 | | using DCL.Interface; |
| | 2 | | using DCL.Helpers; |
| | 3 | | using DCL.Models; |
| | 4 | | using Ray = UnityEngine.Ray; |
| | 5 | |
|
| | 6 | | namespace DCL.Components |
| | 7 | | { |
| | 8 | | public class OnPointerDown : OnPointerEvent |
| | 9 | | { |
| | 10 | | public const string NAME = "pointerDown"; |
| | 11 | |
|
| | 12 | | public override void Report(WebInterface.ACTION_BUTTON buttonId, Ray ray, HitInfo hit) |
| | 13 | | { |
| 4 | 14 | | if (!enabled || !IsVisible()) |
| 0 | 15 | | return; |
| | 16 | |
|
| 4 | 17 | | Model model = this.model as OnPointerEvent.Model; |
| | 18 | |
|
| 4 | 19 | | if (ShouldReportEvent(buttonId, hit)) |
| | 20 | | { |
| 4 | 21 | | string meshName = pointerEventHandler.GetMeshName(hit.collider); |
| | 22 | |
|
| 4 | 23 | | DCL.Interface.WebInterface.ReportOnPointerDownEvent(buttonId, scene.sceneData.id, model.uuid, entity.ent |
| | 24 | | } |
| 4 | 25 | | } |
| | 26 | |
|
| | 27 | | public bool ShouldReportEvent(WebInterface.ACTION_BUTTON buttonId, HitInfo hit) |
| | 28 | | { |
| 4 | 29 | | Model model = this.model as Model; |
| | 30 | |
|
| 4 | 31 | | return IsVisible() && |
| | 32 | | IsAtHoverDistance(hit.distance) && |
| | 33 | | (model.button == "ANY" || buttonId.ToString() == model.button); |
| | 34 | | } |
| | 35 | |
|
| 0 | 36 | | public override int GetClassId() { return (int) CLASS_ID_COMPONENT.UUID_ON_DOWN; } |
| | 37 | |
|
| 832 | 38 | | public override PointerInputEventType GetEventType() { return PointerInputEventType.DOWN; } |
| | 39 | | } |
| | 40 | | } |