| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL.Components |
| | 7 | | { |
| | 8 | | [System.Serializable] |
| | 9 | | public class SmartItemActionable |
| | 10 | | { |
| | 11 | | [NonSerialized] |
| | 12 | | public string actionableId; |
| | 13 | | public string entityId; |
| | 14 | | public string actionId; |
| 0 | 15 | | public Dictionary<object, object> values = new Dictionary<object, object>(); |
| | 16 | | } |
| | 17 | |
|
| | 18 | | [System.Serializable] |
| | 19 | | public class SmartItemAction |
| | 20 | | { |
| | 21 | | public string id; |
| | 22 | | public string label; |
| | 23 | | public SmartItemParameter[] parameters; |
| | 24 | | } |
| | 25 | |
|
| | 26 | | [System.Serializable] |
| | 27 | | public class SmartItemParameter |
| | 28 | | { |
| | 29 | | public enum ParameterType |
| | 30 | | { |
| | 31 | | BOOLEAN, |
| | 32 | | TEXT, |
| | 33 | | TEXTAREA, |
| | 34 | | FLOAT, |
| | 35 | | INTEGER, |
| | 36 | | SLIDER, |
| | 37 | | OPTIONS, |
| | 38 | | ENTITY, |
| | 39 | | ACTIONS |
| | 40 | | } |
| | 41 | |
|
| | 42 | | public string id; |
| | 43 | | public string label; |
| | 44 | | public string type; |
| | 45 | | public string @default; |
| | 46 | | public string min; |
| | 47 | | public string max; |
| | 48 | | public string step; |
| | 49 | | public OptionsParameter[] options; |
| | 50 | |
|
| | 51 | | private ParameterType enumType; |
| | 52 | | private bool enumCached = false; |
| | 53 | |
|
| | 54 | | [System.Serializable] |
| | 55 | | public class OptionsParameter |
| | 56 | | { |
| | 57 | | public string label; |
| | 58 | | public string value; |
| | 59 | | } |
| | 60 | |
|
| | 61 | | public ParameterType GetParameterType() |
| | 62 | | { |
| | 63 | | if (enumCached) |
| | 64 | | return enumType; |
| | 65 | |
|
| | 66 | | if (!Enum.TryParse(type.ToUpper(), out ParameterType myStatus)) |
| | 67 | | Debug.Log($"Error parsing the smart item parameter type: {type}, The parameter doesn't exist!"); |
| | 68 | |
|
| | 69 | | enumType = myStatus; |
| | 70 | | enumCached = true; |
| | 71 | | return enumType; |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |