public static bool ShowPrefix(BirthdayChildPanel __instance, HumanAI child)
        {
            Transform panel = __instance.transform.GetChild(0);

            if (panel.Find("ButtonContainer") == null)
            {
                PlannedParenthoodMod.SetupBirthdayPanel(__instance);
            }

            __instance.descriptionText.text = String.Format(Localization.GetText("witchy_PlannedParenthood_BirthdayPanelText"), child.father.GetFullName(), child.mother.GetFullName());

            String randomGirlName = HumanManager.GetRandomHumanNamePart(false, Gender.Female);
            String randomBoyName  = HumanManager.GetRandomHumanNamePart(false, Gender.Male);
            String lastName       = (UnityEngine.Random.Range(0f, 1f) < 0.5f) ? child.mother.lastName : child.father.lastName;

            panel.Find("GirlPanel").GetComponentInChildren <InputField>().text = $"{randomGirlName} {lastName}";
            panel.Find("BoyPanel").GetComponentInChildren <InputField>().text  = $"{randomBoyName} {lastName}";

            PlannedParenthoodMod.InputChanged(__instance);

            AccessTools.Field(typeof(BirthdayChildPanel), "child").SetValue(__instance, child);

            __instance.gameObject.SetActive(true);

            return(false);
        }
        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);
        }
        private static GameObject SetupBoyPanel(BirthdayChildPanel bdPanel, Transform panel)
        {
            GameObject boyWrapper = new GameObject("BoyPanel", typeof(CanvasRenderer), typeof(RectTransform), typeof(VerticalLayoutGroup));

            boyWrapper.transform.SetParent(panel);

            VerticalLayoutGroup vGroup = boyWrapper.GetComponent <VerticalLayoutGroup>();

            vGroup.spacing               = 5;
            vGroup.childAlignment        = TextAnchor.UpperCenter;
            vGroup.childControlHeight    = true;
            vGroup.childControlWidth     = true;
            vGroup.childForceExpandWidth = true;

            GameObject boyLabel = new GameObject("BoyLabel", typeof(CanvasRenderer), typeof(RectTransform), typeof(Text));

            Text txtBoy = boyLabel.GetComponent <Text>();

            txtBoy.alignment = TextAnchor.MiddleLeft;
            txtBoy.color     = Color.white;
            txtBoy.font      = bdPanel.descriptionText.font;
            txtBoy.fontSize  = bdPanel.descriptionText.fontSize;
            txtBoy.text      = Localization.GetText("witchy_PlannedParenthood_BirthdayPanelBoyLabel");

            boyLabel.transform.SetParent(boyWrapper.transform);

            GameObject boyInput = panel.Find("InputField").gameObject;

            boyInput.name = "BoyInput";
            boyInput.gameObject.GetComponent <InputField>().onValueChanged.AddListener(new UnityEngine.Events.UnityAction <string>((x) => PlannedParenthoodMod.InputChanged(bdPanel)));
            boyInput.transform.SetParent(boyWrapper.transform);

            return(boyWrapper);
        }
        private static GameObject SetupGirlPanel(BirthdayChildPanel bdPanel, Transform panel, GameObject boyWrapper)
        {
            GameObject girlWrapper = GameObject.Instantiate(boyWrapper, panel);

            girlWrapper.name = "GirlPanel";

            GameObject girlLabel = girlWrapper.transform.GetChild(0).gameObject;

            girlLabel.name = "GirlLabel";
            girlLabel.GetComponent <Text>().text = Localization.GetText("witchy_PlannedParenthood_BirthdayPanelGirlLabel");

            GameObject girlInput = girlWrapper.transform.GetChild(1).gameObject;

            girlInput.name = "GirlInput";
            girlInput.gameObject.GetComponent <InputField>().onValueChanged.AddListener(new UnityEngine.Events.UnityAction <string>((x) => PlannedParenthoodMod.InputChanged(bdPanel)));

            return(girlWrapper);
        }
 public static bool ClosePrefix(BirthdayChildPanel __instance)
 {
     PlannedParenthoodMod.RejectClicked(__instance);
     return(false);
 }