| | 1 | | using UnityEngine; |
| | 2 | | using DCL.Interface; |
| | 3 | | using DCL.Helpers; |
| | 4 | | using DCL.Models; |
| | 5 | | using Ray = UnityEngine.Ray; |
| | 6 | |
|
| | 7 | | namespace DCL.Components |
| | 8 | | { |
| | 9 | | public class OnClick : OnPointerEvent |
| | 10 | | { |
| | 11 | | public const string NAME = "onClick"; |
| | 12 | |
|
| | 13 | | public override void Report(WebInterface.ACTION_BUTTON buttonId, Ray ray, HitInfo hit) |
| | 14 | | { |
| 1 | 15 | | if (!enabled || !IsVisible()) |
| 0 | 16 | | return; |
| | 17 | |
|
| 1 | 18 | | Model model = (Model) this.model; |
| | 19 | |
|
| 1 | 20 | | if (IsAtHoverDistance(hit.distance) |
| | 21 | | && (model.button == "ANY" || buttonId.ToString() == model.button)) |
| | 22 | | { |
| 1 | 23 | | DCL.Interface.WebInterface.ReportOnClickEvent(scene.sceneData.id, model.uuid); |
| | 24 | | } |
| 1 | 25 | | } |
| | 26 | |
|
| 0 | 27 | | public override int GetClassId() { return (int) CLASS_ID_COMPONENT.UUID_ON_CLICK; } |
| | 28 | |
|
| 7 | 29 | | public override PointerInputEventType GetEventType() { return PointerInputEventType.CLICK; } |
| | 30 | | } |
| | 31 | | } |