Skip to content

Commit 39d6e56

Browse files
authored
Fixup two search dialog bugs (#564)
1 parent 4299cfa commit 39d6e56

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

src/SerialLoops.Lib/Project.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,17 @@ private bool ItemIsInEpisode(ItemDescription item, int episodeNum, bool unique)
16071607
}
16081608

16091609
private bool ScriptIsInEpisode(ScriptItem script, int scenarioEpIndex, int scenarioNextEpIndex)
1610+
{
1611+
int scriptFileScenarioIndex = GetScriptScenarioIndex(script);
1612+
if (scenarioNextEpIndex < 0)
1613+
{
1614+
scenarioNextEpIndex = int.MaxValue;
1615+
}
1616+
1617+
return scriptFileScenarioIndex > scenarioEpIndex && scriptFileScenarioIndex < scenarioNextEpIndex;
1618+
}
1619+
1620+
private int GetScriptScenarioIndex(ScriptItem script)
16101621
{
16111622
int scriptFileScenarioIndex = Scenario.Commands.FindIndex(c => c.Verb == ScenarioCommand.ScenarioVerb.LOAD_SCENE && c.Parameter == script.Event.Index);
16121623
if (scriptFileScenarioIndex < 0)
@@ -1617,13 +1628,14 @@ private bool ScriptIsInEpisode(ScriptItem script, int scenarioEpIndex, int scena
16171628
{
16181629
scriptFileScenarioIndex = Scenario.Commands.FindIndex(c => c.Verb == ScenarioCommand.ScenarioVerb.ROUTE_SELECT && c.Parameter == ((GroupSelectionItem)groupSelection).Index);
16191630
}
1620-
}
1621-
if (scenarioNextEpIndex < 0)
1622-
{
1623-
scenarioNextEpIndex = int.MaxValue;
1631+
ItemDescription otherScript = references.Find(r => r.Type == ItemType.Script);
1632+
if (otherScript is not null)
1633+
{
1634+
scriptFileScenarioIndex = GetScriptScenarioIndex((ScriptItem)otherScript);
1635+
}
16241636
}
16251637

1626-
return scriptFileScenarioIndex > scenarioEpIndex && scriptFileScenarioIndex < scenarioNextEpIndex;
1638+
return scriptFileScenarioIndex;
16271639
}
16281640

16291641
[GeneratedRegex(@"\((?<num>\d+)\)")]

src/SerialLoops/Assets/Strings.Designer.cs

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SerialLoops/Assets/Strings.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,4 +3336,13 @@ item in the dropdown!</value>
33363336
<data name="PuzzleEditorUnknown04" xml:space="preserve">
33373337
<value>Unknown 04</value>
33383338
</data>
3339+
<data name="Title" xml:space="preserve">
3340+
<value>Title</value><comment>Search scope</comment>
3341+
</data>
3342+
<data name="Flag" xml:space="preserve">
3343+
<value>Flag</value><comment>Search scope</comment>
3344+
</data>
3345+
<data name="Conditional" xml:space="preserve">
3346+
<value>Search scope</value>
3347+
</data>
33393348
</root>

src/SerialLoops/ViewModels/Dialogs/SearchDialogViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public class LocalizedItemScope(ItemDescription.ItemType type) : ReactiveObject
201201
{
202202
public ItemDescription.ItemType Type { get; } = type;
203203
public string Icon => $"avares://SerialLoops/Assets/Icons/{Type.ToString()}.svg";
204-
public string DisplayText { get; } = Strings.ResourceManager.GetString($"{type.ToString()}s");
204+
public string DisplayText { get; } = Strings.ResourceManager.GetString($"ItemsPanel{type.ToString().Replace("_", "")}s");
205205
[Reactive]
206206
public bool IsActive { get; set; } = true;
207207
}

0 commit comments

Comments
 (0)