public static void Destroy(this DynamicDropdownField listBox, MVRScript context) { listBox.ClearDropdownList(context); if (listBox.label != null) { context.RemoveButton(listBox.label); } if (listBox.infoBox != null) { context.RemoveTextField(listBox.infoBox); } if (listBox.selectedOption != null) { context.RemoveButton(listBox.selectedOption); } }
protected void DestroyControls() { foreach (var storable in _controlsStorables) { if (storable is JSONStorableFloat) { var jsf = (JSONStorableFloat)storable; Script.RemoveSlider(jsf); } else if (storable is JSONStorableBool) { var jsb = (JSONStorableBool)storable; Script.RemoveToggle(jsb); } else if (storable is JSONStorableString) { var jss = (JSONStorableString)storable; Script.RemoveTextField(jss); } else { SuperController.LogError($"Unknown storable type: {storable.GetType()}"); } } _controlsStorables.Clear(); foreach (var control in _controlDynamics) { if (control is UIDynamicSlider) { var slider = (UIDynamicSlider)control; Script.RemoveSlider(slider); } else if (control is UIDynamicToggle) { var toggle = (UIDynamicToggle)control; Script.RemoveToggle(toggle); } else if (control is UIDynamicTextField) { var textfield = (UIDynamicTextField)control; Script.RemoveTextField(textfield); } else if (control is UIDynamicButton) { var button = (UIDynamicButton)control; Script.RemoveButton(button); } else { SuperController.LogError($"Unknown control type: {control.GetType()}"); } } _controlDynamics.Clear(); _modifiedJson = null; }
public void RemoveAll() { foreach (var section in _childSections) { section.RemoveAll(); } _childSections.Clear(); foreach (var toggle in _toggles) { _plugin.RemoveToggle(toggle); } _toggles.Clear(); foreach (var slider in _sliders) { _plugin.RemoveSlider(slider); } _sliders.Clear(); foreach (var popup in _popups) { popup.popup.visible = false; _plugin.RemovePopup(popup); } _popups.Clear(); foreach (var button in _buttons) { _plugin.RemoveButton(button); } _buttons.Clear(); foreach (var button in _textFields) { _plugin.RemoveTextField(button); } _textFields.Clear(); foreach (var spacer in _spacers) { _plugin.RemoveSpacer(spacer); } _spacers.Clear(); }
public static void ClearDropdownList(this DynamicDropdownField dynamicDropdown, MVRScript context) { foreach (var prevOption in dynamicDropdown.options) { if (prevOption.Key == null) { return; } context.RemoveButton(prevOption.Key); } GameObject.Destroy(dynamicDropdown.backpanel); dynamicDropdown.backpanel = null; }
public void Unregister() { _plugin.RemoveButton(_selectButton); _plugin.RemoveButton(_removeButton); }