File tree Expand file tree Collapse file tree
Code/MethodSystem/Methods/AudioMethods Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using JetBrains . Annotations ;
2+ using SER . Code . ArgumentSystem . Arguments ;
3+ using SER . Code . ArgumentSystem . BaseArguments ;
4+ using SER . Code . Exceptions ;
5+ using SER . Code . MethodSystem . BaseMethods . Synchronous ;
6+ using SER . Code . MethodSystem . MethodDescriptors ;
7+ using SER . Code . ValueSystem ;
8+
9+ namespace SER . Code . MethodSystem . Methods . AudioMethods ;
10+
11+ [ UsedImplicitly ]
12+ public class IsPlayingAudioMethod : ReturningMethod < BoolValue > , ICanError
13+ {
14+ public override string Description => "Checks if the audio player is playing anything." ;
15+
16+ public string [ ] ErrorReasons =>
17+ [
18+ "Speaker doesn't exist."
19+ ] ;
20+
21+ public override Argument [ ] ExpectedArguments { get ; } =
22+ [
23+ new TextArgument ( "speaker name" )
24+ ] ;
25+
26+ public override void Execute ( )
27+ {
28+ var speakerName = Args . GetText ( "speaker name" ) ;
29+ if ( ! AudioPlayer . TryGet ( speakerName , out var speaker ) )
30+ throw new ScriptRuntimeError ( this , $ "Speaker '{ speakerName } ' doesn't exist.") ;
31+
32+ ReturnValue = ! speaker . ClipsById . IsEmpty ( ) ;
33+ }
34+
35+ }
You can’t perform that action at this time.
0 commit comments