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

@ -443,6 +443,8 @@ namespace HeavenStudio.Games
public override void OnGameSwitch(double beat) // stole code from manzai
{
FindNextGameswitchBeat(beat);
PersistColor(beat);
foreach(var entity in GameManager.instance.Beatmap.Entities)
{
@ -464,6 +466,8 @@ namespace HeavenStudio.Games
{
bgTypeNext = BGType.None;
FindNextGameswitchBeat(beat);
PersistColor(beat);
}
private void FindNextGameswitchBeat(double beat)
@ -1306,6 +1310,17 @@ namespace HeavenStudio.Games
}
}
private void PersistColor(double beat)
{
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("sumoBrothers", new string[] { "background color" }).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];
BackgroundColor(lastEvent.beat, lastEvent.length, lastEvent["colorFrom"], lastEvent["colorTo"], lastEvent["colorFrom2"], lastEvent["colorTo2"], lastEvent["ease"]);
}
}
}
}