public async void Init(InteractiveObject objectToRename, UnityAction updateVisibilityCallback, bool isNewObject = false, UnityAction cancelCallback = null, UnityAction confirmCallback = null, bool keepObjectLocked = false) { if (objectToRename == null) { return; } if (!await objectToRename.WriteLock(false)) { return; } this.isNewObject = isNewObject; _updateVisibilityCallback = updateVisibilityCallback; selectedObject = objectToRename; Title.text = "Rename " + selectedObject.GetObjectTypeName(); this.keepObjectLocked = keepObjectLocked; nameInput.SetValue(objectToRename.GetName()); nameInput.SetLabel("Name", "New name"); nameInput.SetType("string"); CloseBtn.Button.onClick.RemoveAllListeners(); CloseBtn.Button.onClick.AddListener(Cancel); if (cancelCallback != null) { CloseBtn.Button.onClick.AddListener(cancelCallback); } this.confirmCallback = confirmCallback; }
public void InitDialog(IActionProvider actionProvider, Base.ActionMetadata actionMetadata, Base.ActionPoint actionPoint) { this.actionMetadata = actionMetadata; CurrentActionPoint = actionPoint; this.actionProvider = actionProvider; actionParametersMetadata = new Dictionary<string, Base.ActionParameterMetadata>(); foreach (IO.Swagger.Model.ActionParameterMeta meta in actionMetadata.Parameters) { actionParametersMetadata.Add(meta.Name, new Base.ActionParameterMetadata(meta)); } foreach (Transform t in DynamicContent.transform) { Destroy(t.gameObject); } nameInput.SetLabel("Name", "Name of the action"); nameInput.SetType("string"); }
public void InitDialog(ActionObjectMetadata metadata) { actionObjectMetadata = metadata; parametersMetadata = new Dictionary <string, ParameterMetadata>(); foreach (IO.Swagger.Model.ParameterMeta meta in metadata.Settings) { parametersMetadata.Add(meta.Name, new ParameterMetadata(meta)); } foreach (Transform t in DynamicContent.transform) { Destroy(t.gameObject); } nameInput.SetLabel("Name", "Name of the action object"); nameInput.SetType("string"); }
public override void SetType(string type, bool linkable, bool switchBtnClicked) { base.SetType(type, linkable, switchBtnClicked); if (type == "link") { //Input.gameObject.SetActive(false); //Input.Input.onValueChanged. //Input.Input.onValueChanged.RemoveAllListeners(); } else if (type == ProjectParameterText) { //Input.gameObject.SetActive(false); //Input.Input.onValueChanged.RemoveAllListeners(); } else { //Input.gameObject.SetActive(true); //Input.Input.onValueChanged.RemoveAllListeners(); Input.SetType(type); switch (ParameterMetadata.Type) { case "integer": if (string.IsNullOrEmpty(Input.Input.text)) { Input.SetValue(ParameterMetadata.GetDefaultValue <int>()); } if (switchBtnClicked) { Input.Input.onValueChanged.Invoke(Input.Input.text); } else { Input.Input.onValueChanged.AddListener((string value) => OnChangeInt(value, type)); } break; case "double": if (string.IsNullOrEmpty(Input.Input.text)) { Input.SetValue(ParameterMetadata.GetDefaultValue <double>()); } if (switchBtnClicked) { Input.Input.onValueChanged.Invoke(Input.Input.text); } else { Input.Input.onValueChanged.AddListener((string value) => OnChangeDouble(value, type)); } break; case "string": if (string.IsNullOrEmpty(Input.Input.text)) { Input.SetValue(ParameterMetadata.GetDefaultValue <string>()); } if (switchBtnClicked) { Input.Input.onValueChanged.Invoke(Input.Input.text); } else { Input.Input.onValueChanged.AddListener((string value) => onChangeParameterHandler(Input.GetName(), value, type)); } break; } } }