Enable nullability in Content.Client (#3257)

* Enable nullability in Content.Client

* Remove #nullable enable

* Merge fixes

* Remove Debug.Assert

* Merge fixes

* Fix build

* Fix build
This commit is contained in:
DrSmugleaf
2021-03-10 14:48:29 +01:00
committed by GitHub
parent 4f9bd4e802
commit 902aa128c2
270 changed files with 1774 additions and 1550 deletions

View File

@@ -16,9 +16,9 @@ namespace Content.Client.GameObjects.Components.Power
[UsedImplicitly]
public class SolarControlConsoleBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IGameTiming _gameTiming = default;
[Dependency] private readonly IGameTiming _gameTiming = default!;
private SolarControlWindow _window;
private SolarControlWindow? _window;
private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
protected override void Open()
@@ -73,6 +73,11 @@ namespace Content.Client.GameObjects.Components.Power
{
base.UpdateState(state);
if (_window == null)
{
return;
}
SolarControlConsoleBoundInterfaceState scc = (SolarControlConsoleBoundInterfaceState) state;
_lastState = scc;
_window.NotARadar.UpdateState(scc);
@@ -88,7 +93,7 @@ namespace Content.Client.GameObjects.Components.Power
if (disposing)
{
_window.Dispose();
_window?.Dispose();
}
}
@@ -180,27 +185,27 @@ namespace Content.Client.GameObjects.Components.Power
protected override void Draw(DrawingHandleScreen handle)
{
int point = SizeFull / 2;
Color fakeAA = new Color(0.08f, 0.08f, 0.08f);
Color gridLines = new Color(0.08f, 0.08f, 0.08f);
int panelExtentCutback = 4;
int gridLinesRadial = 8;
int gridLinesEquatorial = 8;
var point = SizeFull / 2;
var fakeAA = new Color(0.08f, 0.08f, 0.08f);
var gridLines = new Color(0.08f, 0.08f, 0.08f);
var panelExtentCutback = 4;
var gridLinesRadial = 8;
var gridLinesEquatorial = 8;
// Draw base
handle.DrawCircle((point, point), RadiusCircle + 1, fakeAA);
handle.DrawCircle((point, point), RadiusCircle, Color.Black);
// Draw grid lines
for (int i = 0; i < gridLinesEquatorial; i++)
for (var i = 0; i < gridLinesEquatorial; i++)
{
handle.DrawCircle((point, point), (RadiusCircle / gridLinesEquatorial) * i, gridLines, false);
}
for (int i = 0; i < gridLinesRadial; i++)
for (var i = 0; i < gridLinesRadial; i++)
{
Angle angle = (Math.PI / gridLinesRadial) * i;
Vector2 aExtent = angle.ToVec() * RadiusCircle;
var aExtent = angle.ToVec() * RadiusCircle;
handle.DrawLine((point, point) - aExtent, (point, point) + aExtent, gridLines);
}
@@ -209,12 +214,12 @@ namespace Content.Client.GameObjects.Components.Power
Angle predictedPanelRotation = _lastState.Rotation + (_lastState.AngularVelocity * ((_gameTiming.CurTime - _lastStateTime).TotalSeconds));
Vector2 extent = predictedPanelRotation.ToVec() * rotMul * RadiusCircle;
var extent = predictedPanelRotation.ToVec() * rotMul * RadiusCircle;
Vector2 extentOrtho = (extent.Y, -extent.X);
handle.DrawLine((point, point) - extentOrtho, (point, point) + extentOrtho, Color.White);
handle.DrawLine((point, point) + (extent / panelExtentCutback), (point, point) + extent - (extent / panelExtentCutback), Color.DarkGray);
Vector2 sunExtent = _lastState.TowardsSun.ToVec() * rotMul * RadiusCircle;
var sunExtent = _lastState.TowardsSun.ToVec() * rotMul * RadiusCircle;
handle.DrawLine((point, point) + sunExtent, (point, point), Color.Yellow);
}
}