using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Crayon;
///
/// Component holding the state of a crayon-like component
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SharedCrayonSystem))]
public sealed partial class CrayonComponent : Component
{
///
/// The ID of currently selected decal prototype that will be placed when the crayon is used.
///
[DataField, AutoNetworkedField]
public string SelectedState;
///
/// Color with which the crayon will draw.
///
[DataField, AutoNetworkedField]
public Color Color;
///
/// Play a sound when drawing if specified.
///
[DataField]
public SoundSpecifier? UseSound;
///
/// Can the color can be changed?
///
[DataField, AutoNetworkedField]
public bool SelectableColor;
///
/// Should the crayon be deleted when all charges are consumed?
///
[DataField, AutoNetworkedField]
public bool DeleteEmpty = true;
}
///
/// Opens the crayon window for decal and color selection.
///
[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;
}
}
///
/// The state of the crayon UI as sent by the server
///
///
/// TODO: Delete this and use component states and predict the UI.
/// This info is already networked on its own.
///
[Serializable, NetSerializable]
public sealed class CrayonBoundUserInterfaceState : BoundUserInterfaceState
{
public string Selected;
///
/// Can the color can be changed
///
public bool SelectableColor;
public Color Color;
public CrayonBoundUserInterfaceState(string selected, bool selectableColor, Color color)
{
Selected = selected;
SelectableColor = selectableColor;
Color = color;
}
}