Made the call event function more reliable

I have no idea why the function was set up the way it was before but it should be fine now.
This commit is contained in:
Slaith 2022-02-27 10:49:06 -08:00
parent c50bb43cfa
commit 8501e4805c
2 changed files with 9 additions and 8 deletions

View file

@ -41,9 +41,11 @@ namespace RhythmHeavenMania
List<Minigames.Minigame> minigamesInBeatmap = new List<Minigames.Minigame>();
for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++)
{
if (!minigamesInBeatmap.Contains(minigames.Find(c => c.name == GameManager.instance.Beatmap.entities[i].datamodel.Split('/')[0])) && !FXOnlyGames().Contains(GetMinigame(GameManager.instance.Beatmap.entities[i].datamodel.Split('/')[0])))
//go through every entity in the timeline and add the game that they're from to the minigamesInBeatmap list (ignore entities from FX only categories, i.e. Game Manager and Count-Ins)
Minigames.Minigame game = GetMinigame(GameManager.instance.Beatmap.entities[i].datamodel.Split('/')[0]);
if (!minigamesInBeatmap.Contains(game) && !FXOnlyGames().Contains(game))
{
minigamesInBeatmap.Add(minigames.Find(c => c.name == GameManager.instance.Beatmap.entities[i].datamodel.Split('/')[0]));
minigamesInBeatmap.Add(game);
}
}
@ -59,14 +61,13 @@ namespace RhythmHeavenMania
currentEntity.beat = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].beat;
}
public void CallEvent(string event_)
public void CallEvent(Beatmap.Entity entity)
{
string[] details = event_.Split('/');
string[] details = entity.datamodel.Split('/');
Minigames.Minigame game = minigames.Find(c => c.name == details[0]);
try
{
currentEntity = (Beatmap.Entity)GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].Clone();
currentEntity = entity;
if (details.Length > 2) currentSwitchGame = details[2];

View file

@ -162,7 +162,7 @@ namespace RhythmHeavenMania
// FX entities should ALWAYS execute before gameplay entities
for (int i = 0; i < fxEntities.Count; i++)
{
eventCaller.CallEvent(fxEntities[i].datamodel);
eventCaller.CallEvent(fxEntities[i]);
currentEvent++;
}
@ -174,7 +174,7 @@ namespace RhythmHeavenMania
{
PreloadGame(entitesAtSameBeat[i].datamodel.Split('/')[0]);
}
eventCaller.CallEvent(entitesAtSameBeat[i].datamodel);
eventCaller.CallEvent(entitesAtSameBeat[i]);
// Thank you to @shshwdr for bring this to my attention
currentEvent++;