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); }
public void RemoveLabel(string id) { ModUILabel label = labelsById[id]; labelsById.Remove(id); labelsLeft.Remove(label); labelsRight.Remove(label); }
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); }
public void AddLabel(ModUILabel uiLabel) { if (uiLabel.side == Side.left) { labelsLeft.Add(uiLabel); } else { labelsRight.Add(uiLabel); } UpdateSort(); }
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(); }