/// <summary> /// Instantiate an achievement progression struct. /// </summary> /// <param name="userId">The user identifier of the achievement progress.</param> /// <param name="achievement">The achievement about which the progression is.</param> /// <param name="counter">The current progress of the achievement.</param> /// <param name="isCompleted">Whether or not the achievement has been completed.</param> public UserAchievementEnt(string userId, AchievementEnt achievement, int counter, bool isCompleted) { this.userId = userId; this.achievement = achievement; this.counter = counter; this.isCompleted = isCompleted; }
public void AddAchievement(AchievementEnt achievement) { List <AchievementEnt> achievementConfigJson = ReadJsonFile <List <AchievementEnt> >("achievement.config.json"); achievementConfigJson.Add(achievement); WriteJsonFile("achievement.config.json", achievementConfigJson); }
/// <summary> /// Add a new achievement to the achievement manager. This achievement will also be added to the configuration file and the achievement data. /// </summary> /// <param name="achievement">The achievement to add to the achievement system.</param> /// <param name="updateConfiguration">Set to true to also add the achievement from the configuration settings.</param> public void AddAchievement(AchievementEnt achievement, bool updateConfiguration = false) { _achievementDAL.CreateAchievement(achievement, updateConfiguration); foreach (var achievementsListing in _achievementListings) { achievementsListing.Value.Add(new UserAchievement(_userAchievementDAL, achievementsListing.Key, achievement)); } }
/// <summary> /// Create an achievement in the database. /// </summary> /// <param name="achievement">The achievement to add to the database.</param> /// <param name="updateConfiguration">Set to true if the configuration file has to be overwritten.</param> public void CreateAchievement(AchievementEnt achievement, bool updateConfig = false) { if (updateConfig) { _configurationDAL.AddAchievement(achievement); } // TODO: Save achievement in the database. throw new NotImplementedException(); }
/// <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); }
public bool CreateAchievement(AchievementEnt achievement) { _achievements.Add(achievement); return(true); }
public void CreateAchievement(AchievementEnt achievement, bool updateConfig = false) { InMemoryDatabase.GetInstance().CreateAchievement(achievement); }