Esempio n. 1
0
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            //TODO Connect gesture type to appropriate action
            switch (e.GestureType)
            {
            case GestureType.Menu:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Menu");
                break;

            case GestureType.WaveRight:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Baloons +10");
                game.baloons = game.baloons + 10;
                break;

            case GestureType.WaveLeft:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Baloons -10");
                game.baloons = game.baloons - 10;
                break;

            case GestureType.JoinedHands:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Joined hands");
                game.ClearPlayField();
                game.StartGame();
                break;

            case GestureType.SwipeLeft:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Swipe left");
                break;

            case GestureType.SwipeRight:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Swipe right");
                break;

            case GestureType.ZoomIn:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Zoom in");
                break;

            case GestureType.ZoomOut:
                FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Zoom out");
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        public static void Draw(UIElementCollection children)
        {
            for (int i = 0; i < FlyingTexts.Count; i++)
            {
                FlyingText flyout = FlyingTexts[i];
                if (flyout.alpha <= 0)
                {
                    FlyingTexts.Remove(flyout);
                    i--;
                }
            }

            foreach (var flyout in FlyingTexts)
            {
                flyout.Advance();
                children.Add(flyout.label);
            }
        }
Esempio n. 3
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            this.playField.ClipToBounds = true;
            this.UpdatePlayFieldSize();
            this.game = new Game(this.points, this.Dispatcher, this.screenRect, this.playField);

            timeBeginPeriod(timerResolution);
            var myGameThread = new Thread(this.game.GameThread);

            myGameThread.SetApartmentState(ApartmentState.STA);
            myGameThread.Start();

            FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Kinect Fun!");
            BannerText.NewBanner(
                Properties.Resources.Vocabulary,
                this.bannerRect,
                true,
                Color.FromArgb(200, 255, 255, 255));
        }
Esempio n. 4
0
        private void HandleGameTimer(int param)
        {
            if (!GameIsStarted)
            {
                playField.Children.Clear();
                foreach (var player in this.players)
                {
                    player.Value.Draw(playField.Children);
                }
                BannerText.Draw(playField.Children);
                FlyingText.Draw(playField.Children);
            }
            else
            {
                CheckColisions();
            }

            this.CheckPlayers();
        }
Esempio n. 5
0
        private void SkeletonsReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    int skeletonSlot = 0;

                    if ((this.skeletonData == null) || (this.skeletonData.Length != skeletonFrame.SkeletonArrayLength))
                    {
                        this.skeletonData = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    }

                    skeletonFrame.CopySkeletonDataTo(this.skeletonData);

                    foreach (Skeleton skeleton in this.skeletonData)
                    {
                        if (SkeletonTrackingState.Tracked == skeleton.TrackingState)
                        {
                            if (!game.GameIsStarted)
                            {
                                // TODO FIXME Gesture controller should use only one skeleton!?
                                gestureController.UpdateAllGestures(skeleton);
                                // If player is detected firs time show welcome message
                                if (firstSkeletonRecognition)
                                {
                                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Welcome dude!");
                                    firstSkeletonRecognition = false;
                                }
                            }

                            UpdatePlayersSkeletons(skeletonSlot, skeleton);
                        }
                        skeletonSlot++;
                    }
                }
            }
        }