/// <summary> /// Adds a <see cref="GadgetConfigComponent"/> to this config menu, at a specified index in the component array. May only be called before the menu is built. /// </summary> public virtual void InsertComponent(int index, GadgetConfigComponent component, GadgetConfigComponentAlignment alignment = GadgetConfigComponentAlignment.STANDARD) { if (HasBuilt) { throw new InvalidOperationException("GadgetConfigComponents may not be added to a BasicGadgetConfigMenu after the menu has been built!"); } component.SetAlignment(alignment); ConfigComponents.Insert(Math.Min(index, ConfigComponents.Count - 1), component); }
/// <summary> /// Adds a <see cref="GadgetConfigComponent"/> to this config menu. May only be called before the menu is built. /// </summary> public virtual void AddComponent(GadgetConfigComponent component, GadgetConfigComponentAlignment alignment = GadgetConfigComponentAlignment.STANDARD) { if (HasBuilt) { throw new InvalidOperationException("GadgetConfigComponents may not be added to a BasicGadgetConfigMenu after the menu has been built!"); } component.SetAlignment(alignment); ConfigComponents.Add(component); }