Improve paper stamping experience (#17135)
This commit is contained in:
@@ -1,60 +1,59 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Paper
|
||||
namespace Content.Shared.Paper;
|
||||
|
||||
public abstract class SharedPaperComponent : Component
|
||||
{
|
||||
public abstract class SharedPaperComponent : Component
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PaperBoundUserInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PaperBoundUserInterfaceState : BoundUserInterfaceState
|
||||
public readonly string Text;
|
||||
public readonly List<StampDisplayInfo> StampedBy;
|
||||
public readonly PaperAction Mode;
|
||||
|
||||
public PaperBoundUserInterfaceState(string text, List<StampDisplayInfo> stampedBy, PaperAction mode = PaperAction.Read)
|
||||
{
|
||||
public readonly string Text;
|
||||
public readonly List<string> StampedBy;
|
||||
public readonly PaperAction Mode;
|
||||
|
||||
public PaperBoundUserInterfaceState(string text, List<string> stampedBy, PaperAction mode = PaperAction.Read)
|
||||
{
|
||||
Text = text;
|
||||
StampedBy = stampedBy;
|
||||
Mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PaperInputTextMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly string Text;
|
||||
|
||||
public PaperInputTextMessage(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperUiKey
|
||||
{
|
||||
Key
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperAction
|
||||
{
|
||||
Read,
|
||||
Write,
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperVisuals : byte
|
||||
{
|
||||
Status,
|
||||
Stamp
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperStatus : byte
|
||||
{
|
||||
Blank,
|
||||
Written
|
||||
Text = text;
|
||||
StampedBy = stampedBy;
|
||||
Mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PaperInputTextMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly string Text;
|
||||
|
||||
public PaperInputTextMessage(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperUiKey
|
||||
{
|
||||
Key
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperAction
|
||||
{
|
||||
Read,
|
||||
Write,
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperVisuals : byte
|
||||
{
|
||||
Status,
|
||||
Stamp
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum PaperStatus : byte
|
||||
{
|
||||
Blank,
|
||||
Written
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,52 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Shared.Paper
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class StampComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The loc string name that will be stamped to the piece of paper on examine.
|
||||
/// </summary>
|
||||
[DataField("stampedName")]
|
||||
public string StampedName { get; set; } = "stamp-component-stamped-name-default";
|
||||
/// <summary>
|
||||
/// Tne sprite state of the stamp to display on the paper from bureacracy.rsi.
|
||||
/// </summary>
|
||||
[DataField("stampState")]
|
||||
public string StampState { get; set; } = "paper_stamp-generic";
|
||||
namespace Content.Shared.Paper;
|
||||
|
||||
[DataField("sound")]
|
||||
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Items/Stamp/thick_stamp_sub.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(-2f).WithMaxDistance(5f)
|
||||
};
|
||||
/// <summary>
|
||||
/// Set of required information to draw a stamp in UIs, where
|
||||
/// representing the state of the stamp at the point in time
|
||||
/// when it was applied to a paper. These fields mirror the
|
||||
/// equivalent in the component.
|
||||
/// </summary>
|
||||
[DataDefinition, Serializable, NetSerializable]
|
||||
public struct StampDisplayInfo
|
||||
{
|
||||
StampDisplayInfo(string s)
|
||||
{
|
||||
StampedName = s;
|
||||
}
|
||||
|
||||
[DataField("stampedName")]
|
||||
public string StampedName;
|
||||
|
||||
[DataField("stampedColor")]
|
||||
public Color StampedColor;
|
||||
};
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class StampComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The loc string name that will be stamped to the piece of paper on examine.
|
||||
/// </summary>
|
||||
[DataField("stampedName")]
|
||||
public string StampedName { get; set; } = "stamp-component-stamped-name-default";
|
||||
/// <summary>
|
||||
/// Tne sprite state of the stamp to display on the paper from bureacracy.rsi.
|
||||
/// </summary>
|
||||
[DataField("stampState")]
|
||||
public string StampState { get; set; } = "paper_stamp-generic";
|
||||
|
||||
/// <summary>
|
||||
/// The color of the ink used by the stamp in UIs
|
||||
/// </summary>
|
||||
[DataField("stampedColor")]
|
||||
public Color StampedColor = Color.FromHex("#BB3232"); // StyleNano.DangerousRedFore
|
||||
|
||||
[DataField("sound")]
|
||||
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Items/Stamp/thick_stamp_sub.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(-2f).WithMaxDistance(5f)
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user