public virtual void InitAP(IO.Swagger.Model.ActionPoint apData, float size, IActionPointParent parent = null) { Debug.Assert(apData != null); SetParent(parent); Data = apData; OrientationsVisible = PlayerPrefsHelper.LoadBool("/AP/" + Data.Id + "/visible", true); ActionsCollapsed = PlayerPrefsHelper.LoadBool("/AP/" + Data.Id + "/actionsCollapsed", false); transform.localPosition = GetScenePosition(); SetSize(size); ActivateForGizmo((ControlBoxManager.Instance.UseGizmoMove && ProjectManager.Instance.AllowEdit && !MenuManager.Instance.IsAnyMenuOpened) ? "GizmoRuntime" : "Default"); if (Data.Actions == null) { Data.Actions = new List <IO.Swagger.Model.Action>(); } if (Data.Orientations == null) { Data.Orientations = new List <NamedOrientation>(); } if (Data.RobotJoints == null) { Data.RobotJoints = new List <ProjectRobotJoints>(); } }
/// <summary> /// Updates actions of ActionPoint and ProjectActionPoint received from server. /// </summary> /// <param name="projectActionPoint"></param> /// <returns></returns> public virtual (List <string>, Dictionary <string, string>) UpdateActionPoint(IO.Swagger.Model.ActionPoint projectActionPoint) { if (Data.Parent != projectActionPoint.Parent) { ChangeParent(projectActionPoint.Parent); } Data = projectActionPoint; transform.localPosition = GetScenePosition(); transform.localRotation = GetSceneOrientation(); List <string> currentA = new List <string>(); foreach (NamedOrientation orientation in Data.Orientations) { UpdateOrientation(orientation); } // Connections between actions (action -> output --- input <- action2) Dictionary <string, string> connections = new Dictionary <string, string>(); if (projectActionPoint.Actions != null) { //update actions foreach (IO.Swagger.Model.Action projectAction in projectActionPoint.Actions) { // if action exist, just update it, otherwise create new if (!Actions.TryGetValue(projectAction.Id, out Action action)) { try { action = ProjectManager.Instance.SpawnAction(projectAction, this); } catch (RequestFailedException ex) { Debug.LogError(ex); continue; } } // updates name of the action action.ActionUpdateBaseData(DataHelper.ActionToBareAction(projectAction)); // updates parameters of the action action.ActionUpdate(projectAction); // Add current connection from the server, we will only map the outputs /*foreach (IO.Swagger.Model.ActionIO actionIO in projectAction.Outputs) { * //if(!connections.ContainsKey(projectAction.Id)) * connections.Add(projectAction.Id, actionIO.Default); * }*/ // local list of all actions for current action point currentA.Add(projectAction.Id); } } if (Parent != null) { if (ConnectionToParent != null) { ConnectionToParent.UpdateLine(); } else { SetConnectionToParent(Parent); } } if (actionPointMenu != null && actionPointMenu.CurrentActionPoint == this) { actionPointMenu.UpdateMenu(); } return(currentA, connections); }
public override void InitAP(IO.Swagger.Model.ActionPoint apData, float size, IActionPointParent parent = null) { base.InitAP(apData, size, parent); ActionPointName.text = apData.Name; }
public ProjectActionPointEventArgs(IO.Swagger.Model.ActionPoint actionPoint) { ActionPoint = actionPoint; }
public override (List <string>, Dictionary <string, string>) UpdateActionPoint(IO.Swagger.Model.ActionPoint projectActionPoint) { (List <string>, Dictionary <string, string>)result = base.UpdateActionPoint(projectActionPoint); ActionPointName.text = projectActionPoint.Name; return(result); }