2020-11-27 17:12:45 +01:00
|
|
|
using Content.Shared;
|
2021-06-13 14:52:40 +02:00
|
|
|
using Content.Shared.CCVar;
|
2020-05-29 22:50:41 +02:00
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.Configuration;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-05-29 22:50:41 +02:00
|
|
|
using Robust.Shared.IoC;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.Timing;
|
2020-05-18 13:29:31 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Instruments
|
2020-05-18 13:29:31 +02:00
|
|
|
{
|
2020-05-29 22:50:41 +02:00
|
|
|
[UsedImplicitly]
|
2020-05-18 13:29:31 +02:00
|
|
|
public class InstrumentSystem : EntitySystem
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
2020-11-27 17:12:45 +01:00
|
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
_cfg.OnValueChanged(CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged, true);
|
|
|
|
|
_cfg.OnValueChanged(CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int MaxMidiEventsPerBatch { get; private set; }
|
|
|
|
|
public int MaxMidiEventsPerSecond { get; private set; }
|
|
|
|
|
|
|
|
|
|
private void OnMaxMidiEventsPerSecondChanged(int obj)
|
|
|
|
|
{
|
|
|
|
|
MaxMidiEventsPerSecond = obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMaxMidiEventsPerBatchChanged(int obj)
|
|
|
|
|
{
|
|
|
|
|
MaxMidiEventsPerBatch = obj;
|
|
|
|
|
}
|
2020-05-29 22:50:41 +02:00
|
|
|
|
2020-05-18 13:29:31 +02:00
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
base.Update(frameTime);
|
|
|
|
|
|
2020-05-29 22:50:41 +02:00
|
|
|
if (!_gameTiming.IsFirstTimePredicted)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 13:35:29 +02:00
|
|
|
foreach (var instrumentComponent in EntityManager.EntityQuery<InstrumentComponent>(true))
|
2020-05-18 13:29:31 +02:00
|
|
|
{
|
2020-08-16 05:38:35 +02:00
|
|
|
instrumentComponent.Update(frameTime);
|
2020-05-18 13:29:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|