/// <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 that initializes the field variables and determines if the folder for the file already exists /// </summary> public BlackJackTextSerializer() { //initializes the player to null - it is set later _player = null; //sets the file path _filePath = $"{_directoryPath}/playerinfo.dat"; //sets the directory path _directoryPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "BlackJackSaves"); //if the directory doesn't exist if (Directory.Exists(_directoryPath) == false) { //create the directory Directory.CreateDirectory(_directoryPath); } }
/// <summary> /// Constructor used to initialize the player and dealer field variables /// </summary> public BlackJackGame() : base(10) { //default player and dealer _player = new BlackJackUser("", 0, 0, 0, 0, 0); _dealer = new BlackJackDealer("Dealer Dan"); }