Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 public void OnPointerDown(MixedRealityPointerEventData eventData)
 {
     ResourceManager.Instance.SceneNetworkInstantiate(visualizationPrefab, transform.position, transform.rotation, (instance) =>
     {
         boxStateController = instance.GetComponentInChildren <BoundingBoxStateController>();
         if (boxStateController == null)
         {
             SpecialDebugMessages.LogComponentNotFoundError(this, nameof(BoundingBoxStateController), instance);
         }
         boxStateController.BoundingBoxActive = true;
         handler = instance.GetComponentInChildren <ObjectManipulator>();
         handler.OnPointerDown(eventData);
     });
 }
Exemplo n.º 3
0
 public void OnPointerDown(MixedRealityPointerEventData eventData)
 {
     redirectTarget.OnPointerDown(eventData);
 }