public static void Postfix(OptionsMenuBehaviour __instance) { if ((streamerModeButton == null || streamerModeButton.gameObject == null) && __instance.CensorChatButton != null) { streamerModeButton = UnityEngine.Object.Instantiate(__instance.CensorChatButton, __instance.CensorChatButton.transform.parent); streamerModeButton.transform.localPosition += Vector3.down * 0.25f; __instance.CensorChatButton.transform.localPosition += Vector3.up * 0.25f; PassiveButton button = streamerModeButton.GetComponent <PassiveButton>(); button.OnClick = new Button.ButtonClickedEvent(); button.OnClick.AddListener((UnityEngine.Events.UnityAction)onClick); updateStreamerModeButton(); } void onClick() { TheOtherRolesPlugin.StreamerMode.Value = !TheOtherRolesPlugin.StreamerMode.Value; updateStreamerModeButton(); } }
private static void InitializeMoreButton(OptionsMenuBehaviour __instance) { __instance.BackButton.transform.localPosition += Vector3.right * 1.8f; moreOptions = Object.Instantiate(buttonPrefab, __instance.CensorChatButton.transform.parent); moreOptions.transform.localPosition = __instance.CensorChatButton.transform.localPosition + Vector3.down * 0.5f; moreOptions.gameObject.SetActive(true); moreOptions.Text.text = ModTranslation.getString("modOptionsText"); var moreOptionsButton = moreOptions.GetComponent <PassiveButton>(); moreOptionsButton.OnClick = new ButtonClickedEvent(); moreOptionsButton.OnClick.AddListener((Action)(() => { if (!popUp) { return; } if (__instance.transform.parent && __instance.transform.parent == HudManager.Instance.transform) { popUp.transform.SetParent(HudManager.Instance.transform); popUp.transform.localPosition = new Vector3(0, 0, -800f); } else { popUp.transform.SetParent(null); Object.DontDestroyOnLoad(popUp); } CheckSetTitle(); RefreshOpen(); })); var leaveGameButton = GameObject.Find("LeaveGameButton"); if (leaveGameButton != null) { leaveGameButton.transform.localPosition += (Vector3.right * 1.3f); } }