Пример #1
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);
        }
Пример #2
0
 private void redrawButtons()
 {
     foreach (Transform transform in this.linesListPanel.transform)
     {
         UnityEngine.Object.Destroy(transform.gameObject);
     }
     for (int i = 0; i < this.colorList.Count; i++)
     {
         NumberedColorList.UIButtonWithId itemButton = new GameObject
         {
             transform =
             {
                 parent = this.linesListPanel.transform
             }
         }.AddComponent <NumberedColorList.UIButtonWithId>();
         itemButton.width  = 35f;
         itemButton.height = 35f;
         NumberedColorList.initButton(itemButton, "EmptySprite");
         itemButton.color        = this.colorList[i];
         itemButton.hoveredColor = itemButton.color;
         itemButton.pressedColor = itemButton.color;
         itemButton.focusedColor = itemButton.color;
         itemButton.textColor    = Color.white;
         itemButton.hoveredColor = itemButton.textColor;
         itemButton.id           = i + 1;
         itemButton.eventClick  += delegate(UIComponent component, UIMouseEventParameter eventParam)
         {
             bool flag = this.eventOnClick != null;
             if (flag)
             {
                 this.eventOnClick(itemButton.id);
             }
         };
         this.setLineNumberMainListing(i + 1, itemButton);
         itemButton.name = "Color #" + (i + 1);
     }
 }