mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
Add searching by tags
This commit is contained in:
parent
1e1166b607
commit
5dd1e98c70
2 changed files with 15 additions and 2 deletions
|
|
@ -43,6 +43,11 @@ namespace Dalamud.Plugin
|
|||
/// </summary>
|
||||
public string RepoUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of tanks defined on the plugin.
|
||||
/// </summary>
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the plugin is hidden in the plugin installer.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ namespace Dalamud.Plugin
|
|||
}
|
||||
else {
|
||||
var didAny = false;
|
||||
var didAnyWithSearch = false;
|
||||
var hasSearchString = !string.IsNullOrWhiteSpace(this.searchText);
|
||||
|
||||
foreach (var pluginDefinition in this.dalamud.PluginRepository.PluginMaster) {
|
||||
|
|
@ -85,13 +86,18 @@ namespace Dalamud.Plugin
|
|||
if (pluginDefinition.DalamudApiLevel != PluginManager.DALAMUD_API_LEVEL)
|
||||
continue;
|
||||
|
||||
didAny = true;
|
||||
|
||||
if (hasSearchString &&
|
||||
!(pluginDefinition.Name.ToLowerInvariant().Contains(this.searchText.ToLowerInvariant()) ||
|
||||
string.Equals(pluginDefinition.Author, this.searchText, StringComparison.InvariantCultureIgnoreCase))) {
|
||||
string.Equals(pluginDefinition.Author, this.searchText, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
pluginDefinition.Tags != null &&
|
||||
pluginDefinition.Tags.Contains(this.searchText.ToLowerInvariant(), StringComparer.InvariantCultureIgnoreCase)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
didAny = true;
|
||||
didAnyWithSearch = true;
|
||||
|
||||
ImGui.PushID(pluginDefinition.InternalName + pluginDefinition.AssemblyVersion);
|
||||
|
||||
|
|
@ -190,6 +196,8 @@ namespace Dalamud.Plugin
|
|||
|
||||
if (!didAny)
|
||||
ImGui.TextColored(new Vector4(0.70f, 0.70f, 0.70f, 1.00f), Loc.Localize("InstallerNoCompatible", "No compatible plugins were found :( Please restart your game and try again."));
|
||||
else if (!didAnyWithSearch)
|
||||
ImGui.TextColored(new Vector4(0.7f, 0.7f, 0.7f, 1.0f), Loc.Localize("InstallNoMatching", "No plugins were found matching your search."));
|
||||
}
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue