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"); }
/// <summary> /// Updates list of joints in expert block /// </summary> private void UpdateJointsList() { DestroyJointsFields(); foreach (IO.Swagger.Model.Joint joint in joints.Joints) { LabeledInput labeledInput = Instantiate(GameManager.Instance.LabeledFloatInput, JointsDynamicList.transform).GetComponent <LabeledInput>(); labeledInput.SetLabel(joint.Name, joint.Name); NumberFormatInfo numberFormatInfo = new NumberFormatInfo(); numberFormatInfo.NumberDecimalSeparator = "."; labeledInput.SetValue(joint.Value.ToString(numberFormatInfo)); //labeledInput.Input.placeholder.color = Color.white; // text object of TMP input cannot be accessed directly //labeledInput.Input.GetComponentsInChildren<TMPro.TextMeshProUGUI>() // .First(c => c.gameObject.name == "Text").color = Color.white; labeledInput.SetDarkMode(false); } }
/// <summary> /// Updates values (angles) of joints in expert block /// </summary> public void UpdateJointsList() { foreach (RectTransform o in JointsDynamicList.GetComponentsInChildren <RectTransform>()) { if (!o.gameObject.CompareTag("Persistent")) { Destroy(o.gameObject); } } foreach (IO.Swagger.Model.Joint joint in joints.Joints) { LabeledInput labeledInput = Instantiate(GameManager.Instance.LabeledFloatInput, JointsDynamicList.transform).GetComponent <LabeledInput>(); labeledInput.SetLabel(joint.Name, joint.Name); NumberFormatInfo numberFormatInfo = new NumberFormatInfo(); numberFormatInfo.NumberDecimalSeparator = "."; labeledInput.SetValue(joint.Value.ToString(numberFormatInfo)); } }