option to set interactible to false if there are no items to be selected (DropDownList and AutoCompleteComboBox)
parent
98c92f4cde
commit
9ac4eb6969
|
@ -78,7 +78,7 @@ namespace UnityEngine.UI.Extensions
|
|||
public bool interactible
|
||||
{
|
||||
get { return _mainInput.interactable || _arrow_Button.interactable; }
|
||||
set {
|
||||
private set {
|
||||
_mainInput.interactable = value;
|
||||
_arrow_Button.interactable = value;
|
||||
if (!value && _isPanelActive) {
|
||||
|
@ -87,6 +87,32 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
//I couldn't come up with a better name
|
||||
private bool _technicallyInteractible = true;
|
||||
public bool TechnicallyInteractible
|
||||
{
|
||||
get { return _technicallyInteractible; }
|
||||
set
|
||||
{
|
||||
_technicallyInteractible = value;
|
||||
interactible = _technicallyInteractible && (AvailableOptions.Count > 0 || _remainInteractableIfEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private bool _remainInteractableIfEmpty = true;
|
||||
public bool RemainInteractableIfEmpty
|
||||
{
|
||||
get { return _remainInteractableIfEmpty; }
|
||||
set
|
||||
{
|
||||
_remainInteractableIfEmpty = value;
|
||||
interactible = _technicallyInteractible && (AvailableOptions.Count > 0 || _remainInteractableIfEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
Initialize();
|
||||
|
@ -215,6 +241,7 @@ namespace UnityEngine.UI.Extensions
|
|||
panelObjects[_panelItems[i]] = itemObjs[i];
|
||||
}
|
||||
}
|
||||
interactible = _technicallyInteractible && (AvailableOptions.Count > 0 || _remainInteractableIfEmpty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace UnityEngine.UI.Extensions
|
|||
public bool interactible
|
||||
{
|
||||
get { return _mainButton.btn.interactable; }
|
||||
set {
|
||||
private set {
|
||||
_mainButton.btn.interactable = value;
|
||||
if (!value && _isPanelActive) {
|
||||
ToggleDropdownPanel (false);
|
||||
|
@ -82,6 +82,32 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
//I couldn't come up with a better name
|
||||
private bool _technicallyInteractible = true;
|
||||
public bool TechnicallyInteractible
|
||||
{
|
||||
get { return _technicallyInteractible; }
|
||||
set
|
||||
{
|
||||
_technicallyInteractible = value;
|
||||
interactible = _technicallyInteractible && (Items.Count > 0 || _remainInteractableIfEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private bool _remainInteractableIfEmpty = true;
|
||||
public bool RemainInteractableIfEmpty
|
||||
{
|
||||
get { return _remainInteractableIfEmpty; }
|
||||
set
|
||||
{
|
||||
_remainInteractableIfEmpty = value;
|
||||
interactible = _technicallyInteractible && (Items.Count > 0 || _remainInteractableIfEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Initialize();
|
||||
|
@ -202,6 +228,7 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
_panelItems[i].gameobject.SetActive(i < Items.Count);// if we have more thanks in the panel than Items in the list hide them
|
||||
}
|
||||
interactible = _technicallyInteractible && (Items.Count > 0 || _remainInteractableIfEmpty);
|
||||
}
|
||||
|
||||
private void OnItemClicked(int indx)
|
||||
|
|
Loading…
Reference in New Issue