public async void HideMenu() { if (CurrentActionPoint == null) { return; } gameObject.SetActive(false); if (isOrientationDetail) { //await CurrentActionPoint.GetOrientationVisual(orientation.Id).WriteUnlock(); } else //joints { DestroyJointsFields(); /*try { * await WebsocketManager.Instance.WriteUnlock(joints.Id); * } catch (RequestFailedException ex) { * Debug.LogError(ex.Message); * }*/ } foreach (KeyValuePair <string, float> rv in robotVisibilityBackup) { await PrepareRobotModel(rv.Key, true); } robotVisibilityBackup.Clear(); CurrentActionPoint = null; }
public void ShowMenu(Base.ActionPoint actionPoint) { CurrentActionPoint = actionPoint; OrientationManualDefaultButton.SetLabel(GameManager.Instance.ExpertMode ? "Manual" : "Default"); UpdateMenu(); SideMenu.Open(); }
public async void ShowMenu(Base.ActionPoint currentActionPoint, ProjectRobotJoints joints) { /*try { * await WebsocketManager.Instance.WriteLock(joints.Id, false); * } catch (RequestFailedException ex) { * Notifications.Instance.ShowNotification("Failed to lock joints", ex.Message); * Debug.LogError(ex.Message); * return; * }*/ CurrentActionPoint = currentActionPoint; this.joints = joints; isOrientationDetail = false; try { RobotName.text = SceneManager.Instance.GetRobot(joints.RobotId).GetName(); ArmName.text = joints.ArmId; } catch (ItemNotFoundException ex) { Notifications.Instance.ShowNotification(ex.Message, ""); } await PrepareRobotModel(joints.RobotId, false); MoveHereModel(); UpdateJointsList(); ShowMenu(currentActionPoint); }
private void AddActionPointButton(Base.ActionPoint actionPoint) { ActionButton btn = Instantiate(Base.GameManager.Instance.ButtonPrefab, ActionPointsList.transform).GetComponent <ActionButton>(); btn.transform.localScale = new Vector3(1, 1, 1); btn.SetLabel(actionPoint.Data.Name); btn.Button.onClick.AddListener(() => ShowActionPoint(actionPoint)); btn.ObjectId = actionPoint.Data.Id; // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button OutlineOnClick APoutline = actionPoint.GetComponent <OutlineOnClick>(); EventTrigger eventTrigger = btn.gameObject.AddComponent <EventTrigger>(); // Create OnPointerEnter entry EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight()); eventTrigger.triggers.Add(OnPointerEnter); // Create OnPointerExit entry EventTrigger.Entry OnPointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight()); eventTrigger.triggers.Add(OnPointerExit); }
public void ShowMenu(Base.ActionPoint currentActionPoint, NamedOrientation orientation) { this.orientation = orientation; this.isOrientationDetail = true; ShowMenu(currentActionPoint); }
/// <summary> /// Opens menu for adding joints /// </summary> /// <param name="actionPoint"></param> public void ShowMenu(Base.ActionPoint actionPoint) { CurrentActionPoint = actionPoint; NameInput.text = CurrentActionPoint.GetFreeOrientationName(); UpdateMenu(); SideMenu.Open(); }
/// <summary> /// Opens menu for adding joints /// </summary> /// <param name="actionPoint"></param> public void ShowMenu(Base.ActionPoint actionPoint) { CurrentActionPoint = actionPoint; NameInput.text = CurrentActionPoint.GetFreeOrientationName(); UpdateMenu(); gameObject.SetActive(true); }
public void ShowMenu(Base.ActionPoint actionPoint, string preselectedOrientation) { ShowMenu(actionPoint); try { OpenDetailMenu(actionPoint.GetOrientation(preselectedOrientation)); } catch (KeyNotFoundException ex) { Notifications.Instance.ShowNotification("Unable to open detail menu", ex.Message); } }
private void ShowMenu(Base.ActionPoint actionPoint) { CurrentActionPoint = actionPoint; OrientationExpertModeBlock.SetActive(isOrientationDetail && GameManager.Instance.ExpertMode); JointsBlock.SetActive(!isOrientationDetail); JointsExpertModeBlock.SetActive(!isOrientationDetail && GameManager.Instance.ExpertMode); UpdateMenu(); gameObject.SetActive(true); }
public void ShowMenu(Base.ActionPoint currentActionPoint, ProjectRobotJoints joints) { this.joints = joints; isOrientationDetail = false; try { RobotName.text = SceneManager.Instance.GetRobot(joints.RobotId).GetName(); } catch (ItemNotFoundException ex) { Notifications.Instance.ShowNotification(ex.Message, ""); } ShowMenu(currentActionPoint); }
public override object GetValue() { string value = (string)base.GetValue(); if (value == null) { return(null); } Base.ActionPoint actionPoint = Base.Scene.Instance.GetactionpointByName(value.Split('.').First()); return(actionPoint.GetNamedOrientationByName(value.Split('.').Last()).Id); }
public void ShowMenu(Base.ActionPoint actionPoint, bool manualMode) { ManualMode = manualMode; CurrentActionPoint = actionPoint; ManualModeBlock.SetActive(ManualMode); NameInput.text = CurrentActionPoint.GetFreeOrientationName(); OrientationManualEdit.SetOrientation(new Orientation()); UpdateMenu(); gameObject.SetActive(true); }
public async void ShowMenu(Base.ActionPoint currentActionPoint, NamedOrientation orientation) { CurrentActionPoint = currentActionPoint; if (!await currentActionPoint.GetOrientationVisual(orientation.Id).WriteLock(false)) { CurrentActionPoint = null; return; } this.orientation = orientation; this.isOrientationDetail = true; ShowMenu(currentActionPoint); }
public void ActionPointJointsAdded(ProjectRobotJoints joints, string actionPointIt) { try { ActionPoint actionPoint = GetActionPoint(actionPointIt); actionPoint.AddJoints(joints); OnProjectChanged?.Invoke(this, EventArgs.Empty); OnActionPointUpdated?.Invoke(this, new ActionPointUpdatedEventArgs(actionPoint)); OnProjectChanged?.Invoke(this, EventArgs.Empty); } catch (KeyNotFoundException ex) { Debug.LogError(ex); Notifications.Instance.ShowNotification("Failed to add action point joints", ex.Message); return; } }
public virtual void Init(IO.Swagger.Model.Action projectAction, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider) { ActionPoint = ap; this.metadata = metadata; ActionProvider = actionProvider; Data = projectAction; UpdateName(Data.Name); if (actionProvider != null) { UpdateType(); } //UpdateRotation(null); SelectorItem = SelectorMenu.Instance.CreateSelectorItem(this); }
public void ActionPointBaseUpdated(ProjectActionPoint projectActionPoint) { try { ActionPoint actionPoint = GetActionPoint(projectActionPoint.Id); actionPoint.ActionPointBaseUpdate(projectActionPoint); OnActionPointsChanged?.Invoke(this, EventArgs.Empty); OnActionPointUpdated?.Invoke(this, new ActionPointUpdatedEventArgs(actionPoint)); OnProjectChanged?.Invoke(this, EventArgs.Empty); } catch (KeyNotFoundException ex) { Debug.Log("Action point " + projectActionPoint.Id + " not found!"); Notifications.Instance.ShowNotification("", "Action point " + projectActionPoint.Id + " not found!"); return; } }
public async Task <bool> Show(Base.ActionPoint actionPoint, string preselectedOrientation) { if (!await Show(actionPoint, true)) { return(false); } try { OpenDetailMenu(actionPoint.GetOrientation(preselectedOrientation)); return(true); } catch (KeyNotFoundException ex) { Notifications.Instance.ShowNotification("Unable to open detail menu", ex.Message); return(false); } }
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 override object GetValue() { string value = (string)base.GetValue(); if (value == null) { return(null); } if (string.IsNullOrEmpty(apName)) { apName = value.Split('.').First(); } Base.ActionPoint actionPoint = Base.ProjectManager.Instance.GetactionpointByName(apName); return(actionPoint.GetJointsByName(value.Split('.').Last()).Id); }
//TODO: check if it works public IO.Swagger.Model.ProjectRobotJoints GetFirstJoints(string robot_id = null, bool valid_only = false) { foreach (IO.Swagger.Model.ProjectRobotJoints robotJoint in Data.RobotJoints) { if ((robot_id != null && robot_id != robotJoint.RobotId) || (valid_only && !robotJoint.IsValid)) { continue; } return(robotJoint); } if (!string.IsNullOrEmpty(Data.Parent)) { ActionPoint parent = ProjectManager.Instance.GetActionPoint(Data.Parent); return(parent.GetFirstJoints()); } throw new ItemNotFoundException(); }
public NamedOrientation GetFirstOrientation() { try { if (Data.Orientations.Count == 0) { if (!string.IsNullOrEmpty(Data.Parent)) { ActionPoint parent = ProjectManager.Instance.GetActionPoint(Data.Parent); return(parent.GetFirstOrientation()); } } else { return(Data.Orientations[0]); } } catch (KeyNotFoundException) { } throw new ItemNotFoundException("No orientation"); }
public override object GetValue() { string apName; string value = (string)base.GetValue(); if (value == null) { return(null); } apName = value.Split('.').First(); try { Base.ActionPoint actionPoint = Base.ProjectManager.Instance.GetactionpointByName(apName); return(actionPoint.GetJointsByName(value.Split('.').Last()).Id); } catch (KeyNotFoundException ex) { Debug.LogError(ex); Debug.LogError(value); return(null); } }
public void ShowMenu(Base.ActionPoint actionPoint, bool manualMode) { ManualMode = manualMode; CurrentActionPoint = actionPoint; ManualModeBlock.SetActive(ManualMode); LiteModeBlock.SetActive(!ManualMode); NameInput.text = CurrentActionPoint.GetFreeOrientationName(); /* * QuaternionX.text = "0"; * QuaternionY.text = "0"; * QuaternionZ.text = "0"; * QuaternionW.text = "1"; */ OrientationManualEdit.SetOrientation(new Orientation()); UpdateMenu(); SideMenu.Open(); }
public override async Task <bool> Show(InteractiveObject obj, bool lockTree) { if (!await base.Show(obj, lockTree)) { return(false); } if (obj is ActionPoint3D actionPoint) { CurrentActionPoint = actionPoint; OrientationManualDefaultButton.SetLabel(GameManager.Instance.ExpertMode ? "Manual" : "Default"); UpdateMenu(); EditorHelper.EnableCanvasGroup(CanvasGroup, true); RobotInfoMenu.Instance.Show(); return(true); } else { return(false); } }
public ActionPoint SpawnActionPoint(IO.Swagger.Model.ProjectActionPoint apData, IActionPointParent actionPointParent) { Debug.Assert(apData != null); GameObject AP; if (actionPointParent == null) { AP = Instantiate(ActionPointPrefab, ActionPointsOrigin.transform); } else { AP = Instantiate(ActionPointPrefab, actionPointParent.GetTransform()); } AP.transform.localScale = new Vector3(1f, 1f, 1f); ActionPoint actionPoint = AP.GetComponent <ActionPoint>(); actionPoint.InitAP(apData, APSize, actionPointParent); ActionPoints.Add(actionPoint.Data.Id, actionPoint); return(actionPoint); }
public void Init(string id, string name, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider) { ActionPoint = ap; this.metadata = metadata; this.ActionProvider = actionProvider; Data.Id = id; if (!GameManager.Instance.CurrentProject.HasLogic) { InputArrow.gameObject.SetActive(false); OutputArrow.gameObject.SetActive(false); } UpdateName(name); //UpdateUuid(Guid.NewGuid().ToString()); UpdateType(); foreach (InputOutput io in GetComponentsInChildren <InputOutput>()) { io.InitData(); } }
public virtual void Init(IO.Swagger.Model.Action projectAction, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider) { ActionPoint = ap; this.metadata = metadata; this.ActionProvider = actionProvider; Data = projectAction; if (!Base.ProjectManager.Instance.ProjectMeta.HasLogic) { InputArrow.gameObject.SetActive(false); OutputArrow.gameObject.SetActive(false); } UpdateName(Data.Name); if (actionProvider != null) { UpdateType(); } foreach (InputOutput io in GetComponentsInChildren <InputOutput>()) { io.Init(null); } }
public async void InitFromMetadata(IActionProvider actionProvider, Base.ActionMetadata actionMetadata, Base.ActionPoint actionPoint) { InitDialog(actionProvider, actionMetadata, actionPoint); actionParameters = await Base.Parameter.InitActionParameters(actionProvider.GetProviderId(), actionParametersMetadata.Values.ToList(), DynamicContent, OnChangeParameterHandler, DynamicContentLayout, CanvasRoot, CurrentActionPoint, false); nameInput.SetValue(Base.ProjectManager.Instance.GetFreeActionName(actionMetadata.Name)); }
public ActionPointEventArgs(ActionPoint actionPoint) { ActionPoint = actionPoint; }
public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider) { base.Init(projectAction, metadata, ap, actionProvider); // Input.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Input); //Output.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Output); }