quick mr upbeat fix (#547)

This commit is contained in:
AstrlJelly 2023-09-17 13:34:46 -04:00 committed by GitHub
parent 607ae9b542
commit b6d2e2d355
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,9 +28,9 @@ namespace HeavenStudio.Games.Loaders
}, },
new GameAction("ding", "Ding!") new GameAction("ding", "Ding!")
{ {
preFunction = delegate { preFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
MrUpbeat.Ding(e.beat, e["toggle"], e["stopBlipping"], e["playDing"]); MrUpbeat.Ding(e.beat, e["toggle"], e["stopBlipping"], e["playDing"]);
}, },
defaultLength = 0.5f, defaultLength = 0.5f,
parameters = new List<Param>() parameters = new List<Param>()
@ -45,7 +45,7 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
MrUpbeat.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["toggle"]); MrUpbeat.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["toggle"]);
}, },
resizable = true, resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
@ -58,8 +58,8 @@ namespace HeavenStudio.Games.Loaders
new GameAction("upbeatColors", "Upbeat Colors") new GameAction("upbeatColors", "Upbeat Colors")
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
MrUpbeat.instance.UpbeatColors(e["blipColor"], e["setShadow"], e["shadowColor"]); MrUpbeat.instance.UpbeatColors(e["blipColor"], e["setShadow"], e["shadowColor"]);
}, },
defaultLength = 0.5f, defaultLength = 0.5f,
parameters = new List<Param>() parameters = new List<Param>()
@ -72,8 +72,8 @@ namespace HeavenStudio.Games.Loaders
new GameAction("blipEvents", "Blip Events") new GameAction("blipEvents", "Blip Events")
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
MrUpbeat.instance.BlipEvents(e["letter"], e["shouldGrow"], e["resetBlip"], e["shouldBlip"]); MrUpbeat.instance.BlipEvents(e["letter"], e["shouldGrow"], e["resetBlip"], e["shouldBlip"]);
}, },
defaultLength = 0.5f, defaultLength = 0.5f,
parameters = new List<Param>() parameters = new List<Param>()
@ -129,7 +129,7 @@ namespace HeavenStudio.Games
using Jukebox; using Jukebox;
public class MrUpbeat : Minigame public class MrUpbeat : Minigame
{ {
public enum Counts public enum Counts
{ {
One, One,
Two, Two,
@ -219,16 +219,17 @@ namespace HeavenStudio.Games
public static void Ding(double beat, bool applause, bool stopBlipping, bool playDing) public static void Ding(double beat, bool applause, bool stopBlipping, bool playDing)
{ {
instance.stopStepping = true; BeatAction.New(instance, new List<BeatAction.Action>() {
if (stopBlipping) instance.stopBlipping = true; new BeatAction.Action(beat - 0.5, delegate {
instance.stopStepping = true;
if (stopBlipping) instance.stopBlipping = true;
}),
new BeatAction.Action(beat + 0.5, delegate {
instance.stopStepping = false;
}),
});
if (playDing) SoundByte.PlayOneShotGame("mrUpbeat/ding", beat: beat, forcePlay: true); if (playDing) SoundByte.PlayOneShotGame("mrUpbeat/ding", beat: beat, forcePlay: true);
if (applause) SoundByte.PlayOneShot("applause", beat: beat); if (applause) SoundByte.PlayOneShot("applause", beat: beat);
BeatAction.New(instance, new List<BeatAction.Action>() {
new BeatAction.Action(beat + 0.5, delegate {
instance.stopStepping = false;
instance.stopBlipping = false;
})
});
} }
public static void PrePrepare(double beat, float length, bool forceOffbeat) public static void PrePrepare(double beat, float length, bool forceOffbeat)
@ -256,7 +257,7 @@ namespace HeavenStudio.Games
SoundByte.PlayOneShotGame("mrUpbeat/metronome" + dir); SoundByte.PlayOneShotGame("mrUpbeat/metronome" + dir);
ScheduleInput(beat, 0.5f, InputType.STANDARD_DOWN, Success, Miss, Nothing); ScheduleInput(beat, 0.5f, InputType.STANDARD_DOWN, Success, Miss, Nothing);
BeatAction.New(this, new List<BeatAction.Action>() { BeatAction.New(this, new List<BeatAction.Action>() {
new BeatAction.Action(beat + 1, delegate { RecursiveStepping(beat + 1); }) new(beat + 1, delegate { RecursiveStepping(beat + 1); })
}); });
stepIterate++; stepIterate++;
} }
@ -341,7 +342,7 @@ namespace HeavenStudio.Games
public static void Count(int number) public static void Count(int number)
{ {
SoundByte.PlayOneShotGame("mrUpbeat/"+ (number < 4 ? number + 1 : "a"), forcePlay: true); SoundByte.PlayOneShotGame("mrUpbeat/" + (number < 4 ? number + 1 : "a"), forcePlay: true);
} }
public static void CountIn(double beat, float length, bool a) public static void CountIn(double beat, float length, bool a)
@ -349,12 +350,12 @@ namespace HeavenStudio.Games
var sound = new List<MultiSound.Sound>(); var sound = new List<MultiSound.Sound>();
if (a) sound.Add(new MultiSound.Sound("mrUpbeat/a", beat - (0.5f * (length/4)))); if (a) sound.Add(new MultiSound.Sound("mrUpbeat/a", beat - (0.5f * (length/4))));
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
sound.Add(new MultiSound.Sound("mrUpbeat/" + (i + 1), beat + (i * (length/4)), offset: (i == 3 ? 0.05 : 0))); sound.Add(new MultiSound.Sound("mrUpbeat/" + (i + 1), beat + (i * (length / 4)), offset: (i == 3) ? 0.05 : 0));
} }
MultiSound.Play(sound.ToArray(), forcePlay: true); MultiSound.Play(sound.ToArray(), forcePlay: true);
} }
public void Nothing(PlayerActionEvent caller) {} public void Nothing(PlayerActionEvent caller) { }
} }
} }