// 오른쪽 -> 왼쪽
        void UnloadPage(UserControl page)
        {
            Storyboard hidePage = (tfvUC.Resources[string.Format("{0}Out", TransitionType.ToString())] as Storyboard).Clone();

            hidePage.Completed += hidePage_Completed;

            hidePage.Begin(tfvUC.contentPresenter);
        }
        void newPage_Loaded(object sender, RoutedEventArgs e)
        {
            Storyboard showNewPage = tfvUC.Resources[string.Format("{0}In", TransitionType.ToString())] as Storyboard;

            showNewPage.Begin(tfvUC.contentPresenter);

            CurrentPage = sender as UserControl;
        }
Beispiel #3
0
 public StateType GetOutputState(TransitionType trans)
 {
     if (this.map.ContainsKey(trans))
     {
         return(this.map[trans]);
     }
     Debug.LogError($"error,Transition:{trans.ToString()} not exist in state:" + GetType().ToString());
     return(StateType.None);
 }
        private void HidePage_Completed(object sender, EventArgs e)
        {
            Storyboard hidePage = (Resources[string.Format("{0}Out", TransitionType.ToString())] as Storyboard).Clone();

            hidePage.Completed -= HidePage_Completed;

            contentPresenter.Content = null;

            ShowNextPage();
        }
Beispiel #5
0
        public override string ToString()
        {
            if (type_ == TransitionType.CUT)
            {
                return(string.Empty);
            }
            StringBuilder sb = new StringBuilder(type_.ToString())
                               .AppendFormat(" {0} {1} {2} {3}", duration_, easing_.ToString().ToUpperInvariant(), direction_, pause_);

            return(sb.ToString());
        }
        private void HandleTransitionTriggered(TransitionType transitionType)
        {
            _gameState.TransitionTriggered -= HandleTransitionTriggered;
            // This may be true if we are closing the game, which cancels all async processes.
            if (_animator == null)
            {
                return;
            }

            _animator.SetBool(transitionType.ToString(), true);
        }
Beispiel #7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("Transition({0})", TransitionType.ToString()));
            if (TransitionType == TransitionTypes.Navigation)
            {
                sb.Append(string.Format("{0}------>{1}", Parent.Parent.Name, DataObject.Name));
            }

            return(sb.ToString());
        }
Beispiel #8
0
        private void SetTransition(TransitionType type)
        {
            _currentTransition = _transitions.FirstOrDefault(p => p.transitionType == type);
            var disabledTransitions = _transitions.Where(p => p != _currentTransition);

            if (_currentTransition == null)
            {
                Debug.LogError($"Transition '{type.ToString()}' does not exist.");
            }
            else
            {
                _currentTransition.gameObject.SetActive(true);
            }

            disabledTransitions.ToList().ForEach(p => p.gameObject.SetActive(false));
        }
Beispiel #9
0
        public void DeleteTransition(TransitionType trans)
        {
            if (trans == TransitionType.None)
            {
                Debug.LogError("DeleteTransition None is not allowed");
                return;
            }

            if (this.map.ContainsKey(trans))
            {
                this.map.Remove(trans);
                return;
            }

            Debug.LogError($"error,Transition:{trans.ToString()} not exist");
        }
        private static void FillAnimation(DoubleAnimationUsingKeyFrames animation, TransitionType type, double from, double to, TimeSpan duration, double fps)
        {
            Equation equation = (Equation)Delegate.CreateDelegate(typeof(Equation), typeof(Equations).GetMethod(type.ToString()));

            double total = duration.TotalMilliseconds;
            double step = 1000D / (double)fps;

            // clear animation
            animation.KeyFrames.Clear();

            for (double i = 0; i < total; i += step) {
                LinearDoubleKeyFrame frame = new LinearDoubleKeyFrame();
                frame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(i));
                frame.Value = equation(i, from, to - from, total);

                animation.KeyFrames.Add(frame);
            }

            // always add exact final key frame
            LinearDoubleKeyFrame finalFrame = new LinearDoubleKeyFrame();
            finalFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(total));
            finalFrame.Value = to;
            animation.KeyFrames.Add(finalFrame);
        }
Beispiel #11
0
 public override string ToString() => TransitionType.ToString();
Beispiel #12
0
        public bool LoadBG(int videoLayer, string clipname, bool loop, TransitionType transition, uint transitionDuration, TransitionDirection direction, uint seek, uint length)
        {
            clipname = clipname.Replace("\\", "\\\\");
            if (videoLayer == -1)
            {
                Connection.SendString("LOADBG " + ID + " \"" + clipname + "\"" + (string)(loop ? " LOOP" : "") + " " + transition.ToString() + " " + transitionDuration.ToString() + " " + direction.ToString() + " SEEK " + seek.ToString() + " LENGTH " + length.ToString());
            }
            else
            {
                Connection.SendString("LOADBG " + ID + "-" + videoLayer + " \"" + clipname + "\"" + (string)(loop ? " LOOP" : "") + " " + transition.ToString() + " " + transitionDuration.ToString() + " " + direction.ToString() + " SEEK " + seek.ToString() + " LENGTH " + length.ToString());
            }

            return(true);
        }
Beispiel #13
0
        public bool LoadBG(int videoLayer, string clipname, bool loop, TransitionType transition, uint transitionDuration)
        {
            clipname = clipname.Replace("\\", "\\\\");
            if (videoLayer == -1)
            {
                Connection.SendString("LOADBG " + ID + " " + clipname + (string)(loop ? " LOOP" : "") + " " + transition.ToString() + " " + transitionDuration.ToString());
            }
            else
            {
                Connection.SendString("LOADBG " + ID + "-" + videoLayer + " " + clipname + (string)(loop ? " LOOP" : "") + " " + transition.ToString() + " " + transitionDuration.ToString());
            }

            return(true);
        }
Beispiel #14
0
        private static void FillAnimation(DoubleAnimationUsingKeyFrames animation, TransitionType type, double from, double to, TimeSpan duration, double fps)
        {
            Equation equation = (Equation)Delegate.CreateDelegate(typeof(Equation), typeof(Equations).GetMethod(type.ToString()));

            double total = duration.TotalMilliseconds;
            double step  = 1000D / (double)fps;

            // clear animation
            animation.KeyFrames.Clear();

            for (double i = 0; i < total; i += step)
            {
                LinearDoubleKeyFrame frame = new LinearDoubleKeyFrame();
                frame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(i));
                frame.Value   = equation(i, from, to - from, total);

                animation.KeyFrames.Add(frame);
            }

            // always add exact final key frame
            LinearDoubleKeyFrame finalFrame = new LinearDoubleKeyFrame();

            finalFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(total));
            finalFrame.Value   = to;
            animation.KeyFrames.Add(finalFrame);
        }
Beispiel #15
0
 public override string ToString()
 {
     return(TransitionType.ToString());
 }
Beispiel #16
0
        /// <summary>
        /// Method to show/play image or video
        /// </summary>
        public void PlaySlideShow()
        {
            string TransitionType;

            string[] TransitionEffects = new[] { "Fade" };


            try
            {
                if (thelist.Count == 0)
                {
                    return;
                }

                if (currentSourceIndex == thelist.Count)
                {
                    return;
                }

                ImageDetails afile = thelist.ElementAt(currentSourceIndex);

                var oldCtrlIndex = currentCtrlIndex;
                currentCtrlIndex = (currentCtrlIndex + 1) % 2;

                currentSourceIndex = (currentSourceIndex + 1) % thelist.Count;


                if ((afile.Path as string).Contains(@".mp4"))
                {
                    myImage.Visibility  = Visibility.Collapsed;
                    myImage2.Visibility = Visibility.Collapsed;

                    myVideo.Visibility = Visibility.Visible;


                    myVideo.Source = thelist.CreateVideoSource(afile.Path);

                    myVideo.Play();

                    timerImageChange.Interval = TimeSpan.FromSeconds(afile.Times);
                }
                else
                {
                    myImage.Visibility  = Visibility.Visible;
                    myImage2.Visibility = Visibility.Visible;
                    myVideo.Visibility  = Visibility.Collapsed;

                    Image imgFadeOut = imageControls[oldCtrlIndex];
                    Image imgFadeIn  = imageControls[currentCtrlIndex];


                    ImageSource dImage = thelist.CreateImageSource(afile.Path);

                    imgFadeIn.Source = dImage;

                    TransitionType = TransitionEffects[effectIndex].ToString();

                    Storyboard StboardFadeOut = (Resources[string.Format("{0}Out", TransitionType.ToString())] as Storyboard).Clone();
                    StboardFadeOut.Begin(imgFadeOut);
                    Storyboard StboardFadeIn = Resources[string.Format("{0}In", TransitionType.ToString())] as Storyboard;
                    StboardFadeIn.Begin(imgFadeIn);

                    timerImageChange.Interval = new TimeSpan(0, 0, afile.Times);
                }
            }
            catch { }
        }
Beispiel #17
0
        public bool LoadBG(int videoLayer, string clipname, bool loop, TransitionType transition, uint transitionDuration, TransitionDirection direction, uint seek, uint length)
        {
            clipname = clipname.Replace("\\", "\\\\");
            if (videoLayer == -1)
                Connection.SendString("LOADBG " + ID + " " + clipname + (string)(loop ? " LOOP" : "") + " " + transition.ToString() + " " + transitionDuration.ToString() + " " + direction.ToString() + " SEEK " + seek.ToString() + " LENGTH " + length.ToString());
            else
                Connection.SendString("LOADBG " + ID + "-" + videoLayer + " " + clipname + (string)(loop ? " LOOP" : "") + " " + transition.ToString() + " " + transitionDuration.ToString() + " " + direction.ToString() + " SEEK " + seek.ToString() + " LENGTH " + length.ToString());

            return true;
        }
Beispiel #18
0
        public void PerformTransition(TransitionType trans, params object[] paras)
        {
            if (trans == TransitionType.None)
            {
                Debug.LogError("error,Transition None is not allowed for PerformTransition()");
                return;
            }

            StateType stateType = this.CurState.GetOutputState(trans);

            if (stateType == StateType.None)
            {
                Debug.LogError("error,state:" + stateType + " does not have a target state for transition " + trans);
                return;
            }

            for (int i = 0; i < this.states.Count; i++)
            {
                if (this.states[i].StateType == stateType)
                {
                    this.CurState.DoBeforeLeaving();
                    this.CurState = this.states[i];
                    this.CurState.DoBeforeEntering(paras);
                    this.CurState.DoAfterEntering(paras);
                    this.CurStateType = stateType;
                    return;
                }
            }
            Debug.LogError("state:" + CurStateType.ToString() + " do not contain transition:" + trans.ToString());
        }