using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Crayon
{
///
/// Component holding the state of a crayon-like component
///
[NetworkedComponent, ComponentProtoName("Crayon"), Access(typeof(SharedCrayonSystem))]
public abstract partial class SharedCrayonComponent : Component
{
///
/// The ID of currently selected decal prototype that will be placed when the crayon is used
///
public string SelectedState { get; set; } = string.Empty;
///
/// Color with which the crayon will draw
///
[DataField("color")]
public Color Color;
[Serializable, NetSerializable]
public enum CrayonUiKey : byte
{
Key,
}
}
///
/// Used by the client to notify the server about the selected decal ID
///
[Serializable, NetSerializable]
public sealed class CrayonSelectMessage : BoundUserInterfaceMessage
{
public readonly string State;
public CrayonSelectMessage(string selected)
{
State = selected;
}
}
///
/// Sets the color of the crayon, used by Rainbow Crayon
///
[Serializable, NetSerializable]
public sealed class CrayonColorMessage : BoundUserInterfaceMessage
{
public readonly Color Color;
public CrayonColorMessage(Color color)
{
Color = color;
}
}
///
/// Server to CLIENT. Notifies the BUI that a decal with given ID has been drawn.
/// Allows the client UI to advance forward in the client-only ephemeral queue,
/// preventing the crayon from becoming a magic text storage device.
///
[Serializable, NetSerializable]
public sealed class CrayonUsedMessage : BoundUserInterfaceMessage
{
public readonly string DrawnDecal;
public CrayonUsedMessage(string drawn)
{
DrawnDecal = drawn;
}
}
///
/// Component state, describes how many charges are left in the crayon in the near-hand UI
///
[Serializable, NetSerializable]
public sealed class CrayonComponentState : ComponentState
{
public readonly Color Color;
public readonly string State;
public readonly int Charges;
public readonly int Capacity;
public CrayonComponentState(Color color, string state, int charges, int capacity)
{
Color = color;
State = state;
Charges = charges;
Capacity = capacity;
}
}
///
/// The state of the crayon UI as sent by the server
///
[Serializable, NetSerializable]
public sealed class CrayonBoundUserInterfaceState : BoundUserInterfaceState
{
public string Selected;
///
/// Whether or not the color can be selected
///
public bool SelectableColor;
public Color Color;
public CrayonBoundUserInterfaceState(string selected, bool selectableColor, Color color)
{
Selected = selected;
SelectableColor = selectableColor;
Color = color;
}
}
}