Add R() extension method
This commit is contained in:
@@ -33,12 +33,12 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPostfix]
|
[PatchPostfix]
|
||||||
public static void Postfix(object __instance, GClass1923 scheme, ProduceView view)
|
public static void Postfix(object __instance, object scheme, ProduceView view)
|
||||||
{
|
{
|
||||||
var instance = new R.ProductionPanelShowSubclass(__instance);
|
var instance = new R.ProductionPanelShowSubclass(__instance);
|
||||||
var productScheme = new R.Scheme(scheme);
|
var productScheme = new R.Scheme(scheme);
|
||||||
|
|
||||||
ValidationInputField searchField = new R.ProductionPanel(instance.ProductionPanel).SeachInputField;
|
ValidationInputField searchField = instance.ProductionPanel.R().SeachInputField;
|
||||||
if (searchField.text.Length > 0 && productScheme.EndProduct.LocalizedName().IndexOf(searchField.text, StringComparison.InvariantCultureIgnoreCase) < 0)
|
if (searchField.text.Length > 0 && productScheme.EndProduct.LocalizedName().IndexOf(searchField.text, StringComparison.InvariantCultureIgnoreCase) < 0)
|
||||||
{
|
{
|
||||||
view.GameObject.SetActive(false);
|
view.GameObject.SetActive(false);
|
||||||
@@ -70,7 +70,7 @@ namespace UIFixes
|
|||||||
if (__instance.method_4().Count() > 2)
|
if (__instance.method_4().Count() > 2)
|
||||||
{
|
{
|
||||||
AreaScreenSubstrate areaScreenSubstrate = __instance.GetComponentInParent<AreaScreenSubstrate>();
|
AreaScreenSubstrate areaScreenSubstrate = __instance.GetComponentInParent<AreaScreenSubstrate>();
|
||||||
LayoutElement layoutElement = new R.AreaScreenSubstrate(areaScreenSubstrate).ContentLayout;
|
LayoutElement layoutElement = areaScreenSubstrate.R().ContentLayout;
|
||||||
layoutElement.minHeight = 750f; // aka areaScreenSubstrate._maxHeight
|
layoutElement.minHeight = 750f; // aka areaScreenSubstrate._maxHeight
|
||||||
areaScreenSubstrate.method_8();
|
areaScreenSubstrate.method_8();
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ namespace UIFixes
|
|||||||
|
|
||||||
// Reset the default behavior
|
// Reset the default behavior
|
||||||
AreaScreenSubstrate areaScreenSubstrate = __instance.GetComponentInParent<AreaScreenSubstrate>();
|
AreaScreenSubstrate areaScreenSubstrate = __instance.GetComponentInParent<AreaScreenSubstrate>();
|
||||||
LayoutElement layoutElement = new R.AreaScreenSubstrate(areaScreenSubstrate).ContentLayout;
|
LayoutElement layoutElement = areaScreenSubstrate.R().ContentLayout;
|
||||||
layoutElement.minHeight = -1f;
|
layoutElement.minHeight = -1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace UIFixes
|
|||||||
Transform ____compactPanel,
|
Transform ____compactPanel,
|
||||||
SimpleTooltip ___simpleTooltip_0)
|
SimpleTooltip ___simpleTooltip_0)
|
||||||
{
|
{
|
||||||
var instance = new R.ItemSpecificationPanel(__instance);
|
var instance = __instance.R();
|
||||||
|
|
||||||
if (!Settings.ShowModStats.Value || ___item_0 is not Mod)
|
if (!Settings.ShowModStats.Value || ___item_0 is not Mod)
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ namespace UIFixes
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var compactPanels = new R.ItemSpecificationPanel(__instance).CompactCharacteristicPanels;
|
var compactPanels = __instance.R().CompactCharacteristicPanels;
|
||||||
R.ItemSpecificationPanel.Refresh(compactPanels, deepAttributes);
|
R.ItemSpecificationPanel.Refresh(compactPanels, deepAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,14 +161,14 @@ namespace UIFixes
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var buttonsContainer = new R.InteractionButtonsContainer(____interactionButtonsContainer);
|
var buttonsContainer = ____interactionButtonsContainer.R();
|
||||||
|
|
||||||
SimpleContextMenuButton toggleButton = null;
|
ContextMenuButton toggleButton = null;
|
||||||
|
|
||||||
// Listen to the setting and the work there to handle multiple windows open at once
|
// Listen to the setting and the work there to handle multiple windows open at once
|
||||||
void onSettingChanged(object sender, EventArgs args)
|
void onSettingChanged(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
var text = new R.ContextMenuButton(toggleButton).Text;
|
var text = toggleButton.R().Text;
|
||||||
text.text = GetLabel();
|
text.text = GetLabel();
|
||||||
|
|
||||||
__instance.method_5(); // rebuild stat panels
|
__instance.method_5(); // rebuild stat panels
|
||||||
@@ -183,7 +183,7 @@ namespace UIFixes
|
|||||||
void createButton()
|
void createButton()
|
||||||
{
|
{
|
||||||
Sprite sprite = CacheResourcesPopAbstractClass.Pop<Sprite>("Characteristics/Icons/Modding");
|
Sprite sprite = CacheResourcesPopAbstractClass.Pop<Sprite>("Characteristics/Icons/Modding");
|
||||||
toggleButton = UnityEngine.Object.Instantiate(buttonsContainer.ButtonTemplate, buttonsContainer.Container, false);
|
toggleButton = (ContextMenuButton)UnityEngine.Object.Instantiate(buttonsContainer.ButtonTemplate, buttonsContainer.Container, false);
|
||||||
toggleButton.Show(GetLabel(), null, sprite, onClick, null);
|
toggleButton.Show(GetLabel(), null, sprite, onClick, null);
|
||||||
____interactionButtonsContainer.method_5(toggleButton); // add to disposable list
|
____interactionButtonsContainer.method_5(toggleButton); // add to disposable list
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ namespace UIFixes
|
|||||||
const string DecreasingColorHex = "#C40000";
|
const string DecreasingColorHex = "#C40000";
|
||||||
|
|
||||||
string text = textMesh.text;
|
string text = textMesh.text;
|
||||||
var wrappedPanel = new R.CompactCharacteristicPanel(panel);
|
var wrappedPanel = panel.R();
|
||||||
ItemAttributeClass attribute = wrappedPanel.ItemAttribute;
|
ItemAttributeClass attribute = wrappedPanel.ItemAttribute;
|
||||||
|
|
||||||
// Holy shit did they mess up MOA. Half of the calculation is done in the StringValue() method, so calculating delta from Base() loses all that
|
// Holy shit did they mess up MOA. Half of the calculation is done in the StringValue() method, so calculating delta from Base() loses all that
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the TraderControllerClass
|
// Get the TraderControllerClass
|
||||||
TraderControllerClass traderControllerClass = new R.GridView(__instance).TraderController;
|
TraderControllerClass traderControllerClass = __instance.R().TraderController;
|
||||||
|
|
||||||
// Check that the destinations won't overlap (Swap won't check this)
|
// Check that the destinations won't overlap (Swap won't check this)
|
||||||
if (!ItemsOverlap(item, itemToAddress, targetItem, targetToAddress))
|
if (!ItemsOverlap(item, itemToAddress, targetItem, targetToAddress))
|
||||||
|
|||||||
13
R.cs
13
R.cs
@@ -1,8 +1,10 @@
|
|||||||
using Aki.Reflection.Utils;
|
using Aki.Reflection.Utils;
|
||||||
using Diz.LanguageExtensions;
|
using Diz.LanguageExtensions;
|
||||||
|
using EFT.Hideout;
|
||||||
using EFT.InputSystem;
|
using EFT.InputSystem;
|
||||||
using EFT.InventoryLogic;
|
using EFT.InventoryLogic;
|
||||||
using EFT.UI;
|
using EFT.UI;
|
||||||
|
using EFT.UI.DragAndDrop;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -308,4 +310,15 @@ namespace UIFixes
|
|||||||
public TextMeshProUGUI Text { get { return (TextMeshProUGUI)TextField.GetValue(Value); } }
|
public TextMeshProUGUI Text { get { return (TextMeshProUGUI)TextField.GetValue(Value); } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RExtentensions
|
||||||
|
{
|
||||||
|
public static R.ProductionPanel R(this ProductionPanel value) => new(value);
|
||||||
|
public static R.AreaScreenSubstrate R(this AreaScreenSubstrate value) => new(value);
|
||||||
|
public static R.ItemSpecificationPanel R(this ItemSpecificationPanel value) => new(value);
|
||||||
|
public static R.CompactCharacteristicPanel R(this CompactCharacteristicPanel value) => new(value);
|
||||||
|
public static R.GridView R(this GridView value) => new(value);
|
||||||
|
public static R.InteractionButtonsContainer R(this InteractionButtonsContainer value) => new(value);
|
||||||
|
public static R.ContextMenuButton R(this ContextMenuButton value) => new(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user