public AchievementManager(IAchievementDAL achievementDAL, IAchievementProgressionDAL userAchievementDAL) { this._achievementDAL = achievementDAL; this._userAchievementDAL = userAchievementDAL; _achievementListings = new Dictionary <string, List <UserAchievement> >(); }
/// <summary> /// Instantiate an achievement object from empty struct data. /// </summary> /// <param name="userId">The user whom to match the data to.</param> /// <param name="achievement">The achievement data which to unpack.</param> internal UserAchievement(IAchievementProgressionDAL achievementProgressionDAL, string userId, AchievementEnt achievement) : this(achievementProgressionDAL, userId, achievement.id, achievement.title, achievement.description, achievement.score, achievement.goal) { this._achievementProgressionDAL.UpdateAchievementProgression(this); }
/// <summary> /// Instantiate an achievement object from struct data. /// </summary> /// <param name="achievementData">The achievement data which to unpack.</param> internal UserAchievement(IAchievementProgressionDAL achievementProgressionDAL, UserAchievementEnt achievementData) : this(achievementProgressionDAL, achievementData.userId, achievementData.achievement.id, achievementData.achievement.title, achievementData.achievement.description, achievementData.achievement.score, achievementData.achievement.goal, achievementData.counter, achievementData.isCompleted) { }
/// <summary> /// Instantiate an achievement object. /// </summary> /// <param name="userId">The user identifier whom to match this achievement with.</param> /// <param name="id">The achievement identifier.</param> /// <param name="title">The achievement title.</param> /// <param name="description">The description or flavour text of the achievement.</param> /// <param name="score">The score granted by the achievement.</param> /// <param name="goal">The goal the achievement counter has to reach to be achieved. If it's set to less than 1, the achievement will be treated as triggerable.</param> /// <param name="counter">The current progress of the achievement.</param> /// <param name="isCompleted">Whether or not the achievement has been completed.</param> private UserAchievement(IAchievementProgressionDAL achievementProgressionDAL, string userId, string id, string title, string description, int score, int goal, int counter = 0, bool isCompleted = false) { this._achievementProgressionDAL = achievementProgressionDAL; this.UserId = userId; this.Id = id; this.Title = title; this.Description = description; this.Score = score; if (goal < 1) { this.AchievementType = EAchievementType.Trigger; } else { this.Goal = goal; this.AchievementType = EAchievementType.Score; } this.Counter = counter; this.IsCompleted = isCompleted; }