upd
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
using Sandbox;
|
||||
using Sandbox.UI;
|
||||
|
||||
public sealed class MusicPlayerInteractions : SimpleInteractions.SimpleInteraction
|
||||
public sealed class MusicPlayerInteractions : InteractionButton
|
||||
{
|
||||
[Property] public MyMusicPlayer MusicPlayer { get; set; }
|
||||
|
||||
[Rpc.Broadcast]
|
||||
protected override void OnInteract()
|
||||
[Property] public MyMusicPlayer MusicPlayer { get; set; }
|
||||
|
||||
public override bool Press(IPressable.Event e)
|
||||
{
|
||||
// Log.Info($"{Rpc.Caller.DisplayName} interacted with {this.GameObject.Name}!");
|
||||
base.Press(e);
|
||||
Log.Info("PRESSED");
|
||||
MusicPlayer.Next();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
namespace Sandbox;
|
||||
|
||||
[Icon( "skip_next" )]
|
||||
public sealed class MusicPlayerNextButton : Component, Component.IPressable
|
||||
{
|
||||
[Property] public string Label { get; set; } = "Next track";
|
||||
|
||||
public bool Press( Component.IPressable.Event e )
|
||||
{
|
||||
Log.Info( $"Press от {e.Source}" );
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Hover( Component.IPressable.Event e )
|
||||
{
|
||||
Log.Info( $"Hover от {e.Source}" );
|
||||
}
|
||||
|
||||
public void Look( Component.IPressable.Event e )
|
||||
{
|
||||
Log.Info( "Look..." );
|
||||
}
|
||||
|
||||
public void Blur( Component.IPressable.Event e )
|
||||
{
|
||||
Log.Info( "Blur — игрок отвёл взгляд" );
|
||||
}
|
||||
|
||||
public void Release( Component.IPressable.Event e )
|
||||
{
|
||||
Log.Info( "Release — игрок отпустил кнопку" );
|
||||
}
|
||||
|
||||
public bool Pressing( Component.IPressable.Event e )
|
||||
{
|
||||
// возвращаем true, чтобы удержание продолжалось
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanPress( Component.IPressable.Event e )
|
||||
{
|
||||
// например, можно сделать: return !isCoolingDown
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user