///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/
usingSystem;
namespaceUnityEngine.UI.Extensions
{
publicclassComboBoxItem
{
[SerializeField]
privatestring_caption;
/// <summary>
/// Caption of the Item
/// </summary>
publicstringCaption
{
get
{
return_caption;
}
set
{
_caption=value;
if(OnUpdate!=null)
OnUpdate();
}
}
[SerializeField]
privateSprite_image;
/// <summary>
/// Image component of the Item
/// </summary>
publicSpriteImage
{
get
{
return_image;
}
set
{
_image=value;
if(OnUpdate!=null)
OnUpdate();
}
}
[SerializeField]
privatebool_isDisabled;
/// <summary>
/// Is the Item currently enabled?
/// </summary>
publicboolIsDisabled
{
get
{
return_isDisabled;
}
set
{
_isDisabled=value;
if(OnUpdate!=null)
OnUpdate();
}
}
publicActionOnSelect;//action to be called when this item is selected
internalActionOnUpdate;//action to be called when something changes.
///<remarks> Value exists so that an item can have a caption and a value, like in traditional windows forms. Ie. an item may be a student's name, and the value could be the student's ID number</remarks>
privatestring_value;
/// <summary>
/// Constructor for ComboBoxOptions
/// </summary>
/// <param name="caption">Caption for the item </param>
/// <param name="val">Value of the item </param>
/// <param name="image"></param>
/// <param name="disabled">Should the item start disabled</param>
/// <param name="onSelect">Action to be called when this item is selected</param>