Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions Content.Client/_ADT/Hands/UI/HandPlaceholderStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._ADT.Hands.UI
{
public sealed class HandPlaceholderStatus : Control
{
public HandPlaceholderStatus()
{
RobustXamlLoader.Load(this);
}
}
}
3 changes: 3 additions & 0 deletions Content.Client/_ADT/Hands/UI/HandPlaceholderStatus.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Control xmlns="https://spacestation14.io">
<Label StyleClasses="ItemStatus" Text="{Loc 'hand-placeholder-name'}" />
</Control>
95 changes: 95 additions & 0 deletions Content.Client/_ADT/Modsuits/UI/ModSuitMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'base-mod-title'}"
Resizable="False"
MinSize="450 540"
MaxSize="450 540"
SetSize="450 540">
<TextureRect TexturePath="/Textures/ADT/Interface/Backgrounds/Modsuits/nanotrasen_background.png"
HorizontalAlignment="Center"
Name="BackTexture"
Access="Public" />
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Margin="10 10 10 10" Orientation="Horizontal" HorizontalExpand="True">
<SpriteView Name="MechView"
Margin="10 0 0 0"
VerticalAlignment="Center"
HorizontalAlignment="Right"
OverrideDirection="South"
SetSize="64 64"
MaxSize="64 64"
Scale="2 2"/>
<PanelContainer Name="ComplexityPanel"
Margin="10 0 0 0"
HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#101A2899" />
</PanelContainer.PanelOverride>
<Label Name="ModComplex"
Text="base MOD"
VerticalAlignment="Center"
Margin="4"
HorizontalExpand="True"
ModulateSelfOverride="#ffffff"/>
</PanelContainer>
<PanelContainer Name="StatePanel"
Margin="10 0 0 0"
HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#101A2899" />
</PanelContainer.PanelOverride>
<Label Name="ModState"
VerticalAlignment="Center"
Margin="4"
HorizontalExpand="True"
ModulateSelfOverride="#ffffff"/>
</PanelContainer>
</BoxContainer>
<BoxContainer VerticalExpand="True" Margin="10 0 10 10" Orientation="Vertical">
<PanelContainer Name="ScrollPanel"
VerticalExpand="True"
MinSize="0 200">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#101A2899"/>
</PanelContainer.PanelOverride>
<ScrollContainer
HScrollEnabled="False"
HorizontalExpand="True"
MinSize="400 256"
MaxSize="600 1000"
VerticalExpand="True">
<BoxContainer
Name="EquipmentControlContainer"
MinSize="100 256"
Orientation="Vertical"
VerticalExpand="True"/>
</ScrollContainer>
</PanelContainer>
</BoxContainer>

<BoxContainer Orientation="Vertical" Margin="10 0 10 10">
<Button Name="LockButton"
Text="🔓 Lock"
HorizontalExpand="True"
Margin="0 0 0 5"
StyleClasses="ButtonSquare"
Access="Public"/>

<!-- PanelContainer для имени пользователя с именем -->
<PanelContainer Name="UsernamePanel"
HorizontalExpand="True"
Margin="0">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#101A2899" />
</PanelContainer.PanelOverride>
<Label Name="ModUsername"
Text="Username;3"
VerticalAlignment="Center"
HorizontalExpand="True"
Margin="5 0"
ModulateSelfOverride="#ffffff"/>
</PanelContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
110 changes: 110 additions & 0 deletions Content.Client/_ADT/Modsuits/UI/ModSuitMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Fragments;
using Content.Shared._ADT.Modsuit.Components;
using Content.Shared._ADT.Modsuit.Events;
using Content.Shared._ADT.Modsuit.Systems;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;

namespace Content.Client._ADT.Modsuits.UI;

[GenerateTypedNameReferences]
public sealed partial class ModSuitMenu : FancyWindow
{
[Dependency] private readonly IEntityManager _ent = default!;
private readonly ModSuitSystem _modsuit = default!;
private readonly SpriteSystem spriteSystem = default!;

private List<Color> _buttonColors = new()
{ Color.FromHex("#121923ff"), Color.FromHex("#04060aFF"), Color.FromHex("#153b66"), Color.FromHex("#153b66") };

private EntityUid _mod;

public ModSuitMenu()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_modsuit = _ent.System<ModSuitSystem>();
spriteSystem = _ent.System<SpriteSystem>();
}

public event Action<EntityUid>? OnRemoveButtonPressed;
public event Action<EntityUid>? OnActivateButtonPressed;
public event Action<EntityUid>? OnDeactivateButtonPressed;

public void SetEntity(EntityUid uid)
{
MechView.SetEntity(uid);
_mod = uid;
}

public void UpdateModStats()
{
if (!_ent.TryGetComponent<ModSuitComponent>(_mod, out var modComp))
return;

_buttonColors = modComp.ButtonColors;

ModComplex.Text =
Loc.GetString("mod-module-space",
("complexity", modComp.CurrentComplexity),
("maxcomplexity", modComp.MaxComplexity)) + Environment.NewLine +
Loc.GetString("mod-energy-waste", ("energy", modComp.ModEnergyBaseUsing.ToString("0.0")));
var backpanelsStyle = new StyleBoxFlat(modComp.BackpanelsColor);
var scrollStyle = new StyleBoxFlat(modComp.ScrollColor);

UsernamePanel.PanelOverride = backpanelsStyle;
ComplexityPanel.PanelOverride = backpanelsStyle;
StatePanel.PanelOverride = backpanelsStyle;
ScrollPanel.PanelOverride = scrollStyle;
BackTexture.Texture = spriteSystem.Frame0(new SpriteSpecifier.Texture(new ResPath(modComp.BackgroundPath)));

LockButton.Text = modComp.UserName != null ? Loc.GetString("mod-lock") : Loc.GetString("mod-locked");
ModUsername.Text = modComp.UserName != null
? Loc.GetString("mod-user") + modComp.UserName
: Loc.GetString("mod-no-user");
switch (_modsuit.GetPartsToggleStatus(_mod, modComp))
{
case ModSuitAttachedStatus.NoneToggled:
ModState.ModulateSelfOverride = new Color(0.86f, 0.22f, 0.22f, 0.7f);
ModState.Text = Loc.GetString("mod-none-toggled");
break;
case ModSuitAttachedStatus.PartlyToggled:
ModState.ModulateSelfOverride = new Color(0.95f, 0.78f, 0.25f);
ModState.Text = Loc.GetString("mod-partly-toggled");
break;
case ModSuitAttachedStatus.AllToggled:
ModState.ModulateSelfOverride = new Color(0.35f, 0.84f, 0.33f);
ModState.Text = Loc.GetString("mod-all-toggled");
break;
}
}

public void UpdateModuleView(ModBoundUiState state)
{
EquipmentControlContainer.RemoveAllChildren();

foreach (var item in state.EquipmentStates)
{
var ent = _ent.GetEntity(item.Key);

if (!_ent.TryGetComponent<MetaDataComponent>(ent, out var metaData))
continue;

var uicomp = _ent.GetComponentOrNull<UIFragmentComponent>(ent);
var ui = uicomp?.Ui?.GetUIFragmentRoot();

var colors = (_buttonColors[0], _buttonColors[1], _buttonColors[2], _buttonColors[3]);
var control = new ModuleControl(ent, metaData.EntityName, item.Value, colors, ui);

control.OnRemoveButtonPressed += () => OnRemoveButtonPressed?.Invoke(ent);
control.OnActivateButtonPressed += () => OnActivateButtonPressed?.Invoke(ent);
control.OnDeactivateButtonPressed += () => OnDeactivateButtonPressed?.Invoke(ent);

EquipmentControlContainer.AddChild(control);
}
}
}
52 changes: 52 additions & 0 deletions Content.Client/_ADT/Modsuits/UI/ModSuitMenuBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Content.Shared._ADT.Modsuit.Events;
using Robust.Client.UserInterface;

namespace Content.Client._ADT.Modsuits.UI;

public sealed class ModSuitMenuBoundUserInterface : BoundUserInterface
{
private ModSuitMenu? _menu;

public ModSuitMenuBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

if (state is not ModBoundUiState msg)
return;

_menu?.UpdateModStats();
_menu?.UpdateModuleView(msg);
}

protected override void Open()
{
base.Open();

_menu = this.CreateWindow<ModSuitMenu>();
_menu.SetEntity(Owner);

_menu.OpenCentered();
_menu.UpdateModStats();

_menu.LockButton.OnPressed += _ => OnLockPressed();

_menu.OnRemoveButtonPressed +=
owner => SendPredictedMessage(new ModModuleRemoveMessage(EntMan.GetNetEntity(owner)));
_menu.OnActivateButtonPressed += owner =>
SendPredictedMessage(new ModModuleActivateMessage(EntMan.GetNetEntity(owner)));
_menu.OnDeactivateButtonPressed += owner =>
SendPredictedMessage(new ModModuleDeactivateMessage(EntMan.GetNetEntity(owner)));
}

private void OnLockPressed()
{
var msg = new ModLockMessage(EntMan.GetNetEntity(Owner));
SendPredictedMessage(msg);
_menu?.UpdateModStats();
}
}
43 changes: 43 additions & 0 deletions Content.Client/_ADT/Modsuits/UI/ModSuitRadialBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Content.Shared._ADT.Modsuit.Events;
using Robust.Client.UserInterface;

namespace Content.Client._ADT.Modsuits.UI;

public sealed class ModSuitRadialBoundUserInterface : BoundUserInterface
{
private readonly IEntityManager _entityManager;
private ModSuitRadialMenu? _menu;

public ModSuitRadialBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
_entityManager = IoCManager.Resolve<IEntityManager>();
}

protected override void Open()
{
base.Open();

_menu = this.CreateWindow<ModSuitRadialMenu>();
_menu.SetEntity(Owner);

_menu.SendToggleClothingMessageAction += SendModSuitMessage;
_menu.OpenCentered();
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

if (state is not RadialModBoundUiState)
return;

_menu?.RefreshUI();
}

private void SendModSuitMessage(EntityUid uid)
{
var message = new ToggleModSuitPartMessage(_entityManager.GetNetEntity(uid));
SendPredictedMessage(message);
}
}
13 changes: 13 additions & 0 deletions Content.Client/_ADT/Modsuits/UI/ModSuitRadialMenu.xaml
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" InitialRadius="64" ReserveSpaceForHiddenChildren="False">
</ui:RadialContainer>

</ui:RadialMenu>
Loading
Loading