/// <summary> /// Method that saves the game's player /// </summary> /// <param name="serializer">serializer object</param> public void Save(BlackJackTextSerializer serializer) { //set the serialier's player values to be the player's values from the game serializer.Player = _player; //save the values serializer.Save(); }
/// <summary> /// Method that loads the game's player /// </summary> /// <param name="_serializer">serializer object</param> public void Load(BlackJackTextSerializer _serializer) { //set the serializer's player values to be the player from the game (should be default values) _serializer.Player = _player; //load the values _serializer.Load(); //set the values of the player to be the loaded values of the serializer's player _player = _serializer.Player; }
/// <summary> /// Constructor used to initialize field variables and load the game /// </summary> public BlackJack() { this.InitializeComponent(); _game = new BlackJackGame(); _serializer = new BlackJackTextSerializer(); LoadGame(); //initializes the timer settings _tmDealerCardTimer = new DispatcherTimer(); _tmDealerCardTimer.Interval = TimeSpan.FromMilliseconds(1500); _tmDealerCardTimer.Tick += OnDealerCardTimerTick; _uiDealerScoreBorder.Visibility = Visibility.Collapsed; //disables all of the buttons by default _btnStart.IsEnabled = false; _btnHold.IsEnabled = false; _btnHit.IsEnabled = false; _btnDouble.IsEnabled = false; _started = false; }