Skip to content

Commit 0ec9882

Browse files
First half of message board system.
1 parent 1d717ae commit 0ec9882

11 files changed

Lines changed: 395 additions & 29 deletions

File tree

Content.Client/Content.Client.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<WarningsAsErrors>RA0032;nullable</WarningsAsErrors>
77
</PropertyGroup>
88
<Import Project="../MSBuild/Content.props" />
9+
<ItemGroup>
10+
<None Remove="MessageBoard\UI\MessageBoard.xaml~RF197aa77f.TMP" />
11+
</ItemGroup>
912
<ItemGroup>
1013
<PackageReference Include="Nett" />
1114
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
@@ -30,6 +33,9 @@
3033
<AdditionalFiles Update="GridControl\UI\StationTaggerWindow.xaml">
3134
<Generator>MSBuild:Compile</Generator>
3235
</AdditionalFiles>
36+
<AdditionalFiles Update="MessageBoard\UI\CreateEntry.xaml">
37+
<Generator>MSBuild:Compile</Generator>
38+
</AdditionalFiles>
3339
</ItemGroup>
3440

3541
<ItemGroup>
@@ -82,6 +88,9 @@
8288
<ItemGroup>
8389
<EmbeddedResource Update="CrewAssignments\UI\StationModificationMenu.xaml" />
8490
</ItemGroup>
91+
<ItemGroup>
92+
<EmbeddedResource Update="MessageBoard\UI\MessageBoard.xaml" />
93+
</ItemGroup>
8594
<ItemGroup>
8695
<EmbeddedResource Update="_NF\Bank\UI\BankATMMenu.xaml">
8796
<Generator>MSBuild:Compile</Generator>
@@ -93,4 +102,7 @@
93102
<Generator>MSBuild:Compile</Generator>
94103
</EmbeddedResource>
95104
</ItemGroup>
105+
<ItemGroup>
106+
<Folder Include="MessageBoard\Systems\" />
107+
</ItemGroup>
96108
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<DefaultWindow xmlns="https://spacestation14.io"
2+
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
3+
Title="Create Entry">
4+
<BoxContainer Orientation="Vertical" MinSize="400 400">
5+
<BoxContainer Orientation="Horizontal">
6+
<Label Text ="Title:"></Label>
7+
<LineEdit Name="MainTitleLabel" PlaceHolder="Title Label" Access="Public" HorizontalExpand="True"/>
8+
</BoxContainer>
9+
<customControls:HSeparator Margin="5 10 5 10"/>
10+
<Label Text ="Content:"></Label>
11+
<PanelContainer StyleIdentifier="PaperEditBackground" VerticalExpand="True" HorizontalExpand="True">
12+
<TextEdit Name="DescriptionLabel" Access="Public" HorizontalExpand="True" VerticalExpand="True"/>
13+
</PanelContainer>
14+
<Button Name="PostButton" Text="Post Entry" Access="Public" />
15+
</BoxContainer>
16+
</DefaultWindow>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Robust.Client.AutoGenerated;
2+
using Robust.Client.UserInterface.CustomControls;
3+
4+
namespace Content.Client.MessageBoard.UI;
5+
[GenerateTypedNameReferences]
6+
public sealed partial class CreateEntry : DefaultWindow
7+
{
8+
public enum EntryType : byte
9+
{
10+
Public,
11+
Direct
12+
}
13+
14+
public EntryType CurrentEntryType = EntryType.Public;
15+
16+
}
17+
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<controls:FancyWindow xmlns="https://spacestation14.io"
2+
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
3+
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
4+
SetSize="600 690"
5+
MinSize="600 690">
6+
<BoxContainer Orientation="Vertical">
7+
<ScrollContainer VerticalExpand="True">
8+
<TabContainer>
9+
<BoxContainer Orientation="Vertical" Name="PublicBoard">
10+
<Button Text="Create A New Entry" Name="CreateEntryPublicButton" Access="Public" />
11+
<BoxContainer Orientation="Vertical" Name="PublicBoardEntries" />
12+
<PanelContainer VerticalExpand="True"
13+
HorizontalExpand="True"
14+
SizeFlagsStretchRatio="1"
15+
Name="PublicBoardEntriesPC">
16+
<PanelContainer.PanelOverride>
17+
<gfx:StyleBoxFlat BackgroundColor="#000000" />
18+
</PanelContainer.PanelOverride>
19+
<ScrollContainer VerticalExpand="True">
20+
<BoxContainer Orientation="Vertical" Margin="5" MinHeight ="10">
21+
<BoxContainer Name="PublicBoardEntriesBC"
22+
Orientation="Vertical"
23+
VerticalExpand="True">
24+
25+
<PanelContainer StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
26+
<BoxContainer
27+
HorizontalExpand="True"
28+
Orientation="Vertical">
29+
<BoxContainer Orientation="Horizontal">
30+
<Label Text="(JOB) Looking for engineers to help with a shuttle." StyleClasses="LabelKeyText" />
31+
<Control HorizontalExpand="True" />
32+
<Button Text="View" />
33+
</BoxContainer>
34+
<Label Access="Public" Name="RewardLabel" Text="Posted by Chester Cheetah" />
35+
<BoxContainer Orientation="Horizontal">
36+
<Label Access="Public" Text="14:17 2246-05-01" />
37+
<Control HorizontalExpand="True" />
38+
<Label Access="Public" Text="0 Comments" />
39+
</BoxContainer>
40+
41+
</BoxContainer>
42+
</PanelContainer>
43+
<PanelContainer StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
44+
<BoxContainer
45+
HorizontalExpand="True"
46+
Orientation="Vertical">
47+
<Label Access="Public" Name="ObjectiveLabel2" Text="Get high from space mirage." />
48+
<Label Access="Public" Name="RewardLabel2" Text="Reward: 100 Precursor" />
49+
<Label Access="Public" Name="SectorChaosLabel2" Text="Sector chaos will slightly increase" />
50+
</BoxContainer>
51+
</PanelContainer>
52+
</BoxContainer>
53+
</BoxContainer>
54+
</ScrollContainer>
55+
</PanelContainer>
56+
</BoxContainer>
57+
<BoxContainer Orientation="Vertical" Name="DirectMessages">
58+
59+
60+
</BoxContainer>
61+
</TabContainer>
62+
</ScrollContainer>
63+
</BoxContainer>
64+
</controls:FancyWindow>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Content.Client.Cargo.Systems;
2+
using Content.Client.UserInterface.Controls;
3+
using Robust.Client.AutoGenerated;
4+
using Robust.Client.GameObjects;
5+
using Robust.Client.UserInterface.Controls;
6+
using Robust.Client.UserInterface.XAML;
7+
using Robust.Shared.Prototypes;
8+
9+
namespace Content.Client.MessageBoard.UI;
10+
11+
[GenerateTypedNameReferences]
12+
public sealed partial class MessageBoard : FancyWindow
13+
{
14+
private readonly IPrototypeManager _protoManager;
15+
private readonly CargoSystem _cargoSystem;
16+
private readonly SpriteSystem _spriteSystem;
17+
private EntityUid _owner;
18+
public MessageBoard(EntityUid owner, IEntityManager entMan, IPrototypeManager protoManager, SpriteSystem spriteSystem)
19+
{
20+
RobustXamlLoader.Load(this);
21+
IoCManager.InjectDependencies(this);
22+
_protoManager = protoManager;
23+
_cargoSystem = entMan.System<CargoSystem>();
24+
_spriteSystem = spriteSystem;
25+
_owner = owner;
26+
Title = entMan.GetComponent<MetaDataComponent>(owner).EntityName;
27+
}
28+
29+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
using Content.Client.CrewAssignments.UI;
2+
using Content.Shared.IdentityManagement;
3+
using Content.Shared.MessageBoard.Components;
4+
using JetBrains.Annotations;
5+
using Robust.Client.GameObjects;
6+
using Robust.Client.Player;
7+
using Robust.Client.UserInterface.Controls;
8+
using Robust.Shared.Prototypes;
9+
using Robust.Shared.Utility;
10+
using System;
11+
using System.Collections.Generic;
12+
using System.Text;
13+
using static Robust.Client.UserInterface.Controls.MenuBar;
14+
15+
namespace Content.Client.MessageBoard.UI;
16+
17+
[UsedImplicitly]
18+
public sealed class MessageBoardBoundUserInterface : BoundUserInterface
19+
{
20+
[ViewVariables]
21+
private MessageBoard? _menu;
22+
private CreateEntry? _createEntry;
23+
24+
public MessageBoardBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
25+
{
26+
}
27+
28+
protected override void Open()
29+
{
30+
base.Open();
31+
var spriteSystem = EntMan.System<SpriteSystem>();
32+
var dependencies = IoCManager.Instance!;
33+
_menu = new MessageBoard(Owner, EntMan, dependencies.Resolve<IPrototypeManager>(), spriteSystem);
34+
var localPlayer = dependencies.Resolve<IPlayerManager>().LocalEntity;
35+
var description = new FormattedMessage();
36+
_menu.OnClose += Close;
37+
_menu.OpenCentered();
38+
_menu.CreateEntryPublicButton.OnPressed += CreateEntryPublic;
39+
}
40+
41+
public void CreateEntryPublic(BaseButton.ButtonEventArgs args)
42+
{
43+
if(_createEntry != null)
44+
{
45+
_createEntry.Dispose();
46+
}
47+
_createEntry = new CreateEntry();
48+
_createEntry.OpenCentered();
49+
_createEntry.CurrentEntryType = CreateEntry.EntryType.Public;
50+
_createEntry.PostButton.OnPressed += FinalizeEntryPublic;
51+
}
52+
53+
public void FinalizeEntryPublic(BaseButton.ButtonEventArgs args)
54+
{
55+
if (_createEntry == null)
56+
return;
57+
var title = _createEntry.MainTitleLabel.Text;
58+
var content = Rope.Collapse(_createEntry.DescriptionLabel.TextRope);
59+
if(title == string.Empty || content == string.Empty)
60+
{
61+
return;
62+
}
63+
SendMessage(new MessageBoardCreateEntryPublicMessage(title, content));
64+
_createEntry.Dispose();
65+
_createEntry = null;
66+
}
67+
68+
protected override void Dispose(bool disposing)
69+
{
70+
base.Dispose(disposing);
71+
72+
if (!disposing)
73+
return;
74+
75+
_menu?.Dispose();
76+
}
77+
78+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using Content.Server.CrewRecords.Systems;
2+
using Content.Shared.Cargo.BUI;
3+
using Content.Shared.CrewAssignments;
4+
using Content.Shared.CrewAssignments.Components;
5+
using Content.Shared.CrewAssignments.Systems;
6+
using Content.Shared.DoAfter;
7+
using Content.Shared.Implants.Components;
8+
using Content.Shared.Interaction;
9+
using Content.Shared.MessageBoard.Components;
10+
using Content.Shared.MessageBoard.Systems;
11+
using Content.Shared.UserInterface;
12+
using Robust.Server.GameObjects;
13+
using Robust.Shared.Physics.Dynamics;
14+
using System;
15+
using System.Collections.Generic;
16+
using System.Text;
17+
using static Content.Shared.CrewAssignments.Systems.CodexEuiMsg;
18+
using static Content.Shared.CrewAssignments.Systems.SharedJobNetSystem;
19+
using static System.Collections.Specialized.BitVector32;
20+
using static System.Runtime.InteropServices.JavaScript.JSType;
21+
22+
namespace Content.Server.MessageBoard.Systems;
23+
24+
public sealed partial class MessageBoardSystem : SharedMessageBoardSystem
25+
{
26+
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
27+
[Dependency] private readonly CrewMetaRecordsSystem _crewMetaRecordsSystem = default!;
28+
public override void Initialize()
29+
{
30+
base.Initialize();
31+
32+
SubscribeLocalEvent<MessageBoardComponent, BoundUIOpenedEvent>(OnUIOpened);
33+
SubscribeLocalEvent<MessageBoardComponent, MessageBoardCreateEntryPublicMessage>(OnCreateEntryPublic);
34+
}
35+
36+
private void OnUIOpened(Entity<MessageBoardComponent> ent, ref BoundUIOpenedEvent args)
37+
{
38+
UpdateUserInterface(ent.Owner, ent.Comp);
39+
}
40+
41+
private void OnCreateEntryPublic(Entity<MessageBoardComponent> ent, ref MessageBoardCreateEntryPublicMessage args)
42+
{
43+
var metaRecord = _crewMetaRecordsSystem.MetaRecords;
44+
if (metaRecord == null) return;
45+
MessageBoardEntry newEntry = new(args.Title, Name(args.Actor), args.Body);
46+
metaRecord.MessageBoardEntries.Add(newEntry);
47+
UpdateUserInterface(ent.Owner, ent.Comp);
48+
}
49+
50+
private void UpdateUserInterface(EntityUid uid, MessageBoardComponent component)
51+
{
52+
_uiSystem.SetUiState(uid, MessageBoardUiKey.Main, new MessageBoardInterfaceState());
53+
}
54+
}

Content.Shared/CrewAssignments/Components/StationModificationConsoleComponent.cs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,8 @@
44

55
namespace Content.Shared.CrewAssignments.Components;
66

7-
/// <summary>
8-
/// Handles sending order requests to cargo. Doesn't handle orders themselves via shuttle or telepads.
9-
/// </summary>
10-
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
7+
[RegisterComponent, NetworkedComponent]
118
[Access(typeof(SharedCrewAssignmentSystem))]
129
public sealed partial class StationModificationConsoleComponent : Component
1310
{
14-
/// <summary>
15-
/// If true, account transfers have no limit and a lower cooldown.
16-
/// </summary>
17-
[DataField, AutoNetworkedField]
18-
public bool TransferUnbounded;
19-
}
20-
21-
/// <summary>
22-
/// The behaviour of the cargo order console
23-
/// </summary>
24-
[Serializable, NetSerializable]
25-
public enum StationModificationConsoleMode : byte
26-
{
27-
/// <summary>
28-
/// Place orders directly
29-
/// </summary>
30-
DirectOrder,
31-
/// <summary>
32-
/// Print a slip to be inserted into a DirectOrder console
33-
/// </summary>
34-
PrintSlip,
35-
/// <summary>
36-
/// Transfers the order to the primary account
37-
/// </summary>
38-
SendToPrimary,
3911
}

0 commit comments

Comments
 (0)