-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
214 changed files
with
244,584 additions
and
34,077 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
SetSize="800 800" | ||
MinSize="800 64"> | ||
MinSize="800 128"> | ||
<BoxContainer Orientation="Vertical" VerticalExpand="True"> | ||
<!-- | ||
<BoxContainer Name="RoleNameBox" Orientation="Vertical" Margin="10"> | ||
<Label Name="LoadoutNameLabel" Text="{Loc 'loadout-name-edit-label'}"/> | ||
<PanelContainer HorizontalExpand="True" SetHeight="24"> | ||
<PanelContainer.PanelOverride> | ||
<graphics:StyleBoxFlat BackgroundColor="#1B1B1E" /> | ||
</PanelContainer.PanelOverride> | ||
<LineEdit Name="RoleNameEdit" ToolTip="{Loc 'loadout-name-edit-tooltip'}" VerticalExpand="True" HorizontalExpand="True"/> | ||
</PanelContainer> | ||
</BoxContainer> | ||
--> | ||
<VerticalTabContainer Name="LoadoutGroupsContainer" | ||
VerticalExpand="True" | ||
HorizontalExpand="True"> | ||
VerticalExpand="True" | ||
HorizontalExpand="True"> | ||
</VerticalTabContainer> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Content.Client/Silicons/StationAi/StationAiBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.Silicons.StationAi; | ||
|
||
public sealed class StationAiBoundUserInterface : BoundUserInterface | ||
{ | ||
private StationAiMenu? _menu; | ||
|
||
public StationAiBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
_menu = this.CreateWindow<StationAiMenu>(); | ||
_menu.Track(Owner); | ||
|
||
_menu.OnAiRadial += args => | ||
{ | ||
SendPredictedMessage(new StationAiRadialMessage() | ||
{ | ||
Event = args, | ||
}); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<ui:RadialMenu xmlns="https://spacestation14.io" | ||
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls" | ||
BackButtonStyleClass="RadialMenuBackButton" | ||
CloseButtonStyleClass="RadialMenuCloseButton" | ||
VerticalExpand="True" | ||
HorizontalExpand="True" | ||
MinSize="450 450"> | ||
|
||
<!-- Main --> | ||
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" Radius="64" ReserveSpaceForHiddenChildren="False"> | ||
</ui:RadialContainer> | ||
|
||
</ui:RadialMenu> |
128 changes: 128 additions & 0 deletions
128
Content.Client/Silicons/StationAi/StationAiMenu.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
using System.Numerics; | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Client.Silicons.StationAi; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class StationAiMenu : RadialMenu | ||
{ | ||
[Dependency] private readonly IClyde _clyde = default!; | ||
[Dependency] private readonly IEntityManager _entManager = default!; | ||
[Dependency] private readonly IEyeManager _eyeManager = default!; | ||
|
||
public event Action<BaseStationAiAction>? OnAiRadial; | ||
|
||
private EntityUid _tracked; | ||
|
||
public StationAiMenu() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void Track(EntityUid owner) | ||
{ | ||
_tracked = owner; | ||
|
||
if (!_entManager.EntityExists(_tracked)) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
BuildButtons(); | ||
UpdatePosition(); | ||
} | ||
|
||
private void BuildButtons() | ||
{ | ||
var ev = new GetStationAiRadialEvent(); | ||
_entManager.EventBus.RaiseLocalEvent(_tracked, ref ev); | ||
|
||
var main = FindControl<RadialContainer>("Main"); | ||
main.DisposeAllChildren(); | ||
var sprites = _entManager.System<SpriteSystem>(); | ||
|
||
foreach (var action in ev.Actions) | ||
{ | ||
// TODO: This radial boilerplate is quite annoying | ||
var button = new StationAiMenuButton(action.Event) | ||
{ | ||
StyleClasses = { "RadialMenuButton" }, | ||
SetSize = new Vector2(64f, 64f), | ||
ToolTip = action.Tooltip != null ? Loc.GetString(action.Tooltip) : null, | ||
}; | ||
|
||
if (action.Sprite != null) | ||
{ | ||
var texture = sprites.Frame0(action.Sprite); | ||
var scale = Vector2.One; | ||
|
||
if (texture.Width <= 32) | ||
{ | ||
scale *= 2; | ||
} | ||
|
||
var tex = new TextureRect | ||
{ | ||
VerticalAlignment = VAlignment.Center, | ||
HorizontalAlignment = HAlignment.Center, | ||
Texture = texture, | ||
TextureScale = scale, | ||
}; | ||
|
||
button.AddChild(tex); | ||
} | ||
|
||
button.OnPressed += args => | ||
{ | ||
OnAiRadial?.Invoke(action.Event); | ||
Close(); | ||
}; | ||
main.AddChild(button); | ||
} | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
UpdatePosition(); | ||
} | ||
|
||
private void UpdatePosition() | ||
{ | ||
if (!_entManager.TryGetComponent(_tracked, out TransformComponent? xform)) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
if (!xform.Coordinates.IsValid(_entManager)) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
var coords = _entManager.System<SpriteSystem>().GetSpriteScreenCoordinates((_tracked, null, xform)); | ||
|
||
if (!coords.IsValid) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
OpenScreenAt(coords.Position, _clyde); | ||
} | ||
} | ||
|
||
public sealed class StationAiMenuButton(BaseStationAiAction action) : RadialMenuTextureButton | ||
{ | ||
public BaseStationAiAction Action = action; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.