From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/UICommon/XUIPopupList.cs | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Client/Assets/Scripts/UICommon/XUIPopupList.cs (limited to 'Client/Assets/Scripts/UICommon/XUIPopupList.cs') diff --git a/Client/Assets/Scripts/UICommon/XUIPopupList.cs b/Client/Assets/Scripts/UICommon/XUIPopupList.cs new file mode 100644 index 00000000..f78b6c01 --- /dev/null +++ b/Client/Assets/Scripts/UICommon/XUIPopupList.cs @@ -0,0 +1,47 @@ +using UILib; +using UnityEngine; +using System.Collections.Generic; + +public class XUIPopupList : XUIObject, IXUIPopupList +{ + + protected override void OnAwake() + { + base.OnAwake(); + m_uiPopupList = GetComponent(); + if (null == m_uiPopupList) + { + Debug.LogError("null == m_uiPopupList"); + } + } + + public void SetOptionList(List options) + { + m_uiPopupList.items = options; + } + + public string value + { + get { return m_uiPopupList.value; } + set { m_uiPopupList.value = value; } + } + + public int currentIndex + { + get + { + return m_uiPopupList.items.IndexOf(m_uiPopupList.value); + } + set + { + if(value >= m_uiPopupList.items.Count) + { + Debug.LogError("Index out of range. " + value); + return; + } + m_uiPopupList.value = m_uiPopupList.items[value]; + } + } + private UIPopupList m_uiPopupList; +} + -- cgit v1.1-26-g67d0