/// <summary> /// Event handler for the Main window being loaded /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { playfield.ClipToBounds = false; sound.Open(new Uri(".\\audio\\Welcome.wav", UriKind.RelativeOrAbsolute)); UpdatePlayfieldSize(); game = new Game(targetFramerate, NumIntraFrames, screenRect, grid); game.SetGameMode(Game.GameMode.Off); KinectStart(); Win32Timer.timeBeginPeriod(TimerResolution); var gameThread = new Thread(GameThread); gameThread.SetApartmentState(ApartmentState.STA); gameThread.Start(); sound.Play(); }
public void inputHighScore(HighScores _currHighScores, int _score, UIElement _grid, Point _currCursor, ref Game.GameMode _game) { //UnHide(allLetters); MenuButtonLocation button; //highscoreCanvas.Visibility = Visibility.Visible; draw(); Point btnBackPoint = highscoreCanvas.TranslatePoint(new Point(6, 178), _grid); Point btnDonePoint = highscoreCanvas.TranslatePoint(new Point(459, 178), _grid); //check if back or done is pushed if (_currCursor.X >= btnBackPoint.X && _currCursor.X <= (btnBackPoint.X + 135) && _currCursor.Y >= btnBackPoint.Y && _currCursor.Y <= (btnBackPoint.Y + 41) && btnBack.IsEnabled) { if (backtimer == 100) { Hide(atoe); Hide(ftoj); Hide(ktoo); Hide(ptot); Hide(utoz); btnBack.IsEnabled = false; } else { backtimer = backtimer + 1; } } else if (_currCursor.X >= btnDonePoint.X && _currCursor.X <= (btnDonePoint.X + 135) && _currCursor.Y >= btnDonePoint.Y && _currCursor.Y <= (btnDonePoint.Y + 41) && btnDone.IsEnabled) { if (donetimer == 100) { _game = Game.GameMode.Off; Hide(allLetters); } else { donetimer = donetimer + 1; } } else { backtimer = 0; donetimer = 0; } if (utoz.hiddenStatus() == "unhidden") { button = utoz.buttonPushed(_currCursor, _grid); switch (button) { case MenuButtonLocation.Left: initials = initials + "U"; buttonPushed(utoz); break; case MenuButtonLocation.LeftCenter: initials = initials + "V"; buttonPushed(utoz); break; case MenuButtonLocation.Center: initials = initials + "W"; buttonPushed(utoz); break; case MenuButtonLocation.RightCenter: initials = initials + "Y"; buttonPushed(utoz); break; case MenuButtonLocation.Right: initials = initials + "Z"; buttonPushed(utoz); break; } } else if (ptot.hiddenStatus() == "unhidden") { button = ptot.buttonPushed(_currCursor, _grid); switch (button) { case MenuButtonLocation.Left: initials = initials + "P"; buttonPushed(ptot); break; case MenuButtonLocation.LeftCenter: initials = initials + "Q"; buttonPushed(ptot); break; case MenuButtonLocation.Center: initials = initials + "R"; buttonPushed(ptot); break; case MenuButtonLocation.RightCenter: initials = initials + "S"; buttonPushed(ptot); break; case MenuButtonLocation.Right: initials = initials + "T"; buttonPushed(ptot); break; } } else if (ktoo.hiddenStatus() == "unhidden") { button = ktoo.buttonPushed(_currCursor, _grid); switch (button) { case MenuButtonLocation.Left: initials = initials + "K"; buttonPushed(ktoo); break; case MenuButtonLocation.LeftCenter: initials = initials + "L"; buttonPushed(ktoo); break; case MenuButtonLocation.Center: initials = initials + "M"; buttonPushed(ktoo); break; case MenuButtonLocation.RightCenter: initials = initials + "N"; buttonPushed(ktoo); break; case MenuButtonLocation.Right: initials = initials + "O"; buttonPushed(ktoo); break; } } else if (ftoj.hiddenStatus() == "unhidden") { button = ftoj.buttonPushed(_currCursor, _grid); switch (button) { case MenuButtonLocation.Left: initials = initials + "F"; buttonPushed(ftoj); break; case MenuButtonLocation.LeftCenter: initials = initials + "G"; buttonPushed(ftoj); break; case MenuButtonLocation.Center: initials = initials + "H"; buttonPushed(ftoj); break; case MenuButtonLocation.RightCenter: initials = initials + "I"; buttonPushed(ftoj); break; case MenuButtonLocation.Right: initials = initials + "J"; buttonPushed(ftoj); break; } } else if (atoe.hiddenStatus() == "unhidden") { button = atoe.buttonPushed(_currCursor, _grid); switch (button) { case MenuButtonLocation.Left: initials = initials + "A"; buttonPushed(atoe); break; case MenuButtonLocation.LeftCenter: initials = initials + "B"; buttonPushed(atoe); break; case MenuButtonLocation.Center: initials = initials + "C"; buttonPushed(atoe); break; case MenuButtonLocation.RightCenter: initials = initials + "D"; buttonPushed(atoe); break; case MenuButtonLocation.Right: initials = initials + "E"; buttonPushed(atoe); break; } } else if (allLetters.hiddenStatus() == "unhidden") { button = allLetters.buttonPushed(_currCursor, _grid); switch (button) { case MenuButtonLocation.Left: //atoe.unhideMenu(); allLetters.deactivateButton(); UnHide(atoe); btnBack.IsEnabled = true; break; case MenuButtonLocation.LeftCenter: //ftoj.unhideMenu(); allLetters.deactivateButton(); UnHide(ftoj); btnBack.IsEnabled = true; break; case MenuButtonLocation.Center: //ktoo.unhideMenu(); allLetters.deactivateButton(); UnHide(ktoo); btnBack.IsEnabled = true; break; case MenuButtonLocation.RightCenter: //ptot.unhideMenu(); allLetters.deactivateButton(); UnHide(ptot); btnBack.IsEnabled = true; break; case MenuButtonLocation.Right: //utoz.unhideMenu(); allLetters.deactivateButton(); UnHide(utoz); btnBack.IsEnabled = true; break; } } txtBoxinitials.Text = initials; //Exit loop when done is checked if (allLetters.hiddenStatus() == "hidden") { _currHighScores.addHighScore(_score,initials); highscoreCanvas.Visibility = Visibility.Hidden; } }