Color Persistence for Nightly Games (#881)

Added color persistence between game switches for most of the games in the nightly that needed it:
- Basketball Girls
- Bouncy Road
- Chameleon
- Clap Trap
- Fillbots
- Frog Princess
- Sick Beats
- Sumo Brothers

Slot Monster has none yet, because its color changing is a little different lol
This commit is contained in:
wookywok
2024-04-19 14:16:16 -05:00
committed by GitHub
parent 973f5f18ee
commit 37ebc3c9af
8 changed files with 166 additions and 0 deletions

View File

@ -238,6 +238,7 @@ namespace HeavenStudio.Games
public override void OnPlay(double beat)
{
PersistColor(beat);
if (queuedBots.Count > 0) queuedBots.Clear();
foreach (var evt in scheduledInputs)
{
@ -548,6 +549,37 @@ namespace HeavenStudio.Games
metersFuel[i].color = colorEases[i+1].GetColor();
}
}
private void PersistColor(double beat)
{
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("fillbots", new string[] { "background appearance" }).FindAll(x => x.beat < beat);
if (allEventsBeforeBeat.Count > 0)
{
allEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case
var lastEvent = allEventsBeforeBeat[^1];
BackgroundColorSet(lastEvent.beat, lastEvent.length, lastEvent["colorBGStart"], lastEvent["colorBGEnd"], lastEvent["colorMetersStart"],
lastEvent["colorMeter1Start"], lastEvent["colorMeter2Start"],
lastEvent["colorMeter3Start"], lastEvent["colorMeter4Start"],
lastEvent["colorMeter5Start"], lastEvent["colorMeter6Start"],
lastEvent["colorMetersEnd"], lastEvent["colorMeter1End"],
lastEvent["colorMeter2End"], lastEvent["colorMeter3End"],
lastEvent["colorMeter4End"], lastEvent["colorMeter5End"], lastEvent["colorMeter6End"],
lastEvent["separate"], lastEvent["ease"]);
}
var allEventsBeforeBeatObj = EventCaller.GetAllInGameManagerList("fillbots", new string[] { "object appearance" }).FindAll(x => x.beat < beat);
if (allEventsBeforeBeatObj.Count > 0)
{
allEventsBeforeBeatObj.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case
var lastEventObj = allEventsBeforeBeatObj[^1];
ObjectColorSet(lastEventObj["colorFuel"], lastEventObj["colorLampOff"], lastEventObj["colorLampOn"], lastEventObj["colorImpact"], lastEventObj["colorFiller"], lastEventObj["colorConveyor"]);
}
}
public override void OnGameSwitch(double beat)
{
PersistColor(beat);
}
}
}