public static bool CreateGuiItemsGroup(
            this List <GuiItem> guiItems,
            List <string> names,
            List <Rect> rects,
            GuiItemType type,
            GuiItemColor itemColor,
            string toolTip                = null,
            GuiItemState state            = GuiItemState.NORMAL,
            bool enabled                  = true,
            FontStyle fontStyle           = FontStyle.Normal,
            TextAnchor textAnchor         = TextAnchor.MiddleCenter,
            Event <object> onChangedEvent = null)
        {
            guiItems.Clear();

            for (int i = 0; i < names.Count; i++)
            {
                guiItems.Add(new GuiItem()
                {
                    Name           = names[i],
                    Tooltip        = toolTip,
                    Type           = type,
                    Enabled        = enabled,
                    Rect           = rects[i],
                    ItemColor      = itemColor,
                    State          = state,
                    FontStyle      = fontStyle,
                    TextAnchor     = textAnchor,
                    OnChangedEvent = onChangedEvent
                });
            }

            return(true);
        }
Exemple #2
0
        public static bool AddGuiItemToGroup(
            this List <GuiItem> guiItems,
            string name,
            Rect rect,
            GuiItemType type,
            GuiItemColor itemColor,
            string toolTip                = null,
            GuiItemState state            = GuiItemState.NORMAL,
            bool enabled                  = true,
            FontStyle fontStyle           = FontStyle.Normal,
            TextAnchor textAnchor         = TextAnchor.MiddleCenter,
            Event <object> onChangedEvent = null)
        {
            guiItems.Add(new GuiItem()
            {
                Name           = name,
                Tooltip        = toolTip,
                Type           = type,
                Enabled        = enabled,
                Rect           = rect,
                ItemColor      = itemColor,
                State          = state,
                FontStyle      = fontStyle,
                TextAnchor     = textAnchor,
                OnChangedEvent = onChangedEvent
            });

            return(true);
        }
        public static GUIStyle GetGuiItemStyle(GuiItemType type, GuiColor textColor = GuiColor.White, TextAnchor textAnchor = TextAnchor.MiddleCenter, FontStyle fontStyle = FontStyle.Normal, bool wordWrap = false)
        {
            if (!isInitStyles)
            {
                isInitStyles = SetGUIStyles();
            }

            switch (type)
            {
            case GuiItemType.NORMALBUTTON:
                NormalButton.normal.textColor = GetGuiColor(textColor);
                NormalButton.fontStyle        = fontStyle;
                NormalButton.alignment        = textAnchor;
                NormalButton.wordWrap         = wordWrap;
                NormalButton.normal.textColor = GetGuiColor(textColor);
                NormalButton.hover.textColor  = Color.white;
                NormalButton.active.textColor = Color.green;
                return(NormalButton);

            case GuiItemType.TOGGLEBUTTON:
                return(ToggleButton);

            case GuiItemType.TAB:
                return(Tab);

            case GuiItemType.LABEL:
                Label.normal.textColor = GetGuiColor(textColor);
                Label.fontStyle        = fontStyle;
                Label.alignment        = textAnchor;
                Label.wordWrap         = wordWrap;
                Label.clipping         = TextClipping.Overflow;
                return(Label);

            case GuiItemType.TEXTFIELD:
                return(Textfield);

            case GuiItemType.TEXTAREA:
                Textarea.fontStyle        = fontStyle;
                Textarea.alignment        = textAnchor;
                Textarea.wordWrap         = wordWrap;
                Textarea.normal.textColor = GetGuiColor(textColor);
                return(Textarea);

            case GuiItemType.BOX:
                return(Box);

            case GuiItemType.DROPDOWN:
                //Dropdown.normal.background = MakeTex(10, 10, new Color(0f, 1f, 0f, 1f));
                return(Dropdown);
            }

            throw new Exception("Unknown error!");
        }
 public void AddListToGroup(List <string[]> names, List <Rect> rects, GuiItemType type, ref List <GuiItem> guiItems, GuiItemColor itemColor,
                            GuiItemState state    = GuiItemState.NORMAL, bool enabled = true, FontStyle fontStyle = FontStyle.Normal,
                            TextAnchor textAnchor = TextAnchor.MiddleCenter)
 {
     for (int i = 0; i < names.Count; i++)
     {
         guiItems.Add(new GuiItem()
         {
             Name       = names[i][1],
             Type       = type,
             Enabled    = enabled,
             Rect       = rects[i],
             ItemColor  = itemColor,
             State      = state,
             FontStyle  = fontStyle,
             TextAnchor = textAnchor
         });
     }
 }
        public void CreateTechGroup(List <TechTypeData> techTypeDatas, List <Rect> rects, GuiItemType type, ref List <GuiItem> guiItems, GuiItemColor itemColor,
                                    GuiItemState state    = GuiItemState.NORMAL, bool enabled = true, FontStyle fontStyle = FontStyle.Normal,
                                    TextAnchor textAnchor = TextAnchor.MiddleCenter)
        {
            guiItems.Clear();

            for (int i = 0; i < techTypeDatas.Count; i++)
            {
                guiItems.Add(new GuiItem()
                {
                    Name       = techTypeDatas[i].Name,
                    Type       = type,
                    Enabled    = enabled,
                    Rect       = rects[i],
                    ItemColor  = itemColor,
                    State      = state,
                    FontStyle  = fontStyle,
                    TextAnchor = textAnchor
                });
            }
        }