public void AddRule(ISnoPower snoPower, string fileName) { var soundPlayer = Hud.Sound.LoadSoundPlayer(fileName); if (soundPlayer == null) { return; } var rule = new CoolDownRule(snoPower, soundPlayer); CoolDownRules.Add(snoPower, rule); }
public void OnCooldown(IPlayerSkill playerSkill, bool expired) { if (!expired) { return; } if (playerSkill.Player != Hud.Game.Me) { return; } if (EnableOnlyWhenIngameSoundIsEnabled && !Hud.Game.IsIngameSoundEnabled) { return; } CoolDownRule rule = null; if (!CoolDownRules.TryGetValue(playerSkill.CurrentSnoPower, out rule)) { return; } if (rule == null) { return; } ThreadPool.QueueUserWorkItem(state => { try { rule.SoundPlayer.PlaySync(); } catch (Exception) { } }); }