Removes linter warnings from the PDA module (#17097)

This commit is contained in:
TemporalOroboros
2023-06-07 07:22:19 -07:00
committed by GitHub
parent f96a3a4b79
commit fdbf5b86f2
12 changed files with 150 additions and 107 deletions

View File

@@ -37,11 +37,11 @@ namespace Content.Client.PDA
ViewContainer.OnChildAdded += control => control.Visible = false;
HomeButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/home.png"));
FlashLightToggleButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/light.png"));
EjectPenButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/pencil.png"));
EjectIdButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/eject.png"));
ProgramCloseButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/Nano/cross.svg.png"));
HomeButton.IconTexture = new SpriteSpecifier.Texture(new("/Textures/Interface/home.png"));
FlashLightToggleButton.IconTexture = new SpriteSpecifier.Texture(new("/Textures/Interface/light.png"));
EjectPenButton.IconTexture = new SpriteSpecifier.Texture(new("/Textures/Interface/pencil.png"));
EjectIdButton.IconTexture = new SpriteSpecifier.Texture(new("/Textures/Interface/eject.png"));
ProgramCloseButton.IconTexture = new SpriteSpecifier.Texture(new("/Textures/Interface/Nano/cross.svg.png"));
HomeButton.OnPressed += _ => ToHomeScreen();
@@ -102,8 +102,8 @@ namespace Content.Client.PDA
if (state.PDAOwnerInfo.IdOwner != null || state.PDAOwnerInfo.JobTitle != null)
{
IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui",
("owner",state.PDAOwnerInfo.IdOwner ?? Loc.GetString("comp-pda-ui-unknown")),
("jobTitle",state.PDAOwnerInfo.JobTitle ?? Loc.GetString("comp-pda-ui-unassigned"))));
("owner", state.PDAOwnerInfo.IdOwner ?? Loc.GetString("comp-pda-ui-unknown")),
("jobTitle", state.PDAOwnerInfo.JobTitle ?? Loc.GetString("comp-pda-ui-unassigned"))));
}
else
{
@@ -111,7 +111,7 @@ namespace Content.Client.PDA
}
StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station",
("station",state.StationName ?? Loc.GetString("comp-pda-ui-unknown"))));
("station", state.StationName ?? Loc.GetString("comp-pda-ui-unknown"))));
var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
@@ -263,7 +263,7 @@ namespace Content.Client.PDA
_currentView = view;
}
private BoxContainer CreateProgramListRow()
private static BoxContainer CreateProgramListRow()
{
return new BoxContainer()
{

View File

@@ -1,9 +1,7 @@
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
namespace Content.Client.PDA;

View File

@@ -42,7 +42,7 @@ public sealed partial class PDASettingsButton : ContainerButton
{
get => OptionName.FontColorOverride;
set
set
{
OptionName.FontColorOverride = value;
OptionDescription.FontColorOverride = value;

View File

@@ -18,10 +18,10 @@ public sealed class PDASystem : SharedPDASystem
if (args.Sprite == null)
return;
if (_appearance.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
if (Appearance.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
args.Sprite.LayerSetVisible(PDAVisualLayers.Flashlight, isFlashlightOn);
if (_appearance.TryGetData<bool>(uid, PDAVisuals.IDCardInserted, out var isCardInserted, args.Component))
if (Appearance.TryGetData<bool>(uid, PDAVisuals.IDCardInserted, out var isCardInserted, args.Component))
args.Sprite.LayerSetVisible(PDAVisualLayers.IDLight, isCardInserted);
}
@@ -29,7 +29,7 @@ public sealed class PDASystem : SharedPDASystem
{
base.OnComponentInit(uid, component, args);
if(!TryComp<SpriteComponent>(uid, out var sprite))
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
if (component.State != null)
@@ -38,11 +38,11 @@ public sealed class PDASystem : SharedPDASystem
sprite.LayerSetVisible(PDAVisualLayers.Flashlight, component.FlashlightOn);
sprite.LayerSetVisible(PDAVisualLayers.IDLight, component.IdSlot.StartingItem != null);
}
}
enum PDAVisualLayers : byte
{
Base,
Flashlight,
IDLight
public enum PDAVisualLayers : byte
{
Base,
Flashlight,
IDLight
}
}

View File

@@ -22,7 +22,7 @@ public partial class PDAWindow : BaseWindow
set
{
AccentH.ModulateSelfOverride = Color. FromHex(value, Color.White);
AccentH.ModulateSelfOverride = Color.FromHex(value, Color.White);
AccentH.Visible = value != null;
}
}
@@ -33,7 +33,7 @@ public partial class PDAWindow : BaseWindow
set
{
AccentV.ModulateSelfOverride = Color. FromHex(value, Color.White);
AccentV.ModulateSelfOverride = Color.FromHex(value, Color.White);
AccentV.Visible = value != null;
}
}

View File

@@ -18,20 +18,38 @@ namespace Content.Client.PDA.Ringer
RingerNoteInputs = new[] { RingerNoteOneInput, RingerNoteTwoInput, RingerNoteThreeInput, RingerNoteFourInput };
for (int i = 0; i < RingerNoteInputs.Length; i++)
for (var i = 0; i < RingerNoteInputs.Length; ++i)
{
var input = RingerNoteInputs[i];
int index = i;
input.OnTextChanged += _ => //Prevents unauthorized characters from being entered into the LineEdit
var index = i;
var foo = () => // Prevents unauthorized characters from being entered into the LineEdit
{
input.Text = input.Text.ToUpper();
if (!IsNote(input.Text))
{
input.Text = PreviousNoteInputs[index];
}
else
PreviousNoteInputs[index] = input.Text;
input.CursorPosition = input.Text.Length; //Resets caret position to the end of the typed input
input.RemoveStyleClass("Caution");
};
input.OnFocusExit += _ => foo();
input.OnTextEntered += _ =>
{
foo();
input.CursorPosition = input.Text.Length; // Resets caret position to the end of the typed input
};
input.OnTextChanged += _ =>
{
input.Text = input.Text.ToUpper();
if (!IsNote(input.Text))
input.AddStyleClass("Caution");
else
input.RemoveStyleClass("Caution");
};
}
}