Placeholder pAIs, ghost role rules window (#4972)
This commit is contained in:
@@ -65,6 +65,7 @@ namespace Content.Client.Entry
|
||||
"Paper",
|
||||
"Write",
|
||||
"Bloodstream",
|
||||
"PAI",
|
||||
"TransformableContainer",
|
||||
"Mind",
|
||||
"StorageFill",
|
||||
|
||||
12
Content.Client/Ghost/Roles/UI/GhostRoleRulesWindow.xaml
Normal file
12
Content.Client/Ghost/Roles/UI/GhostRoleRulesWindow.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<SS14Window xmlns="https://spacestation14.io"
|
||||
Title="{Loc 'ghost-roles-window-title'}">
|
||||
<BoxContainer Orientation="Vertical"
|
||||
HorizontalExpand="True">
|
||||
<RichTextLabel Name="Title" VerticalExpand="True"/>
|
||||
<Button Name="RequestButton"
|
||||
Text="{Loc 'ghost-roles-window-request-role-button'}"
|
||||
TextAlign="Center"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</BoxContainer>
|
||||
</SS14Window>
|
||||
20
Content.Client/Ghost/Roles/UI/GhostRoleRulesWindow.xaml.cs
Normal file
20
Content.Client/Ghost/Roles/UI/GhostRoleRulesWindow.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Content.Shared.Ghost.Roles;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.Ghost.Roles.UI
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class GhostRoleRulesWindow : SS14Window
|
||||
{
|
||||
public GhostRoleRulesWindow(string rules, Action<BaseButton.ButtonEventArgs> requestAction)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
Title.SetMessage(rules);
|
||||
RequestButton.OnPressed += requestAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,27 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
public class GhostRolesEui : BaseEui
|
||||
{
|
||||
private readonly GhostRolesWindow _window;
|
||||
private GhostRoleRulesWindow? _windowRules = null;
|
||||
private uint _windowRulesId = 0;
|
||||
|
||||
public GhostRolesEui()
|
||||
{
|
||||
_window = new GhostRolesWindow();
|
||||
|
||||
_window.RoleRequested += id =>
|
||||
_window.RoleRequested += info =>
|
||||
{
|
||||
SendMessage(new GhostRoleTakeoverRequestMessage(id));
|
||||
if (_windowRules != null)
|
||||
_windowRules.Close();
|
||||
_windowRules = new GhostRoleRulesWindow(info.Rules, _ =>
|
||||
{
|
||||
SendMessage(new GhostRoleTakeoverRequestMessage(info.Identifier));
|
||||
});
|
||||
_windowRulesId = info.Identifier;
|
||||
_windowRules.OnClose += () =>
|
||||
{
|
||||
_windowRules = null;
|
||||
};
|
||||
_windowRules.OpenCentered();
|
||||
};
|
||||
|
||||
_window.OnClose += () =>
|
||||
@@ -35,6 +48,7 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
{
|
||||
base.Closed();
|
||||
_window.Close();
|
||||
_windowRules?.Close();
|
||||
}
|
||||
|
||||
public override void HandleState(EuiStateBase state)
|
||||
@@ -43,11 +57,22 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
|
||||
if (state is not GhostRolesEuiState ghostState) return;
|
||||
|
||||
var closeRulesWindow = true;
|
||||
|
||||
_window.ClearEntries();
|
||||
|
||||
foreach (var info in ghostState.GhostRoles)
|
||||
{
|
||||
_window.AddEntry(info);
|
||||
if (info.Identifier == _windowRulesId)
|
||||
{
|
||||
closeRulesWindow = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (closeRulesWindow)
|
||||
{
|
||||
_windowRules?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class GhostRolesWindow : SS14Window
|
||||
{
|
||||
public event Action<uint>? RoleRequested;
|
||||
public event Action<GhostRoleInfo>? RoleRequested;
|
||||
|
||||
public void ClearEntries()
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
public void AddEntry(GhostRoleInfo info)
|
||||
{
|
||||
NoRolesMessage.Visible = false;
|
||||
EntryContainer.AddChild(new GhostRolesEntry(info, _ => RoleRequested?.Invoke(info.Identifier)));
|
||||
EntryContainer.AddChild(new GhostRolesEntry(info, _ => RoleRequested?.Invoke(info)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
private void OnMake(EntityUid uid, string name, string description, bool makeSentient)
|
||||
private void OnMake(EntityUid uid, string name, string description, string rules, bool makeSentient)
|
||||
{
|
||||
var player = _playerManager.LocalPlayer;
|
||||
if (player == null)
|
||||
@@ -54,7 +54,8 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
$"makeghostrole " +
|
||||
$"\"{CommandParsing.Escape(uid.ToString())}\" " +
|
||||
$"\"{CommandParsing.Escape(name)}\" " +
|
||||
$"\"{CommandParsing.Escape(description)}\"";
|
||||
$"\"{CommandParsing.Escape(description)}\" " +
|
||||
$"\"{CommandParsing.Escape(rules)}\"";
|
||||
|
||||
_consoleHost.ExecuteCommand(player.Session, makeGhostRoleCommand);
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
<Label Name="RoleDescriptionLabel" Text="Role Description" />
|
||||
<LineEdit Name="RoleDescription" HorizontalExpand="True" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Name="RoleRulesLabel" Text="Role Rules" />
|
||||
<LineEdit Name="RoleRules" HorizontalExpand="True" Text="{Loc ghost-role-component-default-rules}" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Name="MakeSentientLabel" Text="Make Sentient" />
|
||||
<CheckBox Name="MakeSentientCheckbox" />
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class MakeGhostRoleWindow : SS14Window
|
||||
{
|
||||
public delegate void MakeRole(EntityUid uid, string name, string description, bool makeSentient);
|
||||
public delegate void MakeRole(EntityUid uid, string name, string description, string rules, bool makeSentient);
|
||||
|
||||
public MakeGhostRoleWindow()
|
||||
{
|
||||
@@ -21,6 +21,8 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
RoleName.MinSize = (300, 0);
|
||||
RoleDescriptionLabel.MinSize = (150, 0);
|
||||
RoleDescription.MinSize = (300, 0);
|
||||
RoleRulesLabel.MinSize = (150, 0);
|
||||
RoleRules.MinSize = (300, 0);
|
||||
|
||||
MakeButton.OnPressed += OnPressed;
|
||||
}
|
||||
@@ -42,7 +44,7 @@ namespace Content.Client.Ghost.Roles.UI
|
||||
return;
|
||||
}
|
||||
|
||||
OnMake?.Invoke(EntityUid.Value, RoleName.Text, RoleDescription.Text, MakeSentientCheckbox.Pressed);
|
||||
OnMake?.Invoke(EntityUid.Value, RoleName.Text, RoleDescription.Text, RoleRules.Text, MakeSentientCheckbox.Pressed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user