Add readonly where it is missing and fix those field names according to their modifiers (#2589)
This commit is contained in:
@@ -14,8 +14,8 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
public sealed class DoAfterBar : Control
|
||||
{
|
||||
private IGameTiming _gameTiming = default!;
|
||||
|
||||
private ShaderInstance _shader;
|
||||
|
||||
private readonly ShaderInstance _shader;
|
||||
|
||||
/// <summary>
|
||||
/// Set from 0.0f to 1.0f to reflect bar progress
|
||||
@@ -40,13 +40,13 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_cancelled = value;
|
||||
if (_cancelled)
|
||||
{
|
||||
_gameTiming = IoCManager.Resolve<IGameTiming>();
|
||||
_lastFlash = _gameTiming.CurTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
_lastFlash = _gameTiming.CurTime;
|
||||
_flash = !_flash;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Draw(DrawingHandleScreen handle)
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
private Dictionary<byte, PanelContainer> _doAfterControls = new Dictionary<byte, PanelContainer>();
|
||||
private Dictionary<byte, DoAfterBar> _doAfterBars = new Dictionary<byte, DoAfterBar>();
|
||||
private readonly Dictionary<byte, PanelContainer> _doAfterControls = new Dictionary<byte, PanelContainer>();
|
||||
private readonly Dictionary<byte, DoAfterBar> _doAfterBars = new Dictionary<byte, DoAfterBar>();
|
||||
|
||||
// We'll store cancellations for a little bit just so we can flash the graphic to indicate it's cancelled
|
||||
private Dictionary<byte, TimeSpan> _cancelledDoAfters = new Dictionary<byte, TimeSpan>();
|
||||
private readonly Dictionary<byte, TimeSpan> _cancelledDoAfters = new Dictionary<byte, TimeSpan>();
|
||||
|
||||
public IEntity? AttachedEntity { get; set; }
|
||||
private ScreenCoordinates _playerPosition;
|
||||
@@ -48,12 +48,12 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
base.Dispose(disposing);
|
||||
if (Disposed)
|
||||
return;
|
||||
|
||||
|
||||
foreach (var (_, control) in _doAfterControls)
|
||||
{
|
||||
control.Dispose();
|
||||
}
|
||||
|
||||
|
||||
_doAfterControls.Clear();
|
||||
_doAfterBars.Clear();
|
||||
_cancelledDoAfters.Clear();
|
||||
@@ -109,10 +109,10 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
RemoveChild(control);
|
||||
_doAfterControls.Remove(id);
|
||||
_doAfterBars.Remove(id);
|
||||
|
||||
|
||||
if (_cancelledDoAfters.ContainsKey(id))
|
||||
_cancelledDoAfters.Remove(id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -130,7 +130,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
doAfterBar = new DoAfterBar();
|
||||
_doAfterBars[id] = doAfterBar;
|
||||
}
|
||||
|
||||
|
||||
doAfterBar.Cancelled = true;
|
||||
_cancelledDoAfters.Add(id, _gameTiming.CurTime);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
{
|
||||
base.FrameUpdate(args);
|
||||
|
||||
if (AttachedEntity?.IsValid() != true ||
|
||||
if (AttachedEntity?.IsValid() != true ||
|
||||
!AttachedEntity.TryGetComponent(out DoAfterComponent? doAfterComponent))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
|
||||
// Each component in range will have its own vBox which we need to keep track of so if they go out of range or
|
||||
// come into range it needs altering
|
||||
private HashSet<DoAfterComponent> _knownComponents = new HashSet<DoAfterComponent>();
|
||||
private readonly HashSet<DoAfterComponent> _knownComponents = new HashSet<DoAfterComponent>();
|
||||
|
||||
private IEntity? _attachedEntity;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user