public async void ValidateFields() { bool interactable = true; name = NameInput.text; if (string.IsNullOrEmpty(name)) { buttonTooltip.description = "Name is required parameter"; interactable = false; } else if (CurrentActionPoint.OrientationNameExist(name) || CurrentActionPoint.JointsNameExist(name)) { buttonTooltip.description = "There already exists orientation or joints with name " + name; interactable = false; } if (interactable) { if (RobotsList.Dropdown.dropdownItems.Count == 0) { interactable = false; buttonTooltip.description = "There is no robot to be used"; } } buttonTooltip.enabled = !interactable; CreateNewJoints.interactable = interactable; }
public async void ValidateFields() { bool interactable = true; jointsName = NameInput.text; if (string.IsNullOrEmpty(jointsName)) { buttonTooltip.description = "Name is required parameter"; interactable = false; } else if (CurrentActionPoint.OrientationNameExist(jointsName) || CurrentActionPoint.JointsNameExist(jointsName)) { buttonTooltip.description = "There already exists orientation or joints with name " + jointsName; interactable = false; } if (interactable) { if (!SceneManager.Instance.IsRobotSelected()) { interactable = false; buttonTooltip.description = "Robot is not selected"; } } buttonTooltip.enabled = !interactable; CreateNewJoints.interactable = interactable; }
public async void AddOrientation(string name, string robotName) { Debug.Assert(CurrentActionPoint != null); IRobot robot; try { robot = SceneManager.Instance.GetRobotByName(robotName); } catch (ItemNotFoundException ex) { Notifications.Instance.ShowNotification("Failed to add orientation", "Could not found robot called: " + robotName); Debug.LogError(ex); return; } if (CurrentActionPoint.OrientationNameExist(name) || CurrentActionPoint.JointsNameExist(name)) { Notifications.Instance.ShowNotification("Failed to add orientation", "There already exists orientation or joints with name " + name); return; } IO.Swagger.Model.Orientation orientation = new IO.Swagger.Model.Orientation(); if (CurrentActionPoint.Parent != null) { orientation = DataHelper.QuaternionToOrientation(TransformConvertor.UnityToROS(Quaternion.Inverse(CurrentActionPoint.Parent.GetTransform().rotation))); } preselectedOrientation = name; bool successOrientation = await Base.GameManager.Instance.AddActionPointOrientation(CurrentActionPoint, orientation, name); bool successJoints = await Base.GameManager.Instance.AddActionPointJoints(CurrentActionPoint, name, robot.GetId()); if (successOrientation && successJoints) { inputDialog.Close(); } else { preselectedOrientation = null; } }