И твой сорванный голос мне напомнит о прошлом
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using System.Linq;
|
||||
using Lidgren.Network;
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -21,45 +19,46 @@ public enum TapeCreatorUIKey : byte
|
||||
Key
|
||||
}
|
||||
|
||||
[NetworkedComponent, RegisterComponent]
|
||||
[NetworkedComponent, RegisterComponent, AutoGenerateComponentState]
|
||||
public sealed partial class JukeboxComponent : Component
|
||||
{
|
||||
|
||||
public static string JukeboxContainerName = "jukebox_tapes";
|
||||
public static string JukeboxDefaultSongsName = "jukebox_default_tapes";
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public Container TapeContainer = default!;
|
||||
|
||||
[DataField("defaultTapes")]
|
||||
public List<string> DefaultTapes = new();
|
||||
[DataField]
|
||||
public List<string> DefaultTapes = [];
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public Container DefaultSongsContainer = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly), AutoNetworkedField]
|
||||
public bool Playing { get; set; } = true;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public bool Repeating { get; set; } = true;
|
||||
|
||||
[DataField("volume") ,ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField, ViewVariables(VVAccess.ReadOnly), AutoNetworkedField]
|
||||
public float Volume { get; set; }
|
||||
|
||||
[DataField("maxAudioRange")]
|
||||
[DataField]
|
||||
public float MaxAudioRange { get; set; } = 20f;
|
||||
|
||||
[DataField("rolloffFactor")]
|
||||
[DataField]
|
||||
public float RolloffFactor { get; set; } = 0.3f;
|
||||
|
||||
[AutoNetworkedField]
|
||||
public PlayingSongData? PlayingSongData { get; set; }
|
||||
}
|
||||
|
||||
public sealed partial class TapeContainerComponent : Component
|
||||
{
|
||||
public int MaxTapeCount = 1;
|
||||
|
||||
public Container TapeContainer { get; set; } = new();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class PlayingSongData
|
||||
public sealed class PlayingSongData
|
||||
{
|
||||
public ResPath? SongPath;
|
||||
public string? SongName;
|
||||
@@ -67,59 +66,56 @@ public class PlayingSongData
|
||||
public float ActualSongLengthSeconds;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class JukeboxComponentState : ComponentState
|
||||
{
|
||||
public bool Playing { get; set; }
|
||||
|
||||
public PlayingSongData? SongData { get; set; }
|
||||
public float Volume { get; set; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable, DataDefinition]
|
||||
public sealed partial class JukeboxSong
|
||||
{
|
||||
[DataField("songName")]
|
||||
[DataField]
|
||||
public string? SongName;
|
||||
|
||||
[DataField("path")]
|
||||
public ResPath? SongPath;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class JukeboxRequestSongPlay : EntityEventArgs
|
||||
public sealed class JukeboxRequestSongPlay : EntityEventArgs
|
||||
{
|
||||
public string? SongName { get; set; }
|
||||
|
||||
public ResPath? SongPath { get; set; }
|
||||
|
||||
public NetEntity? Jukebox { get; set; }
|
||||
|
||||
public float SongDuration { get; set; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class JukeboxRequestStop : EntityEventArgs
|
||||
public sealed class JukeboxRequestStop : EntityEventArgs
|
||||
{
|
||||
public NetEntity? JukeboxUid { get; set; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class JukeboxStopPlaying : EntityEventArgs
|
||||
public sealed class JukeboxStopPlaying : EntityEventArgs
|
||||
{
|
||||
public NetEntity? JukeboxUid { get; set; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class JukeboxSongUploadRequest : EntityEventArgs
|
||||
public sealed class JukeboxSongUploadRequest : EntityEventArgs
|
||||
{
|
||||
public string SongName = string.Empty;
|
||||
public List<byte> SongBytes = new();
|
||||
public List<byte> SongBytes = [];
|
||||
public NetEntity TapeCreatorUid = default!;
|
||||
}
|
||||
|
||||
public class JukeboxSongUploadNetMessage : NetMessage
|
||||
public sealed class JukeboxSongUploadNetMessage : NetMessage
|
||||
{
|
||||
public override NetDeliveryMethod DeliveryMethod => NetDeliveryMethod.ReliableUnordered;
|
||||
|
||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
||||
|
||||
public ResPath RelativePath { get; set; } = ResPath.Self;
|
||||
|
||||
public byte[] Data { get; set; } = Array.Empty<byte>();
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
|
||||
@@ -136,4 +132,4 @@ public class JukeboxSongUploadNetMessage : NetMessage
|
||||
buffer.Write(RelativePath.ToString());
|
||||
buffer.Write(ResPath.Separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user