Skip to content

Commit

Permalink
Merge branch 'master-ru' into 'master-ru'
Browse files Browse the repository at this point in the history
Upstream sync (Some locale fixes)

See merge request Workbench-Team/space-station-14!126
  • Loading branch information
MilenVolf committed Aug 14, 2023
2 parents 6113707 + 82eac4f commit 1b75314
Show file tree
Hide file tree
Showing 83 changed files with 5,489 additions and 5,002 deletions.
70 changes: 57 additions & 13 deletions Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,64 @@ private bool NoteClicked(AdminNotesLine line)
};

_popup.OnDeletePressed += (noteId, noteType) => NoteDeleted?.Invoke(noteId, noteType);
_popup.OnPopupHide += OnPopupHide;

var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, Vector2.One);
_popup.Open(box);

return true;
}

private void OnPopupHide()
{
if (_popup == null ||
!Inputs.TryGetValue((_popup.NoteId, _popup.NoteType), out var input))
{
return;
}

UpdateNoteLineAlpha(input);
}

private void NoteMouseEntered(GUIMouseHoverEventArgs args)
{
if (args.SourceControl is not AdminNotesLine line)
return;

line.Modulate = line.Modulate.WithAlpha(1f);
}

private void NoteMouseExited(GUIMouseHoverEventArgs args)
{
if (args.SourceControl is not AdminNotesLine line)
return;

if (_popup?.NoteId == line.Note.Id && _popup.Visible)
return;

UpdateNoteLineAlpha(line);
}

private void UpdateNoteLineAlpha(AdminNotesLine input)
{
var timeDiff = DateTime.UtcNow - input.Note.CreatedAt;
float alpha;
if (_noteFreshDays == 0 || timeDiff.TotalDays <= _noteFreshDays)
{
alpha = 1f;
}
else if (_noteStaleDays == 0 || timeDiff.TotalDays > _noteStaleDays)
{
alpha = 0f;
}
else
{
alpha = (float) (1 - Math.Clamp((timeDiff.TotalDays - _noteFreshDays) / (_noteStaleDays - _noteFreshDays), 0, 1));
}

input.Modulate = input.Modulate.WithAlpha(alpha);
}

public void SetNotes(Dictionary<(int, NoteType), SharedAdminNote> notes)
{
foreach (var (key, input) in Inputs)
Expand All @@ -119,25 +171,17 @@ public void SetNotes(Dictionary<(int, NoteType), SharedAdminNote> notes)

input = new AdminNotesLine(_sprites, note);
input.OnClicked += NoteClicked;
input.OnMouseEntered += NoteMouseEntered;
input.OnMouseExited += NoteMouseExited;

var timeDiff = DateTime.UtcNow - note.CreatedAt;
float alpha;
if (_noteFreshDays == 0 || timeDiff.TotalDays <= _noteFreshDays)
{
alpha = 1f;
}
else if (_noteStaleDays == 0 || timeDiff.TotalDays > _noteStaleDays)
UpdateNoteLineAlpha(input);

if (input.Modulate.A == 0)
{
alpha = 0f;
input.Visible = false;
showMoreButtonVisible = true;
}
else
{
alpha = (float) (1 - Math.Clamp((timeDiff.TotalDays - _noteFreshDays) / (_noteStaleDays - _noteFreshDays), 0, 1));
}

input.Modulate = input.Modulate.WithAlpha(alpha);
Notes.AddChild(input);
Inputs[(note.Id, note.NoteType)] = input;
ShowMoreButton.Visible = showMoreButtonVisible;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System.Text;
using Content.Client.Resources;
using Content.Shared.Administration.Notes;
using Content.Shared.Database;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand Down Expand Up @@ -56,7 +53,7 @@ public AdminNotesLine(SpriteSystem sprites, SharedAdminNote note)
private void Refresh()
{
string? iconPath;
if(Note.NoteSeverity is not null)
if (Note.NoteSeverity is not null && !NoteTypeIcons.ContainsKey(Note.NoteType))
SeverityIcons.TryGetValue(Note.NoteSeverity.Value, out iconPath);
else
NoteTypeIcons.TryGetValue(Note.NoteType, out iconPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public AdminNotesLinePopup(SharedAdminNote note, string playerName, bool showDel
DeleteButton.OnPressed += DeletePressed;
}

private int NoteId { get; }
private NoteType NoteType { get; }
public int NoteId { get; }
public NoteType NoteType { get; }
private TimeSpan? DeleteResetOn { get; set; }

private void EditPressed(ButtonEventArgs args)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private void UpdateSubmitButton()
return;
}

SubmitButton.Disabled = NoteSeverity == null;
SubmitButton.Disabled = (NoteType != NoteType.Watchlist && NoteType != NoteType.Message) && NoteSeverity == null;
}

private void ResetSubmitButton()
Expand Down
54 changes: 0 additions & 54 deletions Content.Client/AirlockPainter/AirlockPainterSystem.cs

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml

This file was deleted.

39 changes: 0 additions & 39 deletions Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'reagent-dispenser-bound-user-interface-title'}"
SetSize="590 450"
MinSize="590 450">
SetSize="620 450"
MinSize="620 450">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}"/>
Expand Down
53 changes: 53 additions & 0 deletions Content.Client/SprayPainter/SprayPainterSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Content.Shared.SprayPainter;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Robust.Shared.Utility;
using System.Linq;

namespace Content.Client.SprayPainter;

public sealed class SprayPainterSystem : SharedSprayPainterSystem
{
[Dependency] private readonly IResourceCache _resourceCache = default!;

public List<SprayPainterEntry> Entries { get; private set; } = new();

public override void Initialize()
{
base.Initialize();

foreach (string style in Styles)
{
string? iconPath = Groups
.FindAll(x => x.StylePaths.ContainsKey(style))?
.MaxBy(x => x.IconPriority)?.StylePaths[style];
if (iconPath == null)
{
Entries.Add(new SprayPainterEntry(style, null));
continue;
}

RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / new ResPath(iconPath));
if (!doorRsi.RSI.TryGetState("closed", out var icon))
{
Entries.Add(new SprayPainterEntry(style, null));
continue;
}

Entries.Add(new SprayPainterEntry(style, icon.Frame0));
}
}
}

public sealed class SprayPainterEntry
{
public string Name;
public Texture? Icon;

public SprayPainterEntry(string name, Texture? icon)
{
Name = name;
Icon = icon;
}
}
Loading

0 comments on commit 1b75314

Please sign in to comment.