public void SetupViewController() { playButtonGlow = playButton.GetComponent <Glowable>(); levelDetailsRect.gameObject.AddComponent <Mask>(); Image maskImage = levelDetailsRect.gameObject.AddComponent <Image>(); maskImage.material = Sprites.NoGlowMat; maskImage.sprite = Resources.FindObjectsOfTypeAll <Sprite>().First(x => x.name == "RoundRectPanel"); maskImage.type = Image.Type.Sliced; maskImage.color = new Color(0f, 0f, 0f, 0.25f); levelCoverImage.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); progressBarBG.color = new Color(1f, 1f, 1f, 0.2f); progressBarTop.color = new Color(1f, 1f, 1f, 1f); charactertisticControlBlocker.color = new Color(1f, 1f, 1f, 0f); difficultyControlBlocker.color = new Color(1f, 1f, 1f, 0f); cancellationToken = new CancellationTokenSource(); _defaultArtworkTexture = Resources.FindObjectsOfTypeAll <Texture2D>().First(x => x.name == "DefaultSongArtwork"); _playerDataModel = Resources.FindObjectsOfTypeAll <PlayerDataModelSO>().First(); }
public void SetupViewController() { playNowButtonGlow = playNowButton.GetComponent <Glowable>(); levelDetailsRect.gameObject.AddComponent <Mask>(); Image maskImage = levelDetailsRect.gameObject.AddComponent <Image>(); maskImage.material = Sprites.NoGlowMat; maskImage.sprite = Resources.FindObjectsOfTypeAll <Sprite>().First(x => x.name == "RoundRectPanel"); maskImage.type = Image.Type.Sliced; maskImage.color = new Color(0f, 0f, 0f, 0.25f); levelCoverImage.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); progressBarBG.color = new Color(1f, 1f, 1f, 0.2f); progressBarTop.color = new Color(1f, 1f, 1f, 1f); //_beatmapLevelsModel = Resources.FindObjectsOfTypeAll<BeatmapLevelsModel>().First(); _defaultArtworkTexture = Resources.FindObjectsOfTypeAll <Texture2D>().First(x => x.name == "DefaultSongArtwork"); _playerDataModel = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First(); leaderboardTableView.GetComponent <TableView>().RemoveReusableCells("Cell"); if (selectedLevel != null) { SetSong(selectedLevel, selectedBeatmapCharacteristic, selectedDifficulty); } }
public override GameObject CreateObject(Transform parent) { Button button = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <Button>().Last(x => (x.name == "PageDownButton")), parent, false); button.gameObject.SetActive(false); button.name = "BSMLPageButton"; button.interactable = true; button.gameObject.AddComponent <PageButton>(); LayoutElement layoutElement = button.gameObject.AddComponent <LayoutElement>(); layoutElement.preferredWidth = -1; layoutElement.preferredHeight = -1; layoutElement.flexibleHeight = 0; layoutElement.flexibleWidth = 0; ContentSizeFitter sizeFitter = button.gameObject.AddComponent <ContentSizeFitter>(); sizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; RectTransform buttonTransform = button.transform.GetChild(0) as RectTransform; buttonTransform.anchorMin = new Vector2(0, 0); buttonTransform.anchorMax = new Vector2(1, 1); buttonTransform.sizeDelta = new Vector2(0, 0); (button.transform as RectTransform).pivot = new Vector2(.5f, .5f); RectTransform glow = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <GameObject>().Last(x => (x.name == "GlowContainer")), button.transform).transform as RectTransform; glow.gameObject.name = "BSMLPageButtonGlowContainer"; glow.SetParent(buttonTransform); glow.anchorMin = new Vector2(0, 0); glow.anchorMax = new Vector2(1, 1); glow.sizeDelta = new Vector2(0, 0); glow.anchoredPosition = new Vector2(0, 0); Glowable glowable = button.gameObject.AddComponent <Glowable>(); glowable.image = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Glow").FirstOrDefault(); glowable.SetGlow("none"); ButtonIconImage btnIcon = button.gameObject.AddComponent <ButtonIconImage>(); btnIcon.image = button.gameObject.GetComponentsInChildren <Image>(true).Where(x => x.gameObject.name == "Arrow").FirstOrDefault(); button.gameObject.SetActive(true); 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); }