Example #1
0
        //Update the side panel when the user hovers over a new game
        private void Button_MouseEnter(Object sender, EventArgs e)
        {
            GameButton b = (GameButton)sender;

            SelectedTitle.FontSize       = 48;
            SelectedTitle.Text           = b.Title + "\n";
            SelectedDescription.FontSize = 30;
            SelectedDescription.Text     = b.Description;
        }
Example #2
0
        // for about and main buttons. "play is not displayed"
        private void Special_MouseClick(Object sender, RoutedEventArgs e)
        {
            this.PlayGrid.Children.Clear();
            GameButton b = (GameButton)sender;

            SelectedTitle.FontSize           = 48;
            SelectedTitle.Text               = b.Title + "\n";
            SelectedDescription.FontSize     = 30;
            SelectedDescription.TextWrapping = TextWrapping.Wrap;
            SelectedDescription.Text         = b.Description + "\n";

            HighScores.Text = "";
        }
Example #3
0
        private void Button_MouseClick(Object sender, RoutedEventArgs e)
        {
            /*	GameButton b = (GameButton)sender;
             *      String path = b.Path;
             *      GameManager.LaunchGame(path);*/
            GameButton b = (GameButton)sender;

            SelectedTitle.FontSize           = 48;
            SelectedTitle.Text               = b.Title + "\n";
            SelectedDescription.FontSize     = 30;
            SelectedDescription.TextWrapping = TextWrapping.Wrap;
            SelectedDescription.Text         = b.Description + "\n";

            toPlay = b;

            playButton            = new Button();
            playButton.Content    = "PLAY";
            playButton.Background = Brushes.Red;
            playButton.Foreground = Brushes.White;
            playButton.MaxWidth   = 200;
            playButton.MaxHeight  = 125;
            playButton.Click     += new RoutedEventHandler(Play_MouseClick);
            this.PlayGrid.Children.Add(playButton);

            //add high scores from database
            String           scoreList = "";
            ScoreAPIResponse scores    = ScoreAPI.ScoreAPI.RequestScores(b.Title, 5, 0);

            if (scores.ErrCode == 0)
            {
                int scoreCount = 1;
                foreach (Score s in scores.ScoreSet)
                {
                    scoreList += scoreCount + ": " + s.Name + s.Value; //not sure if this will format correctly
                    scoreList += "\n";
                    scoreCount++;
                }
            }
            HighScores.FontSize = 30;
            HighScores.Text     = scoreList;
        }
Example #4
0
        public MainWindow()
        {
            InitializeComponent();

            kinect = KinectSensor.GetDefault();
            kinect.Open();

            var games = GameManager.ListGames();
            Console.WriteLine(games.Count);

            SelectedTitle.FontSize = 45;
            SelectedTitle.Text = "Welcome!";
            SelectedDescription.FontSize = 30;
            SelectedDescription.Text = "Raise both hands to start. Press on a game to find out more info. Grip to scroll.";
            HighScores.Text = "";

            buttonsList = new List<GameButton>();
            numLoop = 1;

            int row = 0;
            int col = 0;

            GameButton about = new GameButton("About", "Original Group: \nField Session 1: \nField Session 2: \nIndependent Study: David Alexander, Chris Copper, Krista Horn, Jason Santilli", "");
            Image i = new Image();
            BitmapImage src = new BitmapImage();
            src.BeginInit();
            src.UriSource = new Uri("aboutPic.jpg", UriKind.Relative);
            src.CacheOption = BitmapCacheOption.OnLoad;
            src.EndInit();
            i.Source = src;
            about.Content = i;

            // add about button
            Grid.SetRow(about, row);
            Grid.SetColumn(about, col);
            about.Margin = new Thickness(10, 10, 10, 10);
           // about.Content = about.Title;
            about.Click += new RoutedEventHandler(Special_MouseClick);
            this.MainGrid.Children.Add(about);
            col++;
            buttonsList.Add(about);

            foreach (GameInfo g in games) {
               //TODO: add new column definition when moving to new column
                if (col > 1)
                {
                    col = 0;
                    row++;
                }
                
                GameButton button = new GameButton(g.Title, g.Description, g.Path);
               
                Image img = new Image();
                BitmapImage source = new BitmapImage();
                source.BeginInit();
               // src.UriSource = new Uri("GameDir\\" + g.Title + "\\pic.jpg", UriKind.Relative);
                source.UriSource = new Uri("GameDir/" + g.ImagePath, UriKind.Relative);
                source.CacheOption = BitmapCacheOption.OnLoad;
                source.EndInit();
                img.Source = source;
                button.Content = img;
                
               

               // button.MouseEnter += new MouseEventHandler(Button_MouseEnter);
				button.Click += new RoutedEventHandler(Button_MouseClick);
                // add padding
                button.Margin = new Thickness(10, 10, 10, 10);
           
                //set the buttons position in the grid
                Grid.SetRow(button, row);
                Grid.SetColumn(button, col);
                col++;
                
                //add the button
                this.MainGrid.Children.Add(button);
                buttonsList.Add(button);


            }

            callCount = buttonsList.Count;

           /*this.bodies = new Body[this.kinect.BodyFrameSource.BodyCount];
           this.reader = this.kinect.BodyFrameSource.OpenReader();*/



           reader = this.kinect.OpenMultiSourceFrameReader(FrameSourceTypes.Body);
           reader.MultiSourceFrameArrived += reader_MultiSourceFrameArrived;



            // timer with 2 minute intervals
            focusTimer = new System.Timers.Timer(120000);

            //event associated with elapsed time
            focusTimer.Elapsed += OnTimedEvent;
            focusTimer.Enabled = true;
        }
Example #5
0
		private void Button_MouseClick(Object sender, RoutedEventArgs e) {
		/*	GameButton b = (GameButton)sender;
			String path = b.Path;
			GameManager.LaunchGame(path);*/
            GameButton b = (GameButton)sender;
            SelectedTitle.FontSize = 48;
            SelectedTitle.Text = b.Title + "\n";
            SelectedDescription.FontSize = 30;
            SelectedDescription.TextWrapping = TextWrapping.Wrap;
            SelectedDescription.Text = b.Description + "\n";

            toPlay = b;

            playButton = new Button();
            playButton.Content = "PLAY";
            playButton.Background = Brushes.Red;
            playButton.Foreground = Brushes.White;
            playButton.MaxWidth = 200;
            playButton.MaxHeight = 125;
            playButton.Click += new RoutedEventHandler(Play_MouseClick);
            this.PlayGrid.Children.Add(playButton);

            //add high scores from database
            String scoreList =  ""; 
            ScoreAPIResponse scores = ScoreAPI.ScoreAPI.RequestScores(b.Title, 5, 0);
            if (scores.ErrCode == 0)
            {
                int scoreCount = 1;
                foreach (Score s in scores.ScoreSet)
                {
                    scoreList += scoreCount + ": " + s.Name + s.Value; //not sure if this will format correctly
                    scoreList += "\n";
                    scoreCount++;
                }
            }
            HighScores.FontSize = 30;
            HighScores.Text = scoreList;
            

		}
Example #6
0
        public MainWindow()
        {
            InitializeComponent();

            kinect = KinectSensor.GetDefault();
            kinect.Open();

            var games = GameManager.ListGames();

            Console.WriteLine(games.Count);

            SelectedTitle.FontSize       = 45;
            SelectedTitle.Text           = "Welcome!";
            SelectedDescription.FontSize = 30;
            SelectedDescription.Text     = "Raise both hands to start. Press on a game to find out more info. Grip to scroll.";
            HighScores.Text = "";

            buttonsList = new List <GameButton>();
            numLoop     = 1;

            int row = 0;
            int col = 0;

            GameButton  about = new GameButton("About", "Original Group: \nField Session 1: \nField Session 2: \nIndependent Study: David Alexander, Chris Copper, Krista Horn, Jason Santilli", "");
            Image       i     = new Image();
            BitmapImage src   = new BitmapImage();

            src.BeginInit();
            src.UriSource   = new Uri("aboutPic.jpg", UriKind.Relative);
            src.CacheOption = BitmapCacheOption.OnLoad;
            src.EndInit();
            i.Source      = src;
            about.Content = i;

            // add about button
            Grid.SetRow(about, row);
            Grid.SetColumn(about, col);
            about.Margin = new Thickness(10, 10, 10, 10);
            // about.Content = about.Title;
            about.Click += new RoutedEventHandler(Special_MouseClick);
            this.MainGrid.Children.Add(about);
            col++;
            buttonsList.Add(about);

            foreach (GameInfo g in games)
            {
                //TODO: add new column definition when moving to new column
                if (col > 1)
                {
                    col = 0;
                    row++;
                }

                GameButton button = new GameButton(g.Title, g.Description, g.Path);

                Image       img    = new Image();
                BitmapImage source = new BitmapImage();
                source.BeginInit();
                // src.UriSource = new Uri("GameDir\\" + g.Title + "\\pic.jpg", UriKind.Relative);
                source.UriSource   = new Uri("GameDir/" + g.ImagePath, UriKind.Relative);
                source.CacheOption = BitmapCacheOption.OnLoad;
                source.EndInit();
                img.Source     = source;
                button.Content = img;



                // button.MouseEnter += new MouseEventHandler(Button_MouseEnter);
                button.Click += new RoutedEventHandler(Button_MouseClick);
                // add padding
                button.Margin = new Thickness(10, 10, 10, 10);

                //set the buttons position in the grid
                Grid.SetRow(button, row);
                Grid.SetColumn(button, col);
                col++;

                //add the button
                this.MainGrid.Children.Add(button);
                buttonsList.Add(button);
            }

            callCount = buttonsList.Count;

            /*this.bodies = new Body[this.kinect.BodyFrameSource.BodyCount];
             * this.reader = this.kinect.BodyFrameSource.OpenReader();*/



            reader = this.kinect.OpenMultiSourceFrameReader(FrameSourceTypes.Body);
            reader.MultiSourceFrameArrived += reader_MultiSourceFrameArrived;



            // timer with 2 minute intervals
            focusTimer = new System.Timers.Timer(120000);

            //event associated with elapsed time
            focusTimer.Elapsed += OnTimedEvent;
            focusTimer.Enabled  = true;
        }