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);
        }
示例#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 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
                });
            }
        }
 public static bool ConvertStateToBool(GuiItemState state)
 {
     return(state == GuiItemState.PRESSED ? true : false);
 }
 public static GuiItemState InvertState(GuiItemState state)
 {
     return(state == GuiItemState.NORMAL ? GuiItemState.PRESSED : GuiItemState.NORMAL);
 }