removed TryGetSound + made some SoundSpecifier datafields required
This commit is contained in:
@@ -59,10 +59,7 @@ namespace Content.Client.Disposal.Visualizers
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
_flushAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
if (_flushSound.TryGetSound(out var flushSound))
|
||||
{
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(flushSound, 0));
|
||||
}
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound.GetSound(), 0));
|
||||
}
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
|
||||
@@ -55,10 +55,7 @@ namespace Content.Client.Doors
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
CloseAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
if (_closeSound.TryGetSound(out var closeSound))
|
||||
{
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(closeSound, 0));
|
||||
}
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_closeSound.GetSound(), 0));
|
||||
}
|
||||
|
||||
OpenAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)};
|
||||
@@ -81,10 +78,7 @@ namespace Content.Client.Doors
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
OpenAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
if (_openSound.TryGetSound(out var openSound))
|
||||
{
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(openSound, 0));
|
||||
}
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_openSound.GetSound(), 0));
|
||||
}
|
||||
|
||||
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(0.3f)};
|
||||
@@ -97,10 +91,7 @@ namespace Content.Client.Doors
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
DenyAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
if (_denySound.TryGetSound(out var denySound))
|
||||
{
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(denySound, 0, () => AudioHelpers.WithVariation(0.05f)));
|
||||
}
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_denySound.GetSound(), 0, () => AudioHelpers.WithVariation(0.05f)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Client.Light.Visualizers
|
||||
{
|
||||
[DataField("minBlinkingTime")] private float _minBlinkingTime = 0.5f;
|
||||
[DataField("maxBlinkingTime")] private float _maxBlinkingTime = 2;
|
||||
[DataField("blinkingSound")] private SoundSpecifier _blinkingSound = default!;
|
||||
[DataField("blinkingSound", required: true)] private SoundSpecifier _blinkingSound = default!;
|
||||
|
||||
private bool _wasBlinking;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Content.Client.Light.Visualizers
|
||||
var randomTime = random.NextFloat() *
|
||||
(_maxBlinkingTime - _minBlinkingTime) + _minBlinkingTime;
|
||||
|
||||
var blinkingAnim = new Animation()
|
||||
var blinkingAnim = new Animation()
|
||||
{
|
||||
Length = TimeSpan.FromSeconds(randomTime),
|
||||
AnimationTracks =
|
||||
@@ -123,18 +123,15 @@ namespace Content.Client.Light.Visualizers
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
if (_blinkingSound.TryGetSound(out var blinkingSound))
|
||||
blinkingAnim.AnimationTracks.Add(new AnimationTrackPlaySound()
|
||||
{
|
||||
blinkingAnim.AnimationTracks.Add(new AnimationTrackPlaySound()
|
||||
KeyFrames =
|
||||
{
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackPlaySound.KeyFrame(blinkingSound, 0.5f)
|
||||
}
|
||||
});
|
||||
}
|
||||
new AnimationTrackPlaySound.KeyFrame(_blinkingSound.GetSound(), 0.5f)
|
||||
}
|
||||
});
|
||||
|
||||
return blinkingAnim;
|
||||
}
|
||||
|
||||
@@ -24,16 +24,14 @@ namespace Content.Client.PDA
|
||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession? session = null)
|
||||
{
|
||||
base.HandleNetworkMessage(message, netChannel, session);
|
||||
switch(message)
|
||||
switch (message)
|
||||
{
|
||||
case PDAUplinkBuySuccessMessage:
|
||||
if(BuySuccessSound.TryGetSound(out var buySuccessSound))
|
||||
SoundSystem.Play(Filter.Local(), buySuccessSound, Owner, AudioParams.Default.WithVolume(-2f));
|
||||
SoundSystem.Play(Filter.Local(), BuySuccessSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||
break;
|
||||
|
||||
case PDAUplinkInsufficientFundsMessage:
|
||||
if(InsufficientFundsSound.TryGetSound(out var insufficientFundsSound))
|
||||
SoundSystem.Play(Filter.Local(), insufficientFundsSound, Owner, AudioParams.Default);
|
||||
SoundSystem.Play(Filter.Local(), InsufficientFundsSound.GetSound(), Owner, AudioParams.Default);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Client.Trigger
|
||||
{
|
||||
private const string AnimationKey = "priming_animation";
|
||||
|
||||
[DataField("countdown_sound", required: true)]
|
||||
[DataField("countdown_sound")]
|
||||
private SoundSpecifier _countdownSound = default!;
|
||||
|
||||
private Animation PrimingAnimation = default!;
|
||||
@@ -29,12 +29,9 @@ namespace Content.Client.Trigger
|
||||
flick.LayerKey = TriggerVisualLayers.Base;
|
||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("primed", 0f));
|
||||
|
||||
if (_countdownSound.TryGetSound(out var countdownSound))
|
||||
{
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
PrimingAnimation.AnimationTracks.Add(sound);
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(countdownSound, 0));
|
||||
}
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
PrimingAnimation.AnimationTracks.Add(sound);
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_countdownSound.GetSound(), 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user