* Add Console, PDA news tab, and ringstone popup * Add English localization * Add mass-media console board to Advanced Entertainment resrarch * Fix misprint * Deleting unused libraries * Fix round restart problem * Fixing restart problem * Just another fix * Сode optimization * Code optimization * Convert News read tab to cartridge Convert the News read tab into a cartridge, and fix a couple of bugs * Just another fix * Some updates * More fixing!! Fix cooldown, add author label to read menu * Again, fix cooldown bug * Some minor changes * Revert "Some minor changes" This reverts commit 470c8d727629ac79994f70e56162adae8659e944. * Some minor updates * News write Ui update * Just another fix * See commit below comments * More code readability, more!
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Prototypes;
|
|
using Content.Shared.MassMedia.Systems;
|
|
|
|
namespace Content.Client.MassMedia.Ui;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class NewsWriteMenu : DefaultWindow
|
|
{
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
|
|
public event Action? ShareButtonPressed;
|
|
public event Action<int>? DeleteButtonPressed;
|
|
|
|
public NewsWriteMenu(string name)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
if (Window != null)
|
|
Window.Title = name;
|
|
|
|
Share.OnPressed += _ => ShareButtonPressed?.Invoke();
|
|
}
|
|
|
|
public void UpdateUI(NewsArticle[] articles, bool shareAvalible)
|
|
{
|
|
ArticleCardsContainer.Children.Clear();
|
|
|
|
for (int i = 0; i < articles.Length; i++)
|
|
{
|
|
var article = articles[i];
|
|
var mini = new MiniArticleCardControl(article.Name, (article.Author != null ? article.Author : Loc.GetString("news-read-ui-no-author")));
|
|
mini.ArtcileNum = i;
|
|
mini.OnDeletePressed += () => DeleteButtonPressed?.Invoke(mini.ArtcileNum);
|
|
|
|
ArticleCardsContainer.AddChild(mini);
|
|
}
|
|
|
|
Share.Disabled = !shareAvalible;
|
|
}
|
|
}
|