public override GameObject CreateObject(Transform parent) { Button button = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "SoloFreePlayButton")), parent, false); button.name = "BSMLBigButton"; button.interactable = true; Object.Destroy(button.GetComponent <HoverHint>()); Object.Destroy(button.GetComponent <LocalizedHoverHint>()); Polyglot.LocalizedTextMeshProUGUI localizer = button.GetComponentInChildren <Polyglot.LocalizedTextMeshProUGUI>(); if (localizer != null) { Object.Destroy(localizer); } button.gameObject.AddComponent <ExternalComponents>().components.Add(button.GetComponentInChildren <TextMeshProUGUI>()); Image strokeImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Stroke").FirstOrDefault(); if (strokeImage != null) { Strokable strokable = button.gameObject.AddComponent <Strokable>(); strokable.image = strokeImage; strokable.SetType(StrokeType.Regular); } Image iconImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Icon").FirstOrDefault(); if (iconImage != null) { ButtonIconImage btnIcon = button.gameObject.AddComponent <ButtonIconImage>(); btnIcon.image = iconImage; } Image artworkImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "BGArtwork").FirstOrDefault(); if (artworkImage != null) { ButtonArtworkImage btnArt = button.gameObject.AddComponent <ButtonArtworkImage>(); btnArt.image = artworkImage; } return(button.gameObject); }
public override GameObject CreateObject(Transform parent) { Button button = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == (parent.GetComponent <StartMiddleEndButtonsGroup>() == null ? "PlayButton" : "CreditsButton"))), parent, false); button.name = "BSMLButton"; button.interactable = true; Polyglot.LocalizedTextMeshProUGUI localizer = button.GetComponentInChildren <Polyglot.LocalizedTextMeshProUGUI>(); if (localizer != null) { GameObject.Destroy(localizer); } ExternalComponents externalComponents = button.gameObject.AddComponent <ExternalComponents>(); externalComponents.components.Add(button.GetComponentInChildren <TextMeshProUGUI>()); HorizontalLayoutGroup horiztonalLayoutGroup = button.GetComponentInChildren <HorizontalLayoutGroup>(); if (horiztonalLayoutGroup != null) { externalComponents.components.Add(horiztonalLayoutGroup); } Image glowImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Glow").FirstOrDefault(); if (glowImage != null) { Glowable glowable = button.gameObject.AddComponent <Glowable>(); glowable.image = glowImage; glowable.SetGlow("none"); } Image strokeImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Stroke").FirstOrDefault(); if (strokeImage != null) { Strokable strokable = button.gameObject.AddComponent <Strokable>(); strokable.image = strokeImage; strokable.SetType(StrokeType.Regular); } return(button.gameObject); }
public override GameObject CreateObject(Transform parent) { Button button = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "PracticeButton" && x.transform.parent.name == "PlayButtons")), parent, false); button.name = "BSMLIconButton"; button.interactable = true; Object.Destroy(button.GetComponent <HoverHint>()); Object.Destroy(button.GetComponent <LocalizedHoverHint>()); button.gameObject.AddComponent <ExternalComponents>().components.Add(button.GetComponentsInChildren <HorizontalLayoutGroup>().First(x => x.name == "Content")); Image glowImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Glow").FirstOrDefault(); if (glowImage != null) { Glowable glowable = button.gameObject.AddComponent <Glowable>(); glowable.image = glowImage; glowable.SetGlow("none"); } Image strokeImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Stroke").FirstOrDefault(); if (strokeImage != null) { Strokable strokable = button.gameObject.AddComponent <Strokable>(); strokable.image = strokeImage; strokable.SetType(StrokeType.Regular); } Image iconImage = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Icon").FirstOrDefault(); if (iconImage != null) { ButtonIconImage btnIcon = button.gameObject.AddComponent <ButtonIconImage>(); btnIcon.image = iconImage; } return(button.gameObject); }