public static void Init(UnityModManager.ModEntry modEntry) { GameObject updateActorMenu = new GameObject(); GameObject.DontDestroyOnLoad(updateActorMenu); ActorMenuActorListPatch.updateActorMenu = updateActorMenu.AddComponent <IEnumeratorActorMenuOpend>(); }
public static void Init(UnityModManager.ModEntry modEntry) { GameObject updateActorMenu = new GameObject(); GameObject.DontDestroyOnLoad(updateActorMenu); ActorMenuActorListPatch.updateActorMenu = updateActorMenu.AddComponent <IEnumeratorActorMenuOpend>(); //增加点击事件 GameObject health = ActorMenu.instance.healthText.gameObject; Button btn = health.GetComponent <Button>(); if (!btn) { btn = health.AddComponent <Button>(); } var onclick = btn.onClick; onclick.RemoveAllListeners(); onclick.AddListener(delegate { ActorMenuInjuryPatch.AddHealth(); }); }