Ejemplo n.º 1
0
        private bool ResetSelected(bool objectBeingDeleted, bool deleteChildren)
        {
            bool flag = false;

            if (CurrentlySelectedObject != null)
            {
                ManipulatableObject component         = CurrentlySelectedObject.GetComponent <ManipulatableObject>();
                ObjectManipulator   componentInParent = CurrentlySelectedObject.GetComponentInParent <ObjectManipulator>();
                if (componentInParent != null)
                {
                    if (componentInParent.IsAllowed)
                    {
                        Transform parent = CurrentlySelectedObject.transform.parent;
                        CurrentlySelectedObject.transform.SetParent(oldParentOfSelectedObject, worldPositionStays: true);
                        component.SetParent(parent);
                        componentInParent.WasReparented = true;
                    }
                    else if (!restoreOldObject())
                    {
                        flag = true;
                    }
                    if (!objectBeingDeleted && this.ObjectDeselected != null)
                    {
                        this.ObjectDeselected.InvokeSafe(componentInParent);
                    }
                    if (flag)
                    {
                        component.RemoveObject(deleteChildren);
                    }
                }
            }
            CurrentlySelectedObject = null;
            return(flag);
        }
Ejemplo n.º 2
0
 private void OnDragItemInputInteractionStateTouchPhaseStationary(RaycastHit topHit, TouchEquivalent touch)
 {
     PositionDragItem(topHit, touch);
     if (this.DragStateStationary != null)
     {
         ObjectManipulator componentInParent = CurrentlySelectedObject.GetComponentInParent <ObjectManipulator>();
         this.DragStateStationary(componentInParent.gameObject, touch);
     }
 }
Ejemplo n.º 3
0
 private void OnSwipeScreenInputStateTouchPhaseEnded()
 {
     CurrentState.ExitState();
     if (CurrentlySelectedObject == null || CurrentlySelectedObject.GetComponentInParent <ManipulatableObject>() == null)
     {
         CurrentState = noSelectionState;
     }
     else
     {
         CurrentState = activeSelectionState;
     }
     CurrentState.EnterState(TargetLayerMask, MinTimeToMoveInput);
 }
Ejemplo n.º 4
0
        private void OnDragItemInputInteractionStateTouchPhaseEnded(RaycastHit topHit, TouchEquivalent touch)
        {
            CurrentState.ExitState();
            CurrentState = activeSelectionState;
            bool flag = false;

            if (CurrentlySelectedObject != null)
            {
                if (topHit.Equals(default(RaycastHit)))
                {
                    CurrentlySelectedObject.transform.position = new Vector3(0f, 1000f, 0f);
                    DeleteSelectedItem(deleteChildren: true);
                    InputProcessingPaused = false;
                    CurrentState          = noSelectionState;
                    CurrentState.EnterState(TargetLayerMask, MinTimeToMoveInput);
                    return;
                }
                PositionDragItem(topHit, touch);
                ObjectManipulator i = CurrentlySelectedObject.GetComponentInParent <ObjectManipulator>();
                if (i != null && i.IsAllowed)
                {
                    if (BeforeDragComplete != null)
                    {
                        flag = true;
                        BeforeDragComplete.InvokeSafe(i, delegate(bool success)
                        {
                            if (success)
                            {
                                storeOldObject();
                                CurrentState.EnterState(TargetLayerMask, MinTimeToMoveInput);
                            }
                            else
                            {
                                i.BaseLocationIsValid = false;
                            }
                        });
                    }
                    else
                    {
                        storeOldObject();
                    }
                }
            }
            if (!flag)
            {
                CurrentState.EnterState(TargetLayerMask, MinTimeToMoveInput);
            }
        }