Пример #1
0
 /// <summary>
 /// Passes the player game to the game object
 /// </summary>
 /// <param name="player"></param>
 public void setPlayer(User player, HighScoreLogic highScores)
 {
     try
     {
         game.setPlayerName(player, highScores);
     }
     catch (Exception e)
     {
         throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                             MethodInfo.GetCurrentMethod().Name + " -> " + e.Message);
     }
 }
Пример #2
0
        /// <summary>
        /// Sets the player name for the current game
        /// </summary>
        /// <param name="player">The current user's name</param>
        public void setPlayerName(User player, HighScoreLogic highScores)
        {
            try
            {
                this.player = player;

                this.highScoresLogic = highScores;
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Пример #3
0
        /// <summary>
        /// The constructor for choosing a game
        /// </summary>
        /// <param name="player">Current player's name</param>
        public ChooseGame(User player, HighScoreLogic highScores)
        {
            try
            {
                InitializeComponent();

                this.player     = player;
                this.highScores = highScores;
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Пример #4
0
        /// <summary>
        /// Constructs the GUI passing in the player's name
        /// </summary>
        /// <param name="player">The current user's name</param>
        public UserInfo(User player, HighScoreLogic highScoreLogic)
        {
            try
            {
                InitializeComponent();

                txtUserInfoName.Text = player.Name;
                this.highScoreLogic  = highScoreLogic;
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Пример #5
0
        /// <summary>
        /// The default constructor
        /// </summary>
        public HighScores(HighScoreLogic highScores)
        {
            try
            {
                this.highScores = highScores;

                InitializeComponent();

                FillHighScores();
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Пример #6
0
        /// <summary>
        /// The constructor that takes a string for the current player's name
        /// </summary>
        /// <param name="player">The current player</param>
        public Menu(User player, HighScoreLogic highScoreLogic)
        {
            try
            {
                this.player = player;

                this.highScoreLogic = highScoreLogic;

                mainTheme = new SoundPlayer("Star Wars Main Theme.wav");
                mainTheme.Play();

                InitializeComponent();
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Пример #7
0
        /// <summary>
        /// The constructor after a game
        /// </summary>
        public HighScores(HighScoreLogic highScores, UserScore score)
        {
            try
            {
                this.highScores = highScores;

                InitializeComponent();

                FillHighScores();

                lblYourScore.Visibility = Visibility.Visible;
                lblCurrentScore.Content = score.ToString();
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }