Пример #1
0
 //------------- Thread ( 淡入 )-------------//
 public void TurnGameOver(pageName page)
 {
     isGameOver = true;
     if (count == 12)
     {
         isGameOver  = false;
         Global.page = page;
     }
     else if (count >= 11)
     {
         Thread.Sleep(50);
         gameOver.Action();
     }
     else if (count == 0)
     {
         Form1.NewStage(page);
         Thread.Sleep(40);
         count++;
     }
     else
     {
         Thread.Sleep(40);
         empty.Action();
         count++;
     }
 }
Пример #2
0
 //------------- MouseDown -------------//
 public void MouseDown(MouseEventArgs e, pageName page)
 {
     if (gameOver.isClick(e.X, e.Y) && isGameOver)
     {
         isGameOver = false;
         count++;
     }
 }
Пример #3
0
 public static void NewStage(pageName pageName)
 {
     if (pageName == pageName.mainPage)
     {
         MainPage = new MainpageStage();
     }
     if (pageName == pageName.turntablePage)
     {
         turntableStage = new TurnTableStage(); stage01 = null; stage02 = null; stage03 = null;
     }
     if (pageName == pageName.stage01)
     {
         stage01  = new Stage01();
         level01  = null;
         MainPage = null;
     }
     if (pageName == pageName.level01)
     {
         level01 = new Level01(); turntableStage = null;
     }
     if (pageName == pageName.stage02)
     {
         stage02  = new Stage02();
         level02  = null;
         MainPage = null;
     }
     if (pageName == pageName.level02)
     {
         level02 = new Level02(); turntableStage = null;
     }
     if (pageName == pageName.stage03)
     {
         stage03 = new Stage03();
     }
     GC.Collect();
 }
 super(dest, page, pageName, inlineGraphics);
Пример #5
0
 private void displayHelp(pageName page)
 {
     ignoreData = true;
     helpButton.Visibility = Visibility.Hidden;
     hideElements(pageComponents[curPage]);
     focusedElementBorder.Visibility = Visibility.Hidden;
     helpTimer.Start();
     helpDisplayBox.Visibility = Visibility.Visible;
     if (page == pageName.moveSelect)
     {
         helpDisplayBox.Text = "Swipe with your right hand either left or right to move the carousel\nRaise your left hand above your head to select a highlighted element\nSay 'back' to return to the previous screen.";
     }
     else if (page == pageName.videoAndPractice)
     {
         helpDisplayBox.Text = "Available voice commands are: PLAY, RESTART, STOP, PAUSE, BACK, NEXT.\n Say ANALYZE to get feedback on your pose";
     }
     else
     {
         helpDisplayBox.Text = "Control cursor with your right hand\nSwipe upward with your left hand to select a highlighted element\nTo go back swipe leftward with your left hand\nSay 'quit' to quit at any time.";
     }
 }
Пример #6
0
        private void handlePlaylistPress(Point target)
        {
            Image imageType = new Image();
            int emptySlot;
            IEnumerable<int> validSpaces;
            UIElement component = selectComponent(target);

            if (component != null)
            {
                if (component.GetType() == imageType.GetType())
                {
                    if (slots.Values.Contains((Image)component))
                    {

                        validSpaces =
                          from n in slots.Keys
                          where slots[n] == ((Image)component)
                          select n;
                        emptySlot = validSpaces.ElementAt(0);
                        slotFilled[emptySlot] = false;
                        slots[emptySlot].Source = null;

                        if (returnSlot.Keys.Contains(slots[emptySlot]))
                        {
                            returnSlot[slots[emptySlot]].Visibility = Visibility.Visible;
                            returnSlot.Remove((Image)(component));
                        }
                    }


                    else
                    {
                        emptySlot = firstEmpty();
                        if (emptySlot != -1)
                        {
                            slotFilled[emptySlot] = true;
                            noticeBox.Text = imageNames[slots[emptySlot]];
                            slots[emptySlot].Source = ((Image)component).Source;
                            playListPosition[(Image)component] = slots[emptySlot];
                            returnSlot.Add(slots[emptySlot], (Image)component);
                            component.Visibility = Visibility.Hidden;
                        }
                    }
                }
                else
                {
                  
                    for (int i = 0; i < 3; i++)
                    {
                        if (slots[i].Source != null)
                        {
                            playListVideos.Add(poseToVideo[slots[i].Source]);
                        }

                    }
                    positionInPlaylist = 0;
                    hideElements(currentCom);
                    focusedElementBorder.Visibility = Visibility.Hidden;
                    curPage = pageName.videoAndPractice;
                    currentCom = pageComponents[curPage];
                    unHideElements(currentCom);
                    moviePageLoaded(null);
 
                }
            }
            else noticeBox.Text = "No element in range";
        }
Пример #7
0
 void playListTransition(transitionCode direction=transitionCode.normal)
 {
     if (direction == transitionCode.normal)
     {
         if (positionInPlaylist == -1 || positionInPlaylist==(playListVideos.Count -1))
         {
             return;//not here doing stuff
         }
         curPage = pageName.videoAndPractice;
         currentCom = pageComponents[curPage];
         positionInPlaylist++;
         poseVideoTextBlock.Visibility = Visibility.Collapsed;
         moviePageLoaded(null);//should work?
     }
     else//going back
     {
         if (positionInPlaylist == -1 || positionInPlaylist == 0)//at first pose or doingother stuff
         {
             return;//not here doing stuff
         }
         curPage = pageName.videoAndPractice;
         currentCom = pageComponents[curPage];
         positionInPlaylist--;
         poseVideoTextBlock.Visibility = Visibility.Collapsed;
         moviePageLoaded(null);//should work?
     }
     
 }
Пример #8
0
        private void handleMainPress()
        {
            if (focusedElement != null)
            {
                if (focusedElement == helpButton)
                {
                    displayHelp(curPage);
                }
                else
                {
                    pageName next = nextPage[focusedElement];
                    List<UIElement> nextCom = pageComponents[next];
                    hideElements(currentCom);
                    curPage = next;
                    currentCom = nextCom;
                    unHideElements(currentCom);
                    focusedElementBorder.Visibility = Visibility.Hidden;
                    focusedElement = null;
                }
            }

        }
Пример #9
0
 void handleMoveSelectPress()
 {
     Image movieImage = null;
     hideElements(currentCom);
     unHideElements(videoAndPracticeCom);
     curPage = pageName.videoAndPractice;
     currentCom = videoAndPracticeCom;
     foreach (Image i in posePositions.Keys)
     {
         if (posePositions[i] == 3) movieImage = i;
     }
     moviePageLoaded(movieImage.Source);
 }
Пример #10
0
 }//rewrite this
 /*Here we will change the display to what ever is correct
  * 
  * 
  * 
  */
 void displayCorrectStuff(pageName target)
 {
     curPage = target;
     List<UIElement> components = pageComponents[target];
     foreach (UIElement e in components)
     {
         e.Visibility = Visibility.Visible;
     }
     currentCom = components;
 }
Пример #11
0
        /*This will be called when click gesture is recognized and handle control logic
         * Will call something
         * 
         * 
         */

        void transition(transitionCode code)
        {
            UIElement selected = null;
            pageName target;
            if (code == transitionCode.back)
            {
                if (curPage == pageName.videoAndPractice)
                {
                    poseVideoPlayer.Stop();
                    ignoreData = false;
                    gestureTracking = true;
                }
                target = prevPage[curPage];
                curPage = target;
                hideElements(currentCom);
                currentCom = pageComponents[curPage];
                unHideElements(currentCom);
                focusedElementBorder.Visibility = Visibility.Hidden;
                focusedElement = null;
                return;
            }
            foreach (UIElement e in currentCom)
            {
                if (((int)e.GetValue(Grid.ColumnProperty) == 1) && ((int)e.GetValue(Grid.RowProperty) == 1)) selected = e;
            }
            if (selected == null) return;//nothing selected in practice this should never happen
            target = nextPage[selected];

            if (target == pageName.main)
            {
                transitionTimer.Start();
                poseTracking = false;
                gestureTracking = false;
                return;
            }
            foreach (UIElement e in currentCom)
            {
                e.Visibility = Visibility.Hidden;
            }

            displayCorrectStuff(target);
        }//rewrite this
Пример #12
0
        //   KinectSensor _Sensor;
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //     noticeBox.Text = "Window Loaded";
            kinectSensorChooser1.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged);
            curPage = pageName.main;
            curPage = pageName.playlist;
            posePositions.Add(poseSlot1, 0);
            posePositions.Add(poseSlot2, 1);
            posePositions.Add(poseSlot3, 2);
            posePositions.Add(poseSlot4, 3);
            posePositions.Add(poseSlot5, 4);
            posePositions.Add(poseSlot6, 5);
            posePositions.Add(poseSlot7, 6);

            moveSelectBorder.Add(0, moveSlot1Border);
            moveSelectBorder.Add(1, moveSlot2Border);
            moveSelectBorder.Add(2, moveSlot3Border);
            moveSelectBorder.Add(3, focusedPoseBorder);
            moveSelectBorder.Add(4, moveSlot5Border);
            moveSelectBorder.Add(5, moveSlot6Border);
            moveSelectBorder.Add(6, moveSlot7Border);

            pageComponents.Add(pageName.main, mainCom);
            pageComponents.Add(pageName.playlist, playlistCom);
            pageComponents.Add(pageName.moveSelect, poseSelectCom);
            pageComponents.Add(pageName.videoAndPractice, videoAndPracticeCom);

            curPage = pageName.main;
            hideElements(playlistCom);
            hideElements(mainCom);
            hideElements(poseSelectCom);
            currentCom = pageComponents[curPage];
           // unHideElements(currentCom);
            helpDisplayBox.Visibility = Visibility.Visible;
            helpDisplayBox.Text = "Control cursor with your right hand\nRaise your left hand above head to select a highlighted element\nTo go back swipe leftward with your left hand\n\Control the carousel with righthand swipes\nSay 'quit' to quit at any time.\nSay 'Help' to get help";
            
          
            //            poseVideoTextBlock.Visibility = Visibility.Visible;
            //  hideElements(currentCom);
            //poseVideoPlayer.Visibility = Visibility.Visible;
            //      poseSkeletonViewer.Visibility = Visibility.Visible;
        }
Пример #13
0
 void poseSuccessTimer_Tick(object sender, EventArgs e)
 {
     poseSuccessTimer.Stop();
     //this isn't always correct
     curPage = pageName.moveSelect;
     
     hideElements(videoAndPracticeCom);
     if (positionInPlaylist == -1 || positionInPlaylist==(playListVideos.Count -1))//not using playlist or at the end of it
     {
         currentCom = pageComponents[curPage];
         poseVideoTextBlock.Text = "";
         ignoreData = false;
         gestureTracking = true;
     }
     else
     {
         curPage = pageName.videoAndPractice;
         currentCom = pageComponents[curPage];
         positionInPlaylist++;
         poseVideoTextBlock.Visibility = Visibility.Collapsed;
         moviePageLoaded(null);//should work?
     }
     unHideElements(currentCom);
 }