/// <summary> /// Applies the effect to the user's <see cref="GameInfo"/>, and <see cref="EffectsQueue"/> /// </summary> /// <param name="user"></param> /// <param name="effect"></param> /// <param name="shouldPost">If true, then evenything will be posted to the datastore</param> /// <returns></returns> static async Task AddNewEffect(string userId, GameInfoEffectBase effect, bool shouldPost = false) { GameInfo gameInfo = await GetGameInfo(userId); gameInfo += effect; if (shouldPost) { await Program.DataStore.PostGameInfo(userId, gameInfo); } EffectsQueue effectsQueue = await GetEffectQueue(userId); effectsQueue.AddEffect(effect); if (shouldPost) { await effectsQueue.PostEffects(); } }
public void AddEffect(GameInfoEffectBase effect) { effects.Enqueue(effect); }