Skip to content

Commit

Permalink
Merge pull request #283 from BUTR/code-formatting/fix-codeformatting
Browse files Browse the repository at this point in the history
Automated PR to fix formatting errors
  • Loading branch information
Aragas authored Feb 6, 2024
2 parents 6ca1200 + cec16dd commit 54638a6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Bannerlord.UIExtenderEx/Patches/GauntletMoviePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ internal static class GauntletMoviePatch
private static readonly ConcurrentDictionary<UIExtenderRuntime, List<string>> _widgetNames = new();
private static readonly ConcurrentDictionary<Type, Type[]> _widgetChildCache = new();
private static readonly AccessTools.FieldRef<GeneratedPrefabContext, Dictionary<string, Dictionary<string, CreateGeneratedWidget>>>? _generatedPrefabs =
AccessTools2.FieldRefAccess<GeneratedPrefabContext, Dictionary<string, Dictionary<string, CreateGeneratedWidget>>>("_generatedPrefabs");
AccessTools2.FieldRefAccess<GeneratedPrefabContext, Dictionary<string, Dictionary<string, CreateGeneratedWidget>>>("_generatedPrefabs");

public static void Register(UIExtenderRuntime runtime, string? autoGenWidgetName)
{
if (string.IsNullOrEmpty(autoGenWidgetName))
Expand Down Expand Up @@ -73,7 +73,7 @@ static IEnumerable<Type> GetChildWidgets(Type widgetType)
var autoGenNames = widgetNames.Where(x => x.Contains("__"));
return autoGenNames.Select(x => x.Split(["__"], StringSplitOptions.None)[0]);
}
}
}
/* This implementation actually created the Widget, but it seems that game didn't intend for that
var variantName = datasource == null ? "Default" : datasource.GetType().FullName;
var data = datasource == null ? new Dictionary<string, object>() : new() { {"DataSource", datasource} };
Expand All @@ -88,16 +88,16 @@ static IEnumerable<Type> GetChildWidgets(Type widgetType)
var autoGenNames = widgetNames.Where(x => x.Contains("__")).ToArray();
return autoGenNames.Select(x => x.Split(["__"], StringSplitOptions.None)[0]);
}
*/
*/

return Enumerable.Empty<string>();
}

var moviesPatched = new HashSet<string>(UIExtender.GetAllRuntimes().SelectMany(x => x.PrefabComponent.GetMoviesToPatch()));
var moviesInvolved = new HashSet<string>(GetAllInvolvedAutoGenNames(widgetFactory, movieName, datasource));
if (moviesInvolved.Overlaps(moviesPatched))
doNotUseGeneratedPrefabs = true;
doNotUseGeneratedPrefabs = true;

var moviesBlacklisted = _widgetNames.SelectMany(kv => kv.Value);
if (moviesBlacklisted.Contains(movieName))
doNotUseGeneratedPrefabs = true;
Expand Down

0 comments on commit 54638a6

Please sign in to comment.