Queue in JukeBox (#640)

* Queue in JukeBox

* Translation JukeBox
This commit is contained in:
Jabak
2024-08-19 21:11:35 +03:00
committed by GitHub
parent 92d98cea55
commit b6d3c050a0
10 changed files with 388 additions and 83 deletions

View File

@@ -35,7 +35,7 @@ public sealed class JukeboxSystem : SharedJukeboxSystem
var query = AllEntityQuery<JukeboxComponent, UserInterfaceComponent>();
while (query.MoveNext(out _, out var ui))
while (query.MoveNext(out var uid, out var jukebox, out var ui))
{
if (!ui.OpenInterfaces.TryGetValue(JukeboxUiKey.Key, out var baseBui) ||
baseBui is not JukeboxBoundUserInterface bui)
@@ -43,6 +43,24 @@ public sealed class JukeboxSystem : SharedJukeboxSystem
continue;
}
if (obj.Removed?.TryGetValue(typeof(JukeboxPrototype), out var removed) ?? false)
{
var list = new List<ProtoId<JukeboxPrototype>>();
while (jukebox.SongIdQueue.Count > 0)
{
var next = jukebox.SongIdQueue.Dequeue();
if (removed.Contains(next))
continue;
list.Add(next);
}
foreach (var song in list)
{
jukebox.SongIdQueue.Enqueue(song);
}
}
bui.PopulateMusic();
}
}