Beispiel #1
0
        private bool CheckIfStepIsDescendent(TimelineStepViewBehaviour stepView)
        {
            // How can we target a descendent if it's being dragged with its parents? I'm sure we'll find a way, but until then...

            // Prevent re-attachment to self...
            return(Event.TargetsEnumerable.Contains(stepView.Step));
        }
        private void GenerateStartStepView()
        {
            StartStepView = Instantiate(StepViewPrefab).GetComponent <TimelineStepViewBehaviour>();

            StartStepView.RectTransform.SetParent(StepViewParent, false);
            StartStepView.RectTransform.anchoredPosition = Vector2.zero;

            StartStepView.Step = Timeline.StartStep;

            RegisterStepView(StartStepView, false);
        }
Beispiel #3
0
        public void ReceiveDraggedStep(TimelineStepViewBehaviour stepView)
        {
            if (CheckIfStepIsDescendent(stepView))
            {
                return;
            }

            stepView.Step.IsJustMovingNotBeingDeleted = true;

            stepView.Step.RequestRemoval();

            Event.AddTarget(stepView.Step);

            stepView.Step.IsJustMovingNotBeingDeleted = false;
        }
        public static void UnregisterStepView(TimelineStepViewBehaviour stepView)
        {
            if (!Instance.StepViews.Contains(stepView))
            {
                throw new InvalidOperationException("Step view not registered.");
            }

            stepView.Clicked     -= Instance.HandleStepViewClicked;
            stepView.DragStarted -= Instance.HandleStepViewDragStarted;
            stepView.DragEnded   -= Instance.HandleStepViewDragEnded;

            Instance.StepViews.Remove(stepView);

            Instance.Arrange();
        }
        private void ClearStartStepView()
        {
            if (StartStepView == null)
            {
                return;
            }

            var ssv = StartStepView;

            StartStepView = null;

            UnregisterStepView(ssv);

            ssv.Shutdown();

            Destroy(ssv.gameObject);
        }
        public static void RegisterStepView(TimelineStepViewBehaviour stepView, bool select = true)
        {
            if (Instance.StepViews.Contains(stepView))
            {
                throw new InvalidOperationException("Step view already registered.");
            }

            stepView.Clicked     += Instance.HandleStepViewClicked;
            stepView.DragStarted += Instance.HandleStepViewDragStarted;
            stepView.DragEnded   += Instance.HandleStepViewDragEnded;

            Instance.StepViews.Add(stepView);

            Instance.Arrange();

            if (select)
            {
                Instance.SelectedStep = stepView.Step;
            }
        }
Beispiel #7
0
 private void HandleStepViewDropped(TimelineStepViewBehaviour stepView)
 {
     ReceiveDraggedStep(stepView);
 }
 private void HandleStepViewClicked(TimelineStepViewBehaviour stepView)
 {
     SelectedStep = stepView.Step;
 }
        private void HandleStepViewDragEnded(TimelineStepViewBehaviour stepView)
        {
            Arrange();

            WorkspaceScrollRect.enabled = true;
        }
 private void HandleStepViewDragStarted(TimelineStepViewBehaviour stepView)
 {
     WorkspaceScrollRect.enabled = false;
 }
 public static Vector2 GetStepViewPositionRelativeToWorkspace(TimelineStepViewBehaviour stepView)
 {
     return(Instance.StepViewParent.position - stepView.RectTransform.position);
 }