forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'upstream' into 'arumoon-server'
Upstream (DB update) See merge request Workbench-Team/space-station-14!94
- Loading branch information
Showing
539 changed files
with
26,811 additions
and
19,315 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Content.Client.UserInterface.Fragments; | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Content.Shared.CartridgeLoader; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.CartridgeLoader.Cartridges; | ||
|
||
public sealed class NewsReadUi : UIFragment | ||
{ | ||
private NewsReadUiFragment? _fragment; | ||
|
||
public override Control GetUIFragmentRoot() | ||
{ | ||
return _fragment!; | ||
} | ||
|
||
public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner) | ||
{ | ||
_fragment = new NewsReadUiFragment(); | ||
|
||
_fragment.OnNextButtonPressed += () => | ||
{ | ||
SendNewsReadMessage(NewsReadUiAction.Next, userInterface); | ||
}; | ||
_fragment.OnPrevButtonPressed += () => | ||
{ | ||
SendNewsReadMessage(NewsReadUiAction.Prev, userInterface); | ||
}; | ||
_fragment.OnNotificationSwithPressed += () => | ||
{ | ||
SendNewsReadMessage(NewsReadUiAction.NotificationSwith, userInterface); | ||
}; | ||
} | ||
|
||
public override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
if (state is NewsReadBoundUserInterfaceState cast) | ||
_fragment?.UpdateState(cast.Article, cast.TargetNum, cast.TotalNum, cast.NotificationOn); | ||
else if (state is NewsReadEmptyBoundUserInterfaceState empty) | ||
_fragment?.UpdateEmptyState(empty.NotificationOn); | ||
} | ||
|
||
private void SendNewsReadMessage(NewsReadUiAction action, BoundUserInterface userInterface) | ||
{ | ||
var newsMessage = new NewsReadUiMessageEvent(action); | ||
var message = new CartridgeUiMessage(newsMessage); | ||
userInterface.SendMessage(message); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Content.Client/CartridgeLoader/Cartridges/NewsReadUiFragment.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<cartridges:NewsReadUiFragment xmlns:cartridges="clr-namespace:Content.Client.CartridgeLoader.Cartridges" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
xmlns="https://spacestation14.io" Margin="1 0 2 0"> | ||
<PanelContainer StyleClasses="BackgroundDark"></PanelContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="5,5,5,5"> | ||
<Button | ||
Name="Prev" | ||
MinWidth="64" | ||
HorizontalAlignment="Left" | ||
Text="{Loc 'news-read-ui-past-text'}" | ||
Access="Public" | ||
HorizontalExpand="True"/> | ||
<Button | ||
Name="Next" | ||
MinWidth="64" | ||
HorizontalAlignment="Right" | ||
Text="{Loc 'news-read-ui-next-text'}" /> | ||
</BoxContainer> | ||
<controls:StripeBack Name="АrticleNameContainer"> | ||
<PanelContainer> | ||
<Label Name="PageNum" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,0,0"/> | ||
<Label Name="PageName" Align="Center"/> | ||
</PanelContainer> | ||
</controls:StripeBack> | ||
<PanelContainer VerticalExpand="True"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#80808005" /> | ||
</PanelContainer.PanelOverride> | ||
<ScrollContainer | ||
Name="PageTextScroll" | ||
HScrollEnabled="False" | ||
HorizontalExpand="True" | ||
MinSize="0 0" | ||
SizeFlagsStretchRatio="2" | ||
VerticalExpand="True"> | ||
<BoxContainer | ||
Name="PageTextContainer" | ||
MinSize="0 0" | ||
Orientation="Vertical" | ||
SizeFlagsStretchRatio="2" | ||
VerticalExpand="True"> | ||
</BoxContainer> | ||
<RichTextLabel Margin="8,8,8,8" Name="PageText" VerticalAlignment="Top"/> | ||
</ScrollContainer> | ||
</PanelContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="5,5,5,5"> | ||
<Button | ||
Name="NotificationSwith" | ||
MinWidth="20"/> | ||
<RichTextLabel Margin="5,2,2,2" Name="ShareTime" VerticalAlignment="Top"/> | ||
<RichTextLabel Margin="5,2,2,2" Name="Author" VerticalAlignment="Top" HorizontalAlignment="Right"/> | ||
</BoxContainer> | ||
</cartridges:NewsReadUiFragment> |
60 changes: 60 additions & 0 deletions
60
Content.Client/CartridgeLoader/Cartridges/NewsReadUiFragment.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using Content.Client.Message; | ||
using Content.Shared.MassMedia.Systems; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class NewsReadUiFragment : BoxContainer | ||
{ | ||
public event Action? OnNextButtonPressed; | ||
public event Action? OnPrevButtonPressed; | ||
|
||
public event Action? OnNotificationSwithPressed; | ||
|
||
public NewsReadUiFragment() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
Orientation = LayoutOrientation.Vertical; | ||
HorizontalExpand = true; | ||
VerticalExpand = true; | ||
|
||
Next.OnPressed += _ => OnNextButtonPressed?.Invoke(); | ||
Prev.OnPressed += _ => OnPrevButtonPressed?.Invoke(); | ||
NotificationSwith.OnPressed += _ => OnNotificationSwithPressed?.Invoke(); | ||
} | ||
|
||
public void UpdateState(NewsArticle article, int targetNum, int totalNum, bool notificationOn) | ||
{ | ||
PageNum.Visible = true; | ||
PageText.Visible = true; | ||
ShareTime.Visible = true; | ||
Author.Visible = true; | ||
|
||
PageName.Text = article.Name; | ||
PageText.SetMarkup(article.Content); | ||
|
||
PageNum.Text = $"{targetNum}/{totalNum}"; | ||
|
||
NotificationSwith.Text = Loc.GetString(notificationOn ? "news-read-ui-notification-on" : "news-read-ui-notification-off"); | ||
|
||
string shareTime = article.ShareTime.ToString("hh\\:mm\\:ss"); | ||
ShareTime.SetMarkup(Loc.GetString("news-read-ui-time-prefix-text") + " " + shareTime); | ||
|
||
Author.SetMarkup(Loc.GetString("news-read-ui-author-prefix") + " " + (article.Author != null ? article.Author : Loc.GetString("news-read-ui-no-author"))); | ||
} | ||
|
||
public void UpdateEmptyState(bool notificationOn) | ||
{ | ||
PageNum.Visible = false; | ||
PageText.Visible = false; | ||
ShareTime.Visible = false; | ||
Author.Visible = false; | ||
|
||
PageName.Text = Loc.GetString("news-read-ui-not-found-text"); | ||
|
||
NotificationSwith.Text = Loc.GetString(notificationOn ? "news-read-ui-notification-on" : "news-read-ui-notification-off"); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
Content.Client/CartridgeLoader/Cartridges/NotekeeperUiFragment.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Content.Client.Guidebook.Controls; | ||
public interface ISearchableControl | ||
{ | ||
public bool CheckMatchesSearch(string query); | ||
/// <summary> | ||
/// Sets the hidden state for the control. In simple cases this could just disable/hide it, but you may want more complex behavior for some elements. | ||
/// </summary> | ||
public void SetHiddenState(bool state, string query); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.