You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
597 B
31 lines
597 B
namespace Services.Immortal; |
|
|
|
public class TimingService : ITimingService { |
|
private int _timing = 1500; |
|
|
|
private event Action? OnChange; |
|
|
|
public void Subscribe(Action? action) { |
|
OnChange += action; |
|
} |
|
|
|
public void Unsubscribe(Action? action) { |
|
OnChange -= action; |
|
} |
|
|
|
public int GetTiming() { |
|
return _timing; |
|
} |
|
|
|
public void SetTiming(int timing) { |
|
if (_timing != timing) { |
|
_timing = timing; |
|
NotifyDataChanged(); |
|
} |
|
} |
|
|
|
private void NotifyDataChanged() { |
|
OnChange?.Invoke(); |
|
} |
|
|
|
} |