Пример #1
0
        /// <summary>
        /// 生成职责处理链
        /// </summary>
        /// <returns>返回处理链的头部</returns>
        public static MotionSuper CreateHandleChain()
        {
            MotionSuper headMotion = null;
            MotionSuper preMotion  = null;
            MotionSuper nextMotion = null;

            try
            {
                //string[] motionNames = GetMotionNames("config\\motion.ini"); // 获取配置文件中类名集合 Waterstrong
                //string[] motionNames = { "Jump", "HandLeftSlide"};
                MotionSuper[] motionSupers = { new Jump(),           new HandsUp(),
                                               new HandsFold(),      new HandsMiddle(),
                                               new HandLeftSlide(),  new HandRightSlide(),
                                               new HandLeftUp(),     new HandRightUp(),
                                               new HandLeftCircle(), new HandRightCircle(),
                                               new HandLeftDown(),   new HandRightDown() };   // Waterstrong Alter
                int           count = 0;
                //foreach (string name in motionNames) // 设置职责链
                foreach (MotionSuper motion in motionSupers) // 设置职责链 // Waterstrong Alter
                {
                    if (count++ == 0)
                    {
                        //headMotion = GetInstance(name);
                        headMotion = motion;// Waterstrong Alter
                        preMotion  = headMotion;
                    }
                    else
                    {
                        //nextMotion = GetInstance(name);
                        nextMotion = motion; // Waterstrong Alter
                        preMotion.SetSuccessor(nextMotion);
                        preMotion = nextMotion;
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(headMotion);
        }
Пример #2
0
 /// <summary>
 /// 设置下一个处理者
 /// </summary>
 /// <param name="successor">后继处理者</param>
 public void SetSuccessor(MotionSuper successor)
 {
     _successor = successor;
 }
Пример #3
0
 private void win_ges_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         // 创建处理链
         _motion = MotionFactory.CreateHandleChain();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
         Application.Current.Shutdown();
     }
     KinectStart();
     StartColorFrame();
     this.txt_filename.Text = ConfigurationSettings.AppSettings["FileName"];
 }
Пример #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            FullScreen.GoFullscreen(this);
            image_scene.Source = new BitmapImage(new Uri("/scene/swust0.jpg", UriKind.Relative));
            image_left.Source = new BitmapImage(new Uri("/scene/left0.png", UriKind.Relative));
            image_right.Source = new BitmapImage(new Uri("/scene/right0.png", UriKind.Relative));

            try
            {
                // 创建处理链
                _motion = MotionFactory.CreateHandleChain();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
                //item_exit_Click(sender, e);
            }

            _skeSubject.DataBinding += new SkeletonSubject.DataBindingEventHandler(_skeSubject_DataBinding);

            _timer.Interval = TimeSpan.FromSeconds(0.01);
            _timer.Tick += new EventHandler(_timer_Tick);

            _timer2.Interval = TimeSpan.FromSeconds(0.01);
            _timer2.Tick += new EventHandler(_timer2_Tick);
            //_timer.Start();

            //播放背景音乐
               // _backgroundMusic.Open(new Uri(Environment.CurrentDirectory + "\\music\\bm.wma", UriKind.Relative));
               // _backgroundMusic.Play();
            //播放讲解
            _sceneMusic.Open(new Uri(Environment.CurrentDirectory + "\\music\\swust0.wma", UriKind.Relative));
            _sceneMusic.Play();
        }
Пример #5
0
        protected MotionSuper _successor = null; // 下一个处理者

        /// <summary>
        /// 设置下一个处理者
        /// </summary>
        /// <param name="successor">后继处理者</param>
        public void SetSuccessor(MotionSuper successor)
        {
            _successor = successor;
        }