Esempio n. 1
0
        public TextList <T> AddTextList <T>(string name, Dictionary <T, string> defaultValues, OnButtonSelect <T> eventCallback, int width, int height)
        {
            if (eventCallback != null)
            {
                UIPanel uIPanel = m_Root.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel;
                uIPanel.name = "NumberedColorList";
                if (string.IsNullOrEmpty(name))
                {
                    uIPanel.Find <UILabel>("Label").text = "";
                }
                else
                {
                    uIPanel.Find <UILabel>("Label").text = name;
                }
                GameObject.Destroy(uIPanel.Find <UIDropDown>("Dropdown").gameObject);
                TextList <T> ddcs = new TextList <T>(uIPanel, defaultValues, width, height, name);

                ddcs.eventOnClick += (T value) =>
                {
                    eventCallback(value);
                };

                return(ddcs);
            }
            DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create colorPicker with no name or no event");
            return(null);
        }
Esempio n. 2
0
        public TextList <T> AddTextList <T>(string name, Dictionary <T, string> defaultValues, OnButtonSelect <T> eventCallback, int width, int height)
        {
            bool         flag = eventCallback != null;
            TextList <T> result;

            if (flag)
            {
                UIPanel uIPanel = this.m_Root.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel;
                uIPanel.name = "NumberedColorList";
                bool flag2 = string.IsNullOrEmpty(name);
                if (flag2)
                {
                    uIPanel.Find <UILabel>("Label").text = "";
                }
                else
                {
                    uIPanel.Find <UILabel>("Label").text = name;
                }
                UnityEngine.Object.Destroy(uIPanel.Find <UIDropDown>("Dropdown").gameObject);
                TextList <T> textList = new TextList <T>(uIPanel, defaultValues, width, height, name);
                textList.eventOnClick += delegate(T value)
                {
                    eventCallback(value);
                };
                result = textList;
            }
            else
            {
                DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create colorPicker with no name or no event");
                result = null;
            }
            return(result);
        }
Esempio n. 3
0
        public NumberedColorList AddNumberedColorList(string name, List <Color32> defaultValues, OnButtonSelect <int> eventCallback, UIComponent addButtonContainer, OnButtonClicked eventAdd)
        {
            if (eventCallback != null)
            {
                UIPanel uIPanel = m_Root.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel;
                uIPanel.name = "NumberedColorList";
                if (string.IsNullOrEmpty(name))
                {
                    uIPanel.Find <UILabel>("Label").text = "";
                }
                else
                {
                    uIPanel.Find <UILabel>("Label").text = name;
                }
                GameObject.Destroy(uIPanel.Find <UIDropDown>("Dropdown").gameObject);
                NumberedColorList ddcs = new NumberedColorList(uIPanel, defaultValues, addButtonContainer);

                ddcs.eventOnClick += (int value) =>
                {
                    eventCallback(value);
                };

                ddcs.eventOnAdd += () =>
                {
                    if (eventAdd != null)
                    {
                        eventAdd();
                    }
                };
                return(ddcs);
            }
            DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create colorPicker with no name or no event");
            return(null);
        }
Esempio n. 4
0
        public NumberedColorList AddNumberedColorList(string name, List <Color32> defaultValues, OnButtonSelect <int> eventCallback, UIComponent addButtonContainer, OnButtonClicked eventAdd)
        {
            bool flag = eventCallback != null;
            NumberedColorList result;

            if (flag)
            {
                UIPanel uIPanel = this.m_Root.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel;
                uIPanel.name = "NumberedColorList";
                bool flag2 = string.IsNullOrEmpty(name);
                if (flag2)
                {
                    uIPanel.Find <UILabel>("Label").text = "";
                }
                else
                {
                    uIPanel.Find <UILabel>("Label").text = name;
                }
                UnityEngine.Object.Destroy(uIPanel.Find <UIDropDown>("Dropdown").gameObject);
                NumberedColorList numberedColorList = new NumberedColorList(uIPanel, defaultValues, addButtonContainer);
                numberedColorList.eventOnClick += delegate(int value)
                {
                    eventCallback(value);
                };
                numberedColorList.eventOnAdd += delegate
                {
                    bool flag3 = eventAdd != null;
                    if (flag3)
                    {
                        eventAdd();
                    }
                };
                result = numberedColorList;
            }
            else
            {
                DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create colorPicker with no name or no event");
                result = null;
            }
            return(result);
        }