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)

View File

@@ -1,4 +1,5 @@
using Content.Client.UserInterface.Systems.Chat.Widgets;
using System.Numerics;
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using Content.Client.Actions;
using Content.Client.Construction;
@@ -71,10 +72,10 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
_menuDragHelper = new DragDropHelper<ActionButton>(OnMenuBeginDrag, OnMenuContinueDrag, OnMenuEndDrag);
_dragShadow = new TextureRect
{
MinSize = (64, 64),
MinSize = new Vector2(64, 64),
Stretch = StretchMode.Scale,
Visible = false,
SetSize = (64, 64),
SetSize = new Vector2(64, 64),
MouseFilter = MouseFilterMode.Ignore
};
@@ -738,13 +739,13 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
}
}
LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - (32, 32));
LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - new Vector2(32, 32));
return true;
}
private bool OnMenuContinueDrag(float frameTime)
{
LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - (32, 32));
LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - new Vector2(32, 32));
_dragShadow.Visible = true;
return true;
}

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.Actions.UI;
using Content.Client.Cooldown;
using Content.Client.Stylesheets;
@@ -65,7 +66,7 @@ public sealed class ActionButton : Control
HighlightRect = new PanelContainer
{
StyleClasses = {StyleNano.StyleClassHandSlotHighlight},
MinSize = (32, 32),
MinSize = new Vector2(32, 32),
Visible = false
};
_bigActionIcon = new TextureRect
@@ -94,8 +95,8 @@ public sealed class ActionButton : Control
Name = "Big Sprite",
HorizontalExpand = true,
VerticalExpand = true,
Scale = (2, 2),
SetSize = (64, 64),
Scale = new Vector2(2, 2),
SetSize = new Vector2(64, 64),
Visible = false,
OverrideDirection = Direction.South,
};
@@ -113,11 +114,11 @@ public sealed class ActionButton : Control
Orientation = LayoutOrientation.Horizontal,
HorizontalExpand = true,
VerticalExpand = true,
MinSize = (64, 64)
MinSize = new Vector2(64, 64)
};
paddingBoxItemIcon.AddChild(new Control()
{
MinSize = (32, 32),
MinSize = new Vector2(32, 32),
});
paddingBoxItemIcon.AddChild(new Control
{

View File

@@ -1,4 +1,5 @@
using Content.Client.Actions.UI;
using System.Numerics;
using Content.Client.Actions.UI;
using Content.Client.Cooldown;
using Content.Shared.Alert;
using Robust.Client.UserInterface;
@@ -54,7 +55,7 @@ namespace Content.Client.UserInterface.Systems.Alerts.Controls
var specifier = alert.GetIcon(_severity);
_icon = new AnimatedTextureRect
{
DisplayRect = {TextureScale = (2, 2)}
DisplayRect = {TextureScale = new Vector2(2, 2)}
};
_icon.SetFromSpriteSpecifier(specifier);

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.Message;
using Content.Client.Resources;
using Content.Client.Stylesheets;
@@ -75,7 +76,7 @@ namespace Content.Client.UserInterface.Systems.Atmos.GasTank
{
Orientation = LayoutOrientation.Vertical
}),
new Control {MinSize = (0, 110)}
new Control {MinSize = new Vector2(0, 110)}
}
};
@@ -125,13 +126,13 @@ namespace Content.Client.UserInterface.Systems.Atmos.GasTank
_topContainer.AddChild(topRow);
_topContainer.AddChild(new PanelContainer
{
MinSize = (0, 2),
MinSize = new Vector2(0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
_topContainer.AddChild(middle);
_topContainer.AddChild(new PanelContainer
{
MinSize = (0, 2),
MinSize = new Vector2(0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
@@ -141,7 +142,7 @@ namespace Content.Client.UserInterface.Systems.Atmos.GasTank
//internals
_lblInternals = new RichTextLabel
{MinSize = (200, 0), VerticalAlignment = VAlignment.Center};
{MinSize = new Vector2(200, 0), VerticalAlignment = VAlignment.Center};
_btnInternals = new Button {Text = Loc.GetString("gas-tank-window-internals-toggle-button") };
_contentContainer.AddChild(

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Content.Client.Administration.Managers;
using Content.Client.Administration.Systems;
using Content.Client.Administration.UI.Bwoink;
@@ -465,7 +466,7 @@ public sealed class UserAHelpUIHandler : IAHelpUIHandler
TitleClass="windowTitleAlert",
HeaderClass="windowHeaderAlert",
Title=Loc.GetString("bwoink-user-title"),
MinSize=(500, 200),
MinSize = new Vector2(500, 200),
};
_window.OnClose += () => { OnClose?.Invoke(); };
_window.OnOpen += () => { OnOpen?.Invoke(); };

View File

@@ -1,5 +1,6 @@
using System.Globalization;
using System.Linq;
using System.Numerics;
using Content.Client.Administration.Managers;
using Content.Client.Chat;
using Content.Client.Chat.Managers;

View File

@@ -1,4 +1,5 @@
using Content.Client.Resources;
using System.Numerics;
using Content.Client.Resources;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -55,8 +56,8 @@ public sealed class ChannelFilterButton : ContainerButton
{
var globalPos = GlobalPosition;
var (minX, minY) = ChatFilterPopup.MinSize;
var box = UIBox2.FromDimensions(globalPos - (FilterDropdownOffset, 0),
(Math.Max(minX, ChatFilterPopup.MinWidth), minY));
var box = UIBox2.FromDimensions(globalPos - new Vector2(FilterDropdownOffset, 0),
new Vector2(Math.Max(minX, ChatFilterPopup.MinWidth), minY));
ChatFilterPopup.Open(box);
}
else

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Shared.Chat;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -97,7 +98,7 @@ public sealed class ChannelSelectorButton : Button
{
var globalLeft = GlobalPosition.X;
var globalBot = GlobalPosition.Y + Height;
var box = UIBox2.FromDimensions((globalLeft, globalBot), (SizeBox.Width, SelectorDropdownOffset));
var box = UIBox2.FromDimensions(new Vector2(globalLeft, globalBot), new Vector2(SizeBox.Width, SelectorDropdownOffset));
_channelSelectorPopup.Open(box);
}
else

View File

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

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Numerics;
using Content.Shared.Ghost;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
@@ -54,7 +55,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
MinSize = (340, 20),
MinSize = new Vector2(340, 20),
ClipText = true,
};

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;
using static Robust.Client.UserInterface.Controls.BaseButton;
@@ -14,14 +15,14 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
{
RobustXamlLoader.Load(this);
MakeSentientLabel.MinSize = (150, 0);
RoleEntityLabel.MinSize = (150, 0);
RoleNameLabel.MinSize = (150, 0);
RoleName.MinSize = (300, 0);
RoleDescriptionLabel.MinSize = (150, 0);
RoleDescription.MinSize = (300, 0);
RoleRulesLabel.MinSize = (150, 0);
RoleRules.MinSize = (300, 0);
MakeSentientLabel.MinSize = new Vector2(150, 0);
RoleEntityLabel.MinSize = new Vector2(150, 0);
RoleNameLabel.MinSize = new Vector2(150, 0);
RoleName.MinSize = new Vector2(300, 0);
RoleDescriptionLabel.MinSize = new Vector2(150, 0);
RoleDescription.MinSize = new Vector2(300, 0);
RoleRulesLabel.MinSize = new Vector2(150, 0);
RoleRules.MinSize = new Vector2(300, 0);
MakeButton.OnPressed += OnPressed;
}

View File

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