Example #1
0
 public static void Initialize()
 {
     Task.Run(async() =>
     {
         SavedData = await Get();
     });
 }
Example #2
0
        public static async Task <bool> SavePlayer(Player player)
        {
            try
            {
                if (SavedData == null)
                {
                    SavedData = new SaveGameCollection {
                        Players = new List <SavedPlayer>()
                    }
                }
                ;
                SavedData.Players = SavedData.Players.Where(s => s.Name != player.Name).ToList();
                SavedData.Players.Add(new SavedPlayer(player));
                await Save();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }