Пример #1
0
        public static void TextComboDealListChosen(CUIEvent evt)
        {
            if (evt == null || evt.m_srcWidget == null)
            {
                return;
            }
            CUIListScript component = evt.m_srcWidget.GetComponent <CUIListScript>();

            if (component == null)
            {
                return;
            }
            string[] array = null;
            if (CUIUtility.s_textComboBoxContent.TryGetValue(component, ref array))
            {
                int selectedIndex = component.GetSelectedIndex();
                if (selectedIndex >= 0 && selectedIndex < array.Length)
                {
                    Transform transform = component.gameObject.transform.parent.FindChild("Button_Down");
                    if (transform != null)
                    {
                        Transform transform2 = transform.FindChild("Text");
                        if (transform2 != null)
                        {
                            Text component2 = transform2.gameObject.GetComponent <Text>();
                            component2.set_text(array[selectedIndex]);
                        }
                    }
                }
                component.gameObject.CustomSetActive(false);
            }
            CUIUtility.TextComboClickCallback textComboClickCallback = null;
            if (CUIUtility.s_textComboBoxClickCallbackMap.TryGetValue(component, ref textComboClickCallback) && textComboClickCallback != null)
            {
                textComboClickCallback(evt);
            }
        }
Пример #2
0
 public static void RegisterTextComboboxContent(GameObject triggerBtn, CUIListScript list, string[] content, CUIUtility.TextComboClickCallback clickcallback = null)
 {
     CUIUtility.s_textComboBoxContent.set_Item(list, content);
     list.SetElementAmount(content.Length);
     if (content.Length > 0)
     {
         list.SelectElement(0, true);
     }
     CUIUtility.s_textComboBoxBtnListMap.set_Item(triggerBtn, list);
     if (clickcallback != null)
     {
         CUIUtility.s_textComboBoxClickCallbackMap.set_Item(list, clickcallback);
     }
 }