Beispiel #1
0
        /// <summary>
        /// Called if the user starts a gesture on the object
        /// Creates a copy based on the given prefab and initializes the copy
        /// </summary>
        /// <param name="eventData">The event data of the gesture</param>
        public void OnPointerDown(MixedRealityPointerEventData eventData)
        {
            GameObject currentPointerTarget = eventData.Pointer.Result.CurrentPointerTarget;

            // only do this if we are out of selection mode, otherwise this is in conflict with the selection gesture
            if (!IssueSelectionManager.Instance.SelectionModeActive
                //clicking the edit or delete button shouldn't spawn a card
                && currentPointerTarget.GetComponent <EditButton>() == null && currentPointerTarget.GetComponent <DeleteButton>() == null)
            {
                // pass instantiation data to the copy so that other clients also know which issue is contained in the created copy
                object[] instantiationData;
                if (localDataDisplay.Content.Source == DataSource.REQUIREMENTS_BAZAAR)
                {
                    instantiationData = new object[1];
                }
                else if (localDataDisplay.Content.Source == DataSource.GITHUB)
                {
                    instantiationData    = new object[2];
                    instantiationData[1] = localDataDisplay.Content.ProjectId;
                }
                else
                {
                    Debug.LogError("Unexpected source: " + localDataDisplay.Content.Source, gameObject);
                    return;
                }

                instantiationData[0] = localDataDisplay.Content.Id; // same for ReqBaz and GitHub

                // create the copy, get the relevant components and set them up
                ResourceManager.Instance.SceneNetworkInstantiate(copyObject, transform.position, transform.rotation,
                                                                 (obj) =>
                {
                    copyInstance  = obj;
                    handlerOnCopy = copyInstance?.GetComponentInChildren <ObjectManipulator>();
                    IssueDataDisplay remoteDataDisplay = copyInstance?.GetComponent <IssueDataDisplay>();
                    if (handlerOnCopy == null || remoteDataDisplay == null)
                    {
                        if (handlerOnCopy == null)
                        {
                            SpecialDebugMessages.LogComponentNotFoundError(this, nameof(ObjectManipulator), copyInstance);
                        }
                        if (remoteDataDisplay == null)
                        {
                            SpecialDebugMessages.LogComponentNotFoundError(this, nameof(IssueDataDisplay), copyInstance);
                        }
                        PhotonNetwork.Destroy(copyInstance);
                    }
                    else
                    {
                        remoteDataDisplay.Setup(localDataDisplay.Content);
                        handlerOnCopy.OnPointerDown(eventData);
                    }
                },
                                                                 instantiationData);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Called if the GameObject is enabled
 /// Registers for the IssueEdited and IssueDeleted Events
 /// </summary>
 private void OnEnable()
 {
     //Get the edit menu from the project tracker
     issueDataDisplay = GetComponent <IssueDataDisplay>();
     if (issueDataDisplay == null)
     {
         SpecialDebugMessages.LogComponentNotFoundError(this, nameof(IssueDataDisplay), gameObject);
     }
     projectTracker = GameObject.FindObjectOfType <ProjectTracker>();
     editMenu       = projectTracker.editIssueMenu;
     if (editMenu != null)
     {
         editMenu.IssueEdited += OnIssueEdited;
     }
     if (projectTracker != null)
     {
         projectTracker.IssueDeleted += OnIssueDeleted;
     }
 }
Beispiel #3
0
 private void Awake()
 {
     issueDataDisplay = GetComponent <IssueDataDisplay>();
 }