protected void CreateControls() { DestroyControls(); /* * var debugJson = new JSONStorableString("Debug", Id); * RegisterStorable(debugJson); * var debugTextField = Script.CreateTextField(debugJson, true); * debugTextField.height = 80f; * var debugTextInputField = debugTextField.gameObject.AddComponent<UnityEngine.UI.InputField>(); * debugTextInputField.textComponent = debugTextField.UItext; * debugJson.inputField = debugTextInputField; * RegisterControl(debugTextField); */ if (IsDuplicate) { var jss = RegisterStorable(new JSONStorableString("Duplicate", "This item has duplicates and cannot be edited.")); RegisterControl(Script.CreateTextField(jss)); } else { _modifiedJson = new JSONStorableBool("This item has been modified", false); _modifiedJson.valNoCallback = Modified; _modifiedJson.setCallbackFunction = (bool val) => { if (val) { // You cannot just enable the Modified flag without actually modifying anything _modifiedJson.valNoCallback = false; return; } ResetToInitial(); }; var resetUi = Script.CreateToggle(_modifiedJson, true); RegisterControl(resetUi); if (Mirror != null) { var goToMirrorButton = Script.CreateButton("Go to mirror", true); goToMirrorButton.button.onClick.AddListener(() => { Script.SendMessage("SelectEditable", Mirror); }); RegisterControl(goToMirrorButton); } CreateControlsInternal(); } }
public UIDynamicTextField CreateText(JSONStorableString jss, bool rightSide = false) { return(_textFields.AddAndReturn(_plugin.CreateTextField(jss, rightSide))); }
public void UIStringMessage(string message, bool right = false) { script.CreateTextField(new JSONStorableString("", message), right = false); }