Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make chibis enter in the right order with enter/exit command #213

Merged
merged 1 commit into from
Jun 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/SerialLoops/Editors/ScriptEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,18 +1547,35 @@ private void UpdatePreview()
{
if (((ChibiEnterExitScriptParameter)commands[i].Parameters[1]).Mode == ChibiEnterExitScriptParameter.ChibiEnterExitType.ENTER)
{
if (!chibis.Contains(((ChibiScriptParameter)commands[i].Parameters[0]).Chibi))
ChibiItem chibi = ((ChibiScriptParameter)commands[i].Parameters[0]).Chibi;
if (!chibis.Contains(chibi))
{
ChibiItem chibi = ((ChibiScriptParameter)commands[i].Parameters[0]).Chibi;
if (!chibis.Contains(chibi))
if (chibi.ChibiIndex < 1 || chibis.Count == 0)
{
chibis.Add(chibi);
}
else
{
_log.LogWarning($"Chibi {chibi.Name} set to join, but already was present");
bool inserted = false;
for (int j = 0; j < chibis.Count; j++)
{
if (chibis[j].ChibiIndex > chibi.ChibiIndex)
{
chibis.Insert(j, chibi);
inserted = true;
break;
}
}
if (!inserted)
{
chibis.Add(chibi);
}
}
}
else
{
_log.LogWarning($"Chibi {chibi.Name} set to join, but already was present");
}
}
else
{
Expand Down