Tanoda
DropDownListItem.cs
Go to the documentation of this file.
1
3
4using System;
5
7{
8 [Serializable]
9 public class DropDownListItem
10 {
11 [SerializeField]
12 private string _caption;
16 public string Caption
17 {
18 get
19 {
20 return _caption;
21 }
22 set
23 {
24 _caption = value;
25 if (OnUpdate != null)
26 OnUpdate();
27 }
28 }
29
30 [SerializeField]
31 private Sprite _image;
35 public Sprite Image
36 {
37 get
38 {
39 return _image;
40 }
41 set
42 {
43 _image = value;
44 if (OnUpdate != null)
45 OnUpdate();
46 }
47 }
48
49 [SerializeField]
50 private bool _isDisabled;
54 public bool IsDisabled
55 {
56 get
57 {
58 return _isDisabled;
59 }
60 set
61 {
62 _isDisabled = value;
63 if (OnUpdate != null)
64 OnUpdate();
65 }
66 }
67
68 [SerializeField]
69 private string _id;
73 public string ID
74 {
75 get { return _id; }
76 set { _id = value; }
77 }
78
79 public Action OnSelect = null; //action to be called when this item is selected
80
81 internal Action OnUpdate = null; //action to be called when something changes.
82
91 public DropDownListItem(string caption = "", string inId = "", Sprite image = null, bool disabled = false, Action onSelect = null)
92 {
93 _caption = caption;
94 _image = image;
95 _id = inId;
96 _isDisabled = disabled;
97 OnSelect = onSelect;
98 }
99 }
100}
System.Drawing.Image Image
Definition: TestScript.cs:37
DropDownListItem(string caption="", string inId="", Sprite image=null, bool disabled=false, Action onSelect=null)
Constructor for Drop Down List panelItems
bool IsDisabled
Is the Item currently enabled?
Credit Erdener Gonenc - @PixelEnvision.