centralized interactable

pull/413/head
LARS-LAPTOP2\larsme 2017-03-27 12:03:05 +02:00
parent 08c16817eb
commit 98c92f4cde
2 changed files with 27 additions and 1 deletions

View File

@ -24,6 +24,7 @@ namespace UnityEngine.UI.Extensions
private InputField _mainInput;
private RectTransform _inputRT;
private Button _arrow_Button;
private RectTransform _rectTransform;
@ -74,6 +75,18 @@ namespace UnityEngine.UI.Extensions
}
}
public bool interactible
{
get { return _mainInput.interactable || _arrow_Button.interactable; }
set {
_mainInput.interactable = value;
_arrow_Button.interactable = value;
if (!value && _isPanelActive) {
ToggleDropdownPanel (false);
}
}
}
public void Awake()
{
Initialize();
@ -88,6 +101,8 @@ namespace UnityEngine.UI.Extensions
_inputRT = _rectTransform.FindChild("InputField").GetComponent<RectTransform>();
_mainInput = _inputRT.GetComponent<InputField>();
_arrow_Button = _rectTransform.FindChild ("ArrowBtn").GetComponent<Button> ();
_overlayRT = _rectTransform.FindChild("Overlay").GetComponent<RectTransform>();
_overlayRT.gameObject.SetActive(false);

View File

@ -71,6 +71,17 @@ namespace UnityEngine.UI.Extensions
}
}
public bool interactible
{
get { return _mainButton.btn.interactable; }
set {
_mainButton.btn.interactable = value;
if (!value && _isPanelActive) {
ToggleDropdownPanel (false);
}
}
}
public void Start()
{
Initialize();