|
|
|
|
|
|
/// Adds a new UI control to the control panel. If the control cannot be added and the method will
|
|
|
|
/// return false. Also, all UI elements must have a LayoutElement component and if they do not,
|
|
|
|
/// this method will reject the new element, and return false.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public bool AddNewControl(GameObject uiControl) |
|
|
|
{ |
|
|
|
if (uiControl.GetComponent<RectTransform>() == null) |
|
|
|
|
|
|
/// Removes the passed in component from the control panel. Returns
|
|
|
|
/// false if the element does not exist. Returns true on a successful removal.
|
|
|
|
/// The caller is responsible for destroying the control.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public bool RemoveControl(GameObject uiControl) |
|
|
|
{ |
|
|
|
if (m_Controls.Remove(uiControl)) |
|
|
|
|
|
|
/// Creates a new toggle control with passed in name. The passed in listener will be
|
|
|
|
/// called on toggle clicks. If anything goes wrong this method will return null.
|
|
|
|
/// Returns the control panel element upon a successful add.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public GameObject AddToggleControl(string name, UnityAction<bool> listener) |
|
|
|
{ |
|
|
|
if (listener == null) |
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new slider control with the passed in name and default value. The slider's value runs from 0 to 1.
|
|
|
|
/// The passed in listener will be called on slider changes. If anything goes wrong this method will return null.
|
|
|
|
/// Returns the control panel elemet upon a succssful add.
|
|
|
|
/// Returns the control panel element upon a successful add.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public GameObject AddSliderControl(string name, float defaultValue, UnityAction<float> listener) |
|
|
|
{ |
|
|
|
if (listener == null) |
|
|
|