| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using DCL.Components; |
| | 4 | | using DCL.Helpers; |
| | 5 | | using DCL.Models; |
| | 6 | |
|
| | 7 | | namespace DCL |
| | 8 | | { |
| | 9 | | public class UUIDComponent : BaseComponent |
| | 10 | | { |
| | 11 | | [Serializable] |
| | 12 | | public class Model : BaseModel |
| | 13 | | { |
| | 14 | | public string type; |
| | 15 | | public string uuid; |
| | 16 | |
|
| | 17 | | public override BaseModel GetDataFromJSON(string json) |
| | 18 | | { |
| 0 | 19 | | return Utils.SafeFromJson<Model>(json); |
| | 20 | | } |
| | 21 | |
|
| | 22 | | public CLASS_ID_COMPONENT GetClassIdFromType() |
| | 23 | | { |
| 69 | 24 | | switch (type) |
| | 25 | | { |
| | 26 | | case OnPointerDown.NAME: |
| 21 | 27 | | return CLASS_ID_COMPONENT.UUID_ON_DOWN; |
| | 28 | | case OnPointerUp.NAME: |
| 8 | 29 | | return CLASS_ID_COMPONENT.UUID_ON_UP; |
| | 30 | | case OnClick.NAME: |
| 21 | 31 | | return CLASS_ID_COMPONENT.UUID_ON_CLICK; |
| | 32 | | case OnPointerHoverEnter.NAME: |
| 13 | 33 | | return CLASS_ID_COMPONENT.UUID_ON_HOVER_ENTER; |
| | 34 | | case OnPointerHoverExit.NAME: |
| 6 | 35 | | return CLASS_ID_COMPONENT.UUID_ON_HOVER_EXIT; |
| | 36 | | } |
| | 37 | |
|
| 0 | 38 | | return CLASS_ID_COMPONENT.UUID_CALLBACK; |
| | 39 | | } |
| | 40 | | } |
| | 41 | |
|
| 38 | 42 | | public override string componentName => uuidComponentName; |
| | 43 | |
|
| 30 | 44 | | protected virtual string uuidComponentName { get; } |
| | 45 | |
|
| | 46 | | public override IEnumerator ApplyChanges(BaseModel newModel) |
| | 47 | | { |
| 0 | 48 | | this.model = newModel ?? new Model(); |
| 0 | 49 | | return null; |
| | 50 | | } |
| | 51 | |
|
| | 52 | | public override int GetClassId() |
| | 53 | | { |
| 0 | 54 | | return (int) CLASS_ID_COMPONENT.UUID_CALLBACK; |
| | 55 | | } |
| | 56 | | } |
| | 57 | | } |