コード例 #1
0
    private void ResetProgressButton_Click(object sender, RoutedEventArgs e)
    {
        var result = AlertBox.Show("This action will delete all heroes, along with their equipment, as well as all currencies and achievements. Are you sure?");

        if (result == MessageBoxResult.Yes)
        {
            User.Instance.LastHeroId = 0;
            User.Instance.Heroes.Clear();
            User.Instance.Gold = 0;

            User.Instance.DungeonKeys.Clear();
            UserDataHelper.SeedDungeonKeys();

            User.Instance.Ingots.Clear();
            UserDataHelper.SeedIngots();

            User.Instance.Achievements.TotalTimePlayed = default;
            User.Instance.Achievements.NumericAchievementCollection = new ObservableDictionary <NumericAchievementType, long>();
            CollectionsHelper.InitializeDictionary(User.Instance.Achievements.NumericAchievementCollection);

            UpdateSelectOrDeleteHeroButtons();
            UpdateCreateHeroButton();
        }
    }