add: public accessable reset function
parent
90fd22498f
commit
c06cd38081
|
@ -49,6 +49,9 @@ namespace UnityEngine.UI.Extensions
|
|||
private GameObject _itemTemplate;
|
||||
private bool _initialized;
|
||||
|
||||
private string _defaultMainButtonCaption = null;
|
||||
private Color _defaultNormalColor;
|
||||
|
||||
[SerializeField]
|
||||
private float _scrollBarWidth = 20.0f;
|
||||
public float ScrollBarWidth
|
||||
|
@ -121,6 +124,9 @@ namespace UnityEngine.UI.Extensions
|
|||
_rectTransform = GetComponent<RectTransform>();
|
||||
_mainButton = new DropDownListButton(_rectTransform.Find("MainButton").gameObject);
|
||||
|
||||
_defaultMainButtonCaption = _mainButton.txt.text;
|
||||
_defaultNormalColor = _mainButton.btn.colors.normalColor;
|
||||
|
||||
_overlayRT = _rectTransform.Find("Overlay").GetComponent<RectTransform>();
|
||||
_overlayRT.gameObject.SetActive(false);
|
||||
_scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent<RectTransform>();
|
||||
|
@ -266,6 +272,20 @@ namespace UnityEngine.UI.Extensions
|
|||
RedrawPanel();
|
||||
}
|
||||
|
||||
public void ResetDropDown()
|
||||
{
|
||||
if (!_initialized)
|
||||
return;
|
||||
|
||||
_mainButton.txt.text = _defaultMainButtonCaption;
|
||||
for (int i = 0; i < _itemsPanelRT.childCount; i++)
|
||||
_panelItems[i].btnImg.color = _defaultNormalColor;
|
||||
|
||||
_selectedIndex = -1;
|
||||
_initialized = false;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void ResetItems()
|
||||
{
|
||||
Items.Clear();
|
||||
|
|
Loading…
Reference in New Issue