mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* ComponentNames are not sent over the network when components are created. * Removed ComponentStates array from EntityState, now the state is stored directly inside the CompChange struct. * Remove the unnecessary NetID property from ComponentState. * Remove Component.NetworkSynchronizeExistence. * Change GetNetComponents to return both the component and the component NetId. * Remove public usages of the Component.NetID property. * Adds the NetIDAttribute that can be applied to components. * Removed Component.NetID. * Revert changes to GetComponentState and how prediction works. * Adds component netID automatic generation. * Modifies ClientConsoleHost so that commands can be called before Initialize(). * Completely remove static NetIds. * Renamed NetIDAttribute to NetworkedComponentAttribute. * Fixing unit tests.
93 lines
2.5 KiB
C#
93 lines
2.5 KiB
C#
using System;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Reflection;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
namespace Robust.Shared.GameObjects
|
|
{
|
|
[NetworkedComponent()]
|
|
public abstract class SharedUserInterfaceComponent : Component
|
|
{
|
|
public sealed override string Name => "UserInterface";
|
|
|
|
[DataDefinition]
|
|
public sealed class PrototypeData : ISerializationHooks
|
|
{
|
|
public object UiKey { get; set; } = default!;
|
|
|
|
[DataField("key", readOnly: true, required: true)]
|
|
private string _uiKeyRaw = default!;
|
|
|
|
[DataField("type", readOnly: true, required: true)]
|
|
public string ClientType { get; set; } = default!;
|
|
|
|
void ISerializationHooks.AfterDeserialization()
|
|
{
|
|
var reflectionManager = IoCManager.Resolve<IReflectionManager>();
|
|
|
|
if (reflectionManager.TryParseEnumReference(_uiKeyRaw, out var @enum))
|
|
{
|
|
UiKey = @enum;
|
|
return;
|
|
}
|
|
|
|
UiKey = _uiKeyRaw;
|
|
}
|
|
}
|
|
}
|
|
|
|
[NetSerializable, Serializable]
|
|
public abstract class BoundUserInterfaceState
|
|
{
|
|
}
|
|
|
|
|
|
[NetSerializable, Serializable]
|
|
public class BoundUserInterfaceMessage
|
|
{
|
|
}
|
|
|
|
[NetSerializable, Serializable]
|
|
internal sealed class UpdateBoundStateMessage : BoundUserInterfaceMessage
|
|
{
|
|
public readonly BoundUserInterfaceState State;
|
|
|
|
public UpdateBoundStateMessage(BoundUserInterfaceState state)
|
|
{
|
|
State = state;
|
|
}
|
|
}
|
|
|
|
[NetSerializable, Serializable]
|
|
internal sealed class OpenBoundInterfaceMessage : BoundUserInterfaceMessage
|
|
{
|
|
}
|
|
|
|
[NetSerializable, Serializable]
|
|
internal sealed class CloseBoundInterfaceMessage : BoundUserInterfaceMessage
|
|
{
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
internal sealed class BoundUIWrapMessage : EntityEventArgs
|
|
{
|
|
public readonly EntityUid Entity;
|
|
public readonly BoundUserInterfaceMessage Message;
|
|
public readonly object UiKey;
|
|
|
|
public BoundUIWrapMessage(EntityUid entity, BoundUserInterfaceMessage message, object uiKey)
|
|
{
|
|
Message = message;
|
|
UiKey = uiKey;
|
|
Entity = entity;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{nameof(BoundUIWrapMessage)}: {Message}";
|
|
}
|
|
}
|
|
}
|