mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
Enhanced APC UI + New NT logo to footer (#14258)
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Content.Client.Power.APC
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_menu = new ApcMenu(this);
|
||||
_menu = new ApcMenu(this,Owner);
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
|
||||
@@ -1,28 +1,59 @@
|
||||
<DefaultWindow xmlns="https://spacestation14.io"
|
||||
Name="APCMenu"
|
||||
Title="{Loc 'apc-menu-title'}"
|
||||
Resizable="False">
|
||||
<BoxContainer Orientation="Vertical"
|
||||
SeparationOverride="4">
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="{Loc 'apc-menu-breaker-label'}"/>
|
||||
<Button Name="BreakerButton" Text="{Loc 'apc-menu-breaker-button'}"></Button>
|
||||
</BoxContainer>
|
||||
<Label Name="PowerLabel"/>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="{Loc 'apc-menu-external-label'}"/>
|
||||
<Label Name="ExternalPowerStateLabel" Text="{Loc 'apc-menu-power-state-good'}"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="{Loc 'apc-menu-charge-label'}"/>
|
||||
<controls:FancyWindow xmlns="https://spacestation14.io"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
xmlns:style="clr-namespace:Content.Client.Stylesheets"
|
||||
Name="APCMenu"
|
||||
Title="{Loc 'apc-menu-title'}"
|
||||
Resizable="False">
|
||||
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<BoxContainer Margin="0 5 10 10" Orientation="Vertical">
|
||||
<BoxContainer Margin="0" Orientation="Horizontal">
|
||||
<!-- Sprite View -->
|
||||
<PanelContainer Margin="0" StyleClasses="Inset" VerticalAlignment="Center">
|
||||
<SpriteView Name="EntityView" Scale="2 2" SetSize="64 64" OverrideDirection="South" />
|
||||
</PanelContainer>
|
||||
<!-- Data -->
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<GridContainer Margin="10 0 0 0" Columns="2">
|
||||
<!-- Power On/Off -->
|
||||
<Label Text="{Loc 'apc-menu-breaker-label'}" HorizontalExpand="True"
|
||||
StyleClasses="StatusFieldTitle" MinWidth="120"/>
|
||||
<BoxContainer Orientation="Horizontal" MinWidth="90">
|
||||
<Button Name="BreakerButton" Text="{Loc 'apc-menu-breaker-button'}" HorizontalExpand="True"/>
|
||||
</BoxContainer>
|
||||
<!--Charging Status-->
|
||||
<Label Text="{Loc 'apc-menu-external-label'}" StyleClasses="StatusFieldTitle" MinWidth="120" />
|
||||
<Label Name="ExternalPowerStateLabel" Text="{Loc 'apc-menu-power-state-good'}" />
|
||||
<!--Battery Power-->
|
||||
<Label Text="{Loc 'apc-menu-power-label'}" StyleClasses="StatusFieldTitle" MinWidth="120" />
|
||||
<Label Name="PowerLabel"/>
|
||||
</GridContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<!-- Charge Progress Bar-->
|
||||
<ProgressBar Name="ChargeBar"
|
||||
HorizontalExpand="True"
|
||||
MinValue="0"
|
||||
MaxValue="1"
|
||||
Page="0"
|
||||
Value="0.5">
|
||||
HorizontalExpand="True"
|
||||
MinValue="0"
|
||||
MaxValue="1"
|
||||
MinHeight = "25"
|
||||
Page="0"
|
||||
Margin="10 10 0 0"
|
||||
Value="0.5">
|
||||
<Label Name="ChargePercentage" Margin="4 0" Text="0 %" />
|
||||
</ProgressBar>
|
||||
<Label Name="ChargePercentage"/>
|
||||
</BoxContainer>
|
||||
|
||||
<!-- Footer -->
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<PanelContainer StyleClasses="LowDivider" />
|
||||
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom">
|
||||
<Label Text="{Loc 'apc-menu-flavor-left'}" StyleClasses="WindowFooterText" />
|
||||
<Label Text="{Loc 'apc-menu-flavor-right'}" StyleClasses="WindowFooterText"
|
||||
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" />
|
||||
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</DefaultWindow>
|
||||
</controls:FancyWindow>
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using System;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.APC;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using FancyWindow = Content.Client.UserInterface.Controls.FancyWindow;
|
||||
|
||||
namespace Content.Client.Power.APC.UI
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class ApcMenu : DefaultWindow
|
||||
public sealed partial class ApcMenu : FancyWindow
|
||||
{
|
||||
public ApcMenu(ApcBoundUserInterface owner)
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
public ApcMenu(ApcBoundUserInterface owner, ClientUserInterfaceComponent component)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
EntityView.Sprite = _entityManager.GetComponent<SpriteComponent>(component.Owner);
|
||||
BreakerButton.OnPressed += _ => owner.BreakerPressed();
|
||||
}
|
||||
|
||||
@@ -29,12 +33,22 @@ namespace Content.Client.Power.APC.UI
|
||||
|
||||
if (BreakerButton != null)
|
||||
{
|
||||
BreakerButton.Pressed = castState.MainBreaker;
|
||||
if(castState.HasAccess == false)
|
||||
{
|
||||
BreakerButton.Disabled = true;
|
||||
BreakerButton.ToolTip = Loc.GetString("apc-component-insufficient-access");
|
||||
}
|
||||
else
|
||||
{
|
||||
BreakerButton.Disabled = false;
|
||||
BreakerButton.ToolTip = null;
|
||||
BreakerButton.Pressed = castState.MainBreaker;
|
||||
}
|
||||
}
|
||||
|
||||
if (PowerLabel != null)
|
||||
{
|
||||
PowerLabel.Text = Loc.GetString("apc-menu-power-label", ("power", castState.Power));
|
||||
PowerLabel.Text = castState.Power + "W";
|
||||
}
|
||||
|
||||
if (ExternalPowerStateLabel != null)
|
||||
@@ -62,12 +76,8 @@ namespace Content.Client.Power.APC.UI
|
||||
{
|
||||
ChargeBar.Value = castState.Charge;
|
||||
UpdateChargeBarColor(castState.Charge);
|
||||
|
||||
if (APCMenu != null)
|
||||
{
|
||||
var chargePercentage = (castState.Charge / ChargeBar.MaxValue) * 100.0f;
|
||||
ChargePercentage.Text = " " + chargePercentage.ToString("0.00") + "%";
|
||||
}
|
||||
var chargePercentage = (castState.Charge / ChargeBar.MaxValue);
|
||||
ChargePercentage.Text = Loc.GetString("apc-menu-charge-label",("percent", chargePercentage.ToString("P0")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user