using Robust.Shared.Serialization;
namespace Content.Shared.Research.Components
{
///
/// This is an entity that is able to connect to a
///
[RegisterComponent]
public sealed partial class ResearchClientComponent : Component
{
public bool ConnectedToServer => Server != null;
///
/// The server the client is connected to
///
[ViewVariables(VVAccess.ReadOnly)]
public EntityUid? Server { get; set; }
}
///
/// Raised on the client whenever its server is changed
///
/// Its new server
[ByRefEvent]
public readonly record struct ResearchRegistrationChangedEvent(EntityUid? Server);
///
/// Sent to the server when the client deselects a research server.
///
[Serializable, NetSerializable]
public sealed class ResearchClientServerDeselectedMessage : BoundUserInterfaceMessage
{
}
///
/// Sent to the server when the client chooses a research server.
///
[Serializable, NetSerializable]
public sealed class ResearchClientServerSelectedMessage : BoundUserInterfaceMessage
{
public int ServerId;
public ResearchClientServerSelectedMessage(int serverId)
{
ServerId = serverId;
}
}
///
/// Request that the server updates the client.
///
[Serializable, NetSerializable]
public sealed class ResearchClientSyncMessage : BoundUserInterfaceMessage
{
}
[NetSerializable, Serializable]
public enum ResearchClientUiKey
{
Key,
}
[Serializable, NetSerializable]
public sealed class ResearchClientBoundInterfaceState : BoundUserInterfaceState
{
public int ServerCount;
public string[] ServerNames;
public int[] ServerIds;
public int SelectedServerId;
public ResearchClientBoundInterfaceState(int serverCount, string[] serverNames, int[] serverIds, int selectedServerId = -1)
{
ServerCount = serverCount;
ServerNames = serverNames;
ServerIds = serverIds;
SelectedServerId = selectedServerId;
}
}
}