Skip to content

Commit

Permalink
Small update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceglaa committed Dec 7, 2021
1 parent 76a922e commit 406477a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion BetterBroadcasts/BroadcastHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Exiled.Events.EventArgs;
using MEC;
using System.Collections.Generic;
using System.Linq;

internal sealed class BroadcastHandler
{
Expand All @@ -15,7 +16,9 @@ public void OnRoundStarted()
Log.Debug($"Dleay: {timedbc.Delay}, Duration: {timedbc.Duration}, Text: {timedbc.Text}", Plugin.Singleton.Config.DebugMode);
Timing.CallDelayed(timedbc.Delay, () =>
{
Map.Broadcast(timedbc.Duration, timedbc.Text);
string text = timedbc.Text;
text = Plugin.Singleton.Config.BroadcastVariables.Aggregate(text, (result, s) => result.Replace(s.Key, s.Value));
Map.Broadcast(timedbc.Duration, text);
Log.Debug($"Timed Broadcast fired: Dleay: {timedbc.Delay}, Duration: {timedbc.Duration}, Text: {timedbc.Text}", Plugin.Singleton.Config.DebugMode);
});
}
Expand All @@ -38,6 +41,7 @@ public IEnumerator<float> CallBroadcastRepetitively(float interval, ushort durat
{
for (; ; )
{
text = Plugin.Singleton.Config.BroadcastVariables.Aggregate(text, (result, s) => result.Replace(s.Key, s.Value));
Map.Broadcast(duration, text, global::Broadcast.BroadcastFlags.Normal, true);
Log.Debug($"Repeated Broadcast fired: Interval: {interval}, Duration: {duration}, Text: {text}", Plugin.Singleton.Config.DebugMode);
yield return Timing.WaitForSeconds(interval);
Expand Down
2 changes: 1 addition & 1 deletion BetterBroadcasts/BroadcastObjects/RepeatedBroadcast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
public class RepeatedBroadcast
{
public string Text { get; set; }
public float Interval { get; set; }
public ushort Duration { get; set; }
public string Text { get; set; }
}
}
8 changes: 4 additions & 4 deletions BetterBroadcasts/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ public sealed class Config : IConfig
{
new TimedBroadcast
{
Text = "Test Timed Broadcast",
Delay = 10f,
Duration = 10,
Text = "Test Timed Broadcast"
Duration = 10
}
};
public List<RepeatedBroadcast> RepeatedBroadcasts { get; private set; } = new List<RepeatedBroadcast>
{
new RepeatedBroadcast
{
Text = "Test Repeated Broadcast",
Interval = 100f,
Duration = 10,
Text = "Test Repeated Broadcast"
Duration = 10
}
};
}
Expand Down

0 comments on commit 406477a

Please sign in to comment.