示例#1
0
        public ModUILabel AddLabel(String text, Side side, Func <bool> isEnabled, int priority = 0)
        {
            ModUILabel uiLabel = new ModUILabel(text, side, isEnabled, priority);

            AddLabel(uiLabel);
            return(uiLabel);
        }
示例#2
0
        public void RemoveLabel(string id)
        {
            ModUILabel label = labelsById[id];

            labelsById.Remove(id);
            labelsLeft.Remove(label);
            labelsRight.Remove(label);
        }
示例#3
0
        public ModUILabel AddToggle(String text, Side side, Func <bool> isEnabled, bool initToggle = false, Action <bool> action = null, int priority = 0)
        {
            ModUILabel uiLabel = new ModUILabel(LabelType.Toggle, text, side, isEnabled, initToggle, action, priority);

            AddLabel(uiLabel);
            UpdateSort();

            return(uiLabel);
        }
示例#4
0
 public void AddLabel(ModUILabel uiLabel)
 {
     if (uiLabel.side == Side.left)
     {
         labelsLeft.Add(uiLabel);
     }
     else
     {
         labelsRight.Add(uiLabel);
     }
     UpdateSort();
 }
示例#5
0
        public void AddLabel(ModUILabel uiLabel)
        {
            if (labelsById.ContainsKey(uiLabel.id))
            {
                ModUILabel oldLabel = labelsById[uiLabel.id];
                if (oldLabel.side == uiLabel.side)
                {
                    if (uiLabel.side == Side.left)
                    {
                        labelsLeft[labelsLeft.FindIndex(l => l.id == uiLabel.id)] = uiLabel;
                    }
                    else
                    {
                        labelsRight[labelsRight.FindIndex(l => l.id == uiLabel.id)] = uiLabel;
                    }
                }
                else
                {
                    if (oldLabel.side == Side.left)
                    {
                        labelsLeft.Remove(oldLabel);
                        labelsRight.Add(uiLabel);
                    }
                    else
                    {
                        labelsRight.Remove(oldLabel);
                        labelsLeft.Add(uiLabel);
                    }
                }
            }
            else
            {
                if (uiLabel.id != "")
                {
                    labelsById[uiLabel.id] = uiLabel;
                }

                if (uiLabel.side == Side.left)
                {
                    labelsLeft.Add(uiLabel);
                }
                else
                {
                    labelsRight.Add(uiLabel);
                }
            }

            UpdateSort();
        }