2020-05-20 17:13:49 +02:00
|
|
|
using Content.Client.GameObjects.Components.Instruments;
|
2020-11-27 17:12:45 +01:00
|
|
|
using Content.Shared;
|
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
|
|
|
|
2020-05-20 17:13:49 +02:00
|
|
|
namespace Content.Client.GameObjects.EntitySystems
|
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-02-04 00:20:48 +11:00
|
|
|
foreach (var instrumentComponent in EntityManager.ComponentManager.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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|