33using BepInEx . Configuration ;
44using HarmonyLib ;
55using System ;
6+ using TMPro ;
67using System . Collections ;
78using System . Collections . Generic ;
89using System . IO ;
@@ -295,7 +296,7 @@ public static void ReplaceGamepadButton()
295296 {
296297 if ( ZInput . instance != null )
297298 {
298- var buttons = ( Dictionary < string , ZInput . ButtonDef > ) typeof ( ZInput ) . GetField ( "m_buttons" , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( ZInput . instance ) ;
299+ var buttons = GetButtonsFromZInput ( ) ;
299300 var bindings = ParseTokens ( ProtectedBindings . Value ) ;
300301
301302 foreach ( KeyValuePair < string , ZInput . ButtonDef > entry in buttons )
@@ -310,11 +311,22 @@ public static void ReplaceGamepadButton()
310311 replacedButtons . Add ( entry . Key ) ;
311312 replacedKey = keyCode ;
312313
313- ZInput . instance . Setbutton ( entry . Key , KeyCode . None ) ;
314+ SetButtonKey ( entry . Key , KeyCode . None ) ;
314315 }
315316 }
316317 }
317318 }
319+
320+ private static void SetButtonKey ( string name , KeyCode keyCode )
321+ {
322+ var buttons = GetButtonsFromZInput ( ) ;
323+ buttons [ name ] . m_key = keyCode ;
324+ }
325+
326+ private static Dictionary < string , ZInput . ButtonDef > GetButtonsFromZInput ( )
327+ {
328+ return ( Dictionary < string , ZInput . ButtonDef > ) typeof ( ZInput ) . GetField ( "m_buttons" , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( ZInput . instance ) ;
329+ }
318330
319331 public static void RestoreGamepadButton ( )
320332 {
@@ -324,8 +336,7 @@ public static void RestoreGamepadButton()
324336 {
325337 foreach ( var button in replacedButtons )
326338 {
327- ZInput . instance . Setbutton ( button , replacedKey ) ;
328-
339+ SetButtonKey ( button , replacedKey ) ;
329340 }
330341 replacedButtons . Clear ( ) ;
331342 replacedKey = KeyCode . None ;
@@ -591,7 +602,7 @@ public class ElementData
591602 public GameObject m_go ;
592603 public Image m_icon ;
593604 public GuiBar m_durability ;
594- public Text m_amount ;
605+ public TextMeshProUGUI m_amount ;
595606 public GameObject m_equiped ;
596607 public GameObject m_queued ;
597608 public GameObject m_selection ;
@@ -985,18 +996,18 @@ private void UpdateIcons(Player player, bool forceUpdate = false)
985996
986997 elementData3 . m_go . transform . localScale = new Vector3 ( ITEM_SCALE , ITEM_SCALE , ITEM_SCALE ) ;
987998 elementData3 . m_go . transform . localPosition = new Vector3 ( x , y , 0f ) ;
988- elementData3 . m_go . transform . Find ( "binding" ) . GetComponent < Text > ( ) . text = ( i + 1 ) . ToString ( ) ;
999+ elementData3 . m_go . transform . Find ( "binding" ) . GetComponent < TextMeshProUGUI > ( ) . text = ( i + 1 ) . ToString ( ) ;
9891000 elementData3 . m_icon = elementData3 . m_go . transform . transform . Find ( "icon" ) . GetComponent < Image > ( ) ;
9901001 elementData3 . m_durability = elementData3 . m_go . transform . Find ( "durability" ) . GetComponent < GuiBar > ( ) ;
991- elementData3 . m_amount = elementData3 . m_go . transform . Find ( "amount" ) . GetComponent < Text > ( ) ;
1002+ elementData3 . m_amount = elementData3 . m_go . transform . Find ( "amount" ) . GetComponent < TextMeshProUGUI > ( ) ;
9921003 elementData3 . m_equiped = elementData3 . m_go . transform . Find ( "equiped" ) . gameObject ;
9931004 elementData3 . m_queued = elementData3 . m_go . transform . Find ( "queued" ) . gameObject ;
9941005 elementData3 . m_selection = elementData3 . m_go . transform . Find ( "selected" ) . gameObject ;
9951006 elementData3 . m_selection . SetActive ( false ) ;
9961007
9971008 if ( EquipWheel . InventoryRow . Value > 1 || EquipWheel . UseItemTypeMatching . Value )
9981009 {
999- elementData3 . m_go . transform . Find ( "binding" ) . GetComponent < Text > ( ) . enabled = false ;
1010+ elementData3 . m_go . transform . Find ( "binding" ) . GetComponent < TextMeshProUGUI > ( ) . enabled = false ;
10001011 }
10011012
10021013 this . m_elements . Add ( elementData3 ) ;
0 commit comments