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