예제 #1
0
    public void UpdateJointsDynamicList(string robot_id, string arm_id)
    {
        try {
            //string robotId = SceneManager.Instance.RobotNameToId(JointsRobotsList.GetValue().ToString());

            foreach (RectTransform o in JointsDynamicList.GetComponentsInChildren <RectTransform>())
            {
                if (o.gameObject.tag != "Persistent")
                {
                    Destroy(o.gameObject);
                }
            }

            System.Collections.Generic.List <ProjectRobotJoints> joints;
            if (string.IsNullOrEmpty(arm_id))
            {
                joints = CurrentActionPoint.GetAllJoints(true, robot_id).Values.ToList();
            }
            else
            {
                joints = CurrentActionPoint.GetJointsOfArm(robot_id, arm_id, true).Values.ToList();
            }
            foreach (IO.Swagger.Model.ProjectRobotJoints joint in joints)
            {
                CreateJointsButton(JointsDynamicList.transform, joint.Id, joint.Name, () => OpenDetailMenu(joint), joint.IsValid);
            }
        } catch (ItemNotFoundException ex) {
            Debug.LogError(ex);
            Notifications.Instance.ShowNotification("Failed to get robot's ID", "");
            return;
        }
    }
    public void UpdateJointsDynamicList(string robotName)
    {
        if (robotName == null)
        {
            return;
        }

        try {
            string robotId = SceneManager.Instance.RobotNameToId(robotName);

            foreach (RectTransform o in JointsDynamicList.GetComponentsInChildren <RectTransform>())
            {
                if (o.gameObject.tag != "Persistent")
                {
                    Destroy(o.gameObject);
                }
            }

            System.Collections.Generic.List <ProjectRobotJoints> joints = CurrentActionPoint.GetAllJoints(true, robotId).Values.ToList();
            foreach (IO.Swagger.Model.ProjectRobotJoints joint in joints)
            {
                CreateJointsButton(JointsDynamicList.transform, joint.Id, joint.Name, () => OpenDetailMenu(joint)).State = joint.IsValid;
            }
        } catch (ItemNotFoundException ex) {
            Debug.LogError(ex);
            Notifications.Instance.ShowNotification("Failed to get robot's ID", "");
            return;
        }
    }
    public void UpdateJoints(string robot_id, string selectedJoints = null)
    {
        if (robot_id == null)
        {
            return;
        }
        CustomDropdown jointsDropdown = JointsList.Dropdown;

        JointsList.PutData(CurrentActionPoint.GetAllJoints(true, robot_id).Values.ToList(), selectedJoints, null);

        if (jointsDropdown.dropdownItems.Count > 0)
        {
            NoJoints.gameObject.SetActive(false);
            JointsList.gameObject.SetActive(true);
            UpdateJointsBtn.interactable = true;
        }
        else
        {
            JointsList.gameObject.SetActive(false);
            NoJoints.gameObject.SetActive(true);
            UpdateJointsBtn.interactable = false;
        }
    }