private static GameObject SetupButtons(BirthdayChildPanel bdPanel, Transform panel) { GameObject btnContainer = new GameObject("ButtonContainer", typeof(CanvasRenderer), typeof(RectTransform), typeof(HorizontalLayoutGroup)); btnContainer.transform.SetParent(panel); HorizontalLayoutGroup hGroup = btnContainer.GetComponent <HorizontalLayoutGroup>(); hGroup.spacing = 20; hGroup.childAlignment = TextAnchor.MiddleCenter; GameObject acceptButtonObj = panel.Find("ApplyButton").gameObject; GameObject rejectButtonObj = GameObject.Instantiate(acceptButtonObj); acceptButtonObj.GetComponentInChildren <Text>().text = Localization.GetText("witchy_PlannedParenthood_BirthdayPanelAcceptText"); rejectButtonObj.GetComponentInChildren <Text>().text = Localization.GetText("witchy_PlannedParenthood_BirthdayPanelRejectText"); acceptButtonObj.transform.SetParent(btnContainer.transform); rejectButtonObj.transform.SetParent(btnContainer.transform); acceptButtonObj.transform.GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(() => { PlannedParenthoodMod.AcceptClicked(bdPanel); })); rejectButtonObj.transform.GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(() => { PlannedParenthoodMod.RejectClicked(bdPanel); })); return(btnContainer); }
public static bool ClosePrefix(BirthdayChildPanel __instance) { PlannedParenthoodMod.RejectClicked(__instance); return(false); }