コード例 #1
0
 /// <summary>
 /// Resume the status of a specified game saved in binary format
 /// </summary>
 public void LoadGame(string ID)
 {
     string wvPath = CombinePath(Helpers.ResourcesHelper.SavesDirectory, ID);
     attGame = Helpers.SerializerHelper.Deserialize(wvPath);
 }
コード例 #2
0
        /// <summary>
        /// Create a new <see cref="Model.Game"/> and a new <see cref="Model.Player"/> and save them into a file
        /// </summary>
        /// <param name="PlayerName">Name of the <see cref="Model.Player"/></param>
        public void CreateGameAndPlayer(string PlayerName)
        {
            string wvPath = Helpers.ResourcesHelper.SavesDirectory;
            string wvID= DateTime.Now.ToString();

            wvID = wvID.Replace(' ', '-');
            wvID = wvID.Replace('/', '-');
            wvID = wvID.Replace(':', '-');
            wvID += ("_" + PlayerName);
            //Game wvGame = new Game(wvID, PlayerName);

            attGame = CreateGame(wvID, PlayerName, ITEMS_PER_ROOM);

            wvPath = System.IO.Path.Combine(wvPath, wvID);
            Helpers.SerializerHelper.Serialize(wvPath, attGame);

            //throw new NotImplementedException("Implementare qui la stampa dei QRCODE");
        }