Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using Content.Client.Resources;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
@@ -128,7 +129,7 @@ public sealed partial class FancyTree : Control
};
Items.Add(item);
item.Icon.SetSize = (Indentation, Indentation);
item.Icon.SetSize = new Vector2(Indentation, Indentation);
item.Button.OnPressed += (_) => OnPressed(item);
if (parent == null)

View File

@@ -1,4 +1,5 @@
using Robust.Client.AutoGenerated;
using System.Numerics;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Numerics;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -76,7 +77,7 @@ public sealed class ListContainer : Control
{
ListContainerButton control = new(data[0]);
GenerateItem?.Invoke(data[0], control);
control.Measure(Vector2.Infinity);
control.Measure(Vector2Helpers.Infinity);
_itemHeight = control.DesiredSize.Y;
control.Dispose();
}
@@ -312,7 +313,7 @@ public sealed class ListContainer : Control
child.Measure(constraint);
if (child == _vScrollBar)
continue;
childSize = Vector2.ComponentMax(childSize, child.DesiredSize);
childSize = Vector2.Max(childSize, child.DesiredSize);
}
if (_itemHeight == 0 && childSize.Y != 0)

View File

@@ -1,4 +1,5 @@
using Content.Client.Viewport;
using System.Numerics;
using Content.Client.Viewport;
using Content.Shared.CCVar;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Shared.Timing;
@@ -33,6 +34,10 @@ public abstract class MapGridControl : Control
/// </summary>
public float MaxRadarRange { get; private set; } = 256f * 10f;
public Vector2 MaxRadarRangeVector => new Vector2(MaxRadarRange, MaxRadarRange);
protected Vector2 MidpointVector => new Vector2(MidPoint, MidPoint);
protected int MidPoint => SizeFull / 2;
protected int SizeFull => (int) ((UIDisplayRadius + MinimapMargin) * 2 * UIScale);
protected int ScaledMinimapRadius => (int) (UIDisplayRadius * UIScale);
@@ -43,7 +48,7 @@ public abstract class MapGridControl : Control
public MapGridControl(float minRange, float maxRange, float range)
{
IoCManager.InjectDependencies(this);
SetSize = (SizeFull, SizeFull);
SetSize = new Vector2(SizeFull, SizeFull);
RectClipContent = true;
MouseFilter = MouseFilterMode.Stop;
ActualRadarRange = WorldRange;

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface.Controls;
@@ -50,7 +51,7 @@ public sealed class MenuButton : ContainerButton
TooltipDelay = CustomTooltipDelay;
_buttonIcon = new TextureRect()
{
TextureScale = (0.5f, 0.5f),
TextureScale = new Vector2(0.5f, 0.5f),
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
VerticalExpand = true,

View File

@@ -1,4 +1,5 @@
using Content.Client.DoAfter;
using System.Numerics;
using Content.Client.DoAfter;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.Cooldown;
using Content.Client.UserInterface.Systems.Inventory.Controls;
using Robust.Client.ResourceManagement;
@@ -107,16 +108,16 @@ namespace Content.Client.UserInterface.Controls
{
IoCManager.InjectDependencies(this);
Name = "SlotButton_null";
MinSize = (DefaultButtonSize, DefaultButtonSize);
MinSize = new Vector2(DefaultButtonSize, DefaultButtonSize);
AddChild(ButtonRect = new TextureRect
{
TextureScale = (2, 2),
TextureScale = new Vector2(2, 2),
MouseFilter = MouseFilterMode.Stop
});
AddChild(HighlightRect = new TextureRect
{
Visible = false,
TextureScale = (2, 2),
TextureScale = new Vector2(2, 2),
MouseFilter = MouseFilterMode.Ignore
});
@@ -125,21 +126,21 @@ namespace Content.Client.UserInterface.Controls
AddChild(SpriteView = new SpriteView
{
Scale = (2, 2),
SetSize = (DefaultButtonSize, DefaultButtonSize),
Scale = new Vector2(2, 2),
SetSize = new Vector2(DefaultButtonSize, DefaultButtonSize),
OverrideDirection = Direction.South
});
AddChild(HoverSpriteView = new SpriteView
{
Scale = (2, 2),
SetSize = (DefaultButtonSize, DefaultButtonSize),
Scale = new Vector2(2, 2),
SetSize = new Vector2(DefaultButtonSize, DefaultButtonSize),
OverrideDirection = Direction.South
});
AddChild(StorageButton = new TextureButton
{
Scale = (0.75f, 0.75f),
Scale = new Vector2(0.75f, 0.75f),
HorizontalAlignment = HAlignment.Right,
VerticalAlignment = VAlignment.Bottom,
Visible = false,
@@ -174,7 +175,7 @@ namespace Content.Client.UserInterface.Controls
AddChild(BlockedRect = new TextureRect
{
TextureScale = (2, 2),
TextureScale = new Vector2(2, 2),
MouseFilter = MouseFilterMode.Stop,
Visible = false
});

View File

@@ -1,4 +1,5 @@
using Robust.Client.AutoGenerated;
using System.Numerics;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
@@ -62,10 +63,10 @@ namespace Content.Client.UserInterface.Controls
foreach (var child in Children)
{
child.Measure(availableSize);
size = Vector2.ComponentMax(size, child.DesiredSize);
size = Vector2.Max(size, child.DesiredSize);
}
return size + (0, padSizeTotal);
return size + new Vector2(0, padSizeTotal);
}
protected override Vector2 ArrangeOverride(Vector2 finalSize)