global usings, some reflection, part 1

This commit is contained in:
Tyfon
2024-07-11 19:17:09 -07:00
parent 5343ab5e0b
commit 8ad0b8c5f7
19 changed files with 134 additions and 112 deletions

6
R.cs
View File

@@ -26,6 +26,7 @@ namespace UIFixes
// Order is significant, as some reference each other
UIElement.InitUITypes();
UIInputNode.InitUITypes();
UIContext.InitTypes();
DialogWindow.InitTypes();
ControlSettings.InitTypes();
@@ -135,14 +136,17 @@ namespace UIFixes
{
public static Type Type { get; private set; }
private static FieldInfo SearchInputFieldField;
private static FieldInfo ProductionBuildsField;
public static void InitTypes()
{
Type = typeof(EFT.Hideout.ProductionPanel);
SearchInputFieldField = AccessTools.Field(Type, "_searchInputField");
ProductionBuildsField = AccessTools.GetDeclaredFields(Type).Single(t => t.FieldType.GetElementType() == typeof(ProductionBuildAbstractClass));
}
public ValidationInputField SeachInputField { get { return (ValidationInputField)SearchInputFieldField.GetValue(Value); } }
public ProductionBuildAbstractClass[] ProductionBuilds { get { return (ProductionBuildAbstractClass[])ProductionBuildsField.GetValue(Value); } }
}
public class ProductionPanelShowSubclass(object value) : Wrapper(value)
@@ -270,7 +274,7 @@ namespace UIFixes
private static FieldInfo NonInteractableField;
private static FieldInfo HighlightPanelField;
private static FieldInfo ValidMoveColorField;
private static FieldInfo InvalidOperationColorField;
private static FieldInfo InvalidOperationColorField;
public static void InitTypes()
{
Type = typeof(EFT.UI.DragAndDrop.GridView);