Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //初始化
            unit_1 = new Unit_1();
            unit_2 = new Unit_2();
            unit_3 = new Unit_3();
            sign   = new SignAction();

            //啟動框架
            sensor.SkeletonFrameReady += runtime_SkeletonFrameReady;
            sensor.ColorFrameReady    += runtime_VideoFrameReady;
        }
Exemplo n.º 2
0
        public Unit_Page(int selectUnit, int selectAction)
        {
            if (selectUnit == 1)
            {
                unit_1 = new Unit_1();
            }
            else if (selectUnit == 2)
            {
                unit_2 = new Unit_2();
            }
            else if (selectUnit == 3)
            {
                unit_3 = new Unit_3();
            }
            else if (selectUnit == 4)
            {
                unit_4 = new Unit_4();
            }

            else if (selectUnit == 0)
            {
                WU = new WarmUp();
            }


            InitializeComponent();
            unit   = selectUnit;
            action = selectAction;
            //sensor.Start(); //啟動Kinect Sensor
            sensor.ElevationAngle = 0; //調整Kinect角度為0
            //載入與卸載
            var parameters = new TransformSmoothParameters
            {
                Smoothing          = 0.3f,
                Correction         = 0.0f,
                Prediction         = 0.0f,
                JitterRadius       = 1.0f,
                MaxDeviationRadius = 0.5f
            };

            setVoice();
            sensor.SkeletonStream.Enable(parameters); //載入平滑處理參數
            sensor.ColorStream.Enable();              //開啟,彩色影像
            sensor.SkeletonStream.Enable();           //開啟,骨架追蹤

            GetVideo                      = sign.ReturnVideo(unit);
            VideoElement.Source           = new Uri(Directory.GetCurrentDirectory() + GetVideo[0]);
            VideoElement.LoadedBehavior   = MediaState.Manual;
            VideoElement.UnloadedBehavior = MediaState.Manual;
            VideoElement.Play();

            GoodElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\good.m4a");
            GoodElement.LoadedBehavior   = MediaState.Manual;
            GoodElement.UnloadedBehavior = MediaState.Manual;

            BGMusicElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\黃金傳說 - 做菜歌.mp3");
            BGMusicElement.LoadedBehavior   = MediaState.Manual;
            BGMusicElement.UnloadedBehavior = MediaState.Manual;
            BGMusicElement.Play();

            OneElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\1.mp3");
            OneElement.LoadedBehavior   = MediaState.Manual;
            OneElement.UnloadedBehavior = MediaState.Manual;

            TwoElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\2.mp3");
            TwoElement.LoadedBehavior   = MediaState.Manual;
            TwoElement.UnloadedBehavior = MediaState.Manual;

            ThreeElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\3.mp3");
            ThreeElement.LoadedBehavior   = MediaState.Manual;
            ThreeElement.UnloadedBehavior = MediaState.Manual;

            FourElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\4.mp3");
            FourElement.LoadedBehavior   = MediaState.Manual;
            FourElement.UnloadedBehavior = MediaState.Manual;

            FiveElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\5.mp3");
            FiveElement.LoadedBehavior   = MediaState.Manual;
            FiveElement.UnloadedBehavior = MediaState.Manual;

            SixElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\6.mp3");
            SixElement.LoadedBehavior   = MediaState.Manual;
            SixElement.UnloadedBehavior = MediaState.Manual;

            SevenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\7.mp3");
            SevenElement.LoadedBehavior   = MediaState.Manual;
            SevenElement.UnloadedBehavior = MediaState.Manual;

            EightElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\8.mp3");
            EightElement.LoadedBehavior   = MediaState.Manual;
            EightElement.UnloadedBehavior = MediaState.Manual;

            NineElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\9.mp3");
            NineElement.LoadedBehavior   = MediaState.Manual;
            NineElement.UnloadedBehavior = MediaState.Manual;

            TenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\10.mp3");
            TenElement.LoadedBehavior   = MediaState.Manual;
            TenElement.UnloadedBehavior = MediaState.Manual;

            ElevenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\11.mp3");
            ElevenElement.LoadedBehavior   = MediaState.Manual;
            ElevenElement.UnloadedBehavior = MediaState.Manual;

            TwelveElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\12.mp3");
            TwelveElement.LoadedBehavior   = MediaState.Manual;
            TwelveElement.UnloadedBehavior = MediaState.Manual;

            ThirteenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\13.mp3");
            ThirteenElement.LoadedBehavior   = MediaState.Manual;
            ThirteenElement.UnloadedBehavior = MediaState.Manual;

            FourteenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\14.mp3");
            FourteenElement.LoadedBehavior   = MediaState.Manual;
            FourteenElement.UnloadedBehavior = MediaState.Manual;

            FifteenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\15.mp3");
            FifteenElement.LoadedBehavior   = MediaState.Manual;
            FifteenElement.UnloadedBehavior = MediaState.Manual;

            SixteenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\16.mp3");
            SixteenElement.LoadedBehavior   = MediaState.Manual;
            SixteenElement.UnloadedBehavior = MediaState.Manual;

            SeventeenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\17.mp3");
            SeventeenElement.LoadedBehavior   = MediaState.Manual;
            SeventeenElement.UnloadedBehavior = MediaState.Manual;

            EighteenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\18.mp3");
            EighteenElement.LoadedBehavior   = MediaState.Manual;
            EighteenElement.UnloadedBehavior = MediaState.Manual;

            NineteenElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\19.mp3");
            NineteenElement.LoadedBehavior   = MediaState.Manual;
            NineteenElement.UnloadedBehavior = MediaState.Manual;

            CMoneElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\CM1.mp3");
            CMoneElement.LoadedBehavior   = MediaState.Manual;
            CMoneElement.UnloadedBehavior = MediaState.Manual;

            CMtwoElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\CM2.mp3");
            CMtwoElement.LoadedBehavior   = MediaState.Manual;
            CMtwoElement.UnloadedBehavior = MediaState.Manual;

            CMthreeElement.Source           = new Uri(Directory.GetCurrentDirectory() + "\\Source\\Voice\\CM3.mp3");
            CMthreeElement.LoadedBehavior   = MediaState.Manual;
            CMthreeElement.UnloadedBehavior = MediaState.Manual;
        }