sasalka/Code/UI/MusicPlayerNextButton.cs
2025-05-28 17:15:12 +03:00

23 lines
523 B
C#

namespace Sandbox.UI;
[Icon("skip_next")]
public sealed class MusicPlayerNextButton : InteractionButton
{
[Property] public MyMusicPlayer MusicPlayer { get; set; }
public override bool Press(IPressable.Event e)
{
base.Press(e);
DoNextRpc(); // вызываем RPC отдельно из за того что в базовом классе абстракт и RPC там не работают
return true;
}
[Rpc.Broadcast]
private void DoNextRpc()
{
Log.Info("PRESSED");
MusicPlayer?.Next();
}
}