public void Init(ModInfoViewController controller) { this.controller = controller; var rectTransform = transform as RectTransform; rectTransform.sizeDelta = new Vector2(60f, 10f); titleText = BeatSaberUI.CreateText(rectTransform, $"{controller.Name} <size=60%>{controller.Version}", new Vector2(11f, 27.5f)); titleText.fontSize = 6f; authorText = BeatSaberUI.CreateText(rectTransform, controller.Author, new Vector2(11f, 22f)); authorText.fontSize = 4.5f; descText = BeatSaberUI.CreateText(rectTransform, controller.Description, new Vector2(-4.5f, 12f)); descText.fontSize = 3.5f; descText.enableWordWrapping = true; descText.overflowMode = TextOverflowModes.ScrollRect; icon = new GameObject("Mod Info View Icon", typeof(RectTransform)).AddComponent <Image>(); icon.gameObject.SetActive(false); icon.rectTransform.SetParent(rectTransform, false); icon.rectTransform.anchorMin = new Vector2(0.5f, 0.44f); icon.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); icon.rectTransform.sizeDelta = new Vector2(60f, 10f); icon.rectTransform.anchoredPosition = new Vector2(-27.8f, 27.3f); icon.sprite = controller.Icon; icon.preserveAspect = true; icon.useSpriteMesh = true; icon.material = UIUtilities.NoGlowMaterial; icon.gameObject.SetActive(true); }
public void Init(ModInfoViewController controller) { this.controller = controller; var rectTransform = transform as RectTransform; rectTransform.sizeDelta = new Vector2(60f, 10f); titleText = BeatSaberUI.CreateText(rectTransform, string.Format(TitleFormat, controller.Name, controller.Version), new Vector2(11f, 27.5f)); titleText.fontSize = 6f; authorText = BeatSaberUI.CreateText(rectTransform, controller.Author, new Vector2(11f, 22f)); authorText.fontSize = 4.5f; var mdvgo = new GameObject("MarkDown Desc"); mdvgo.SetActive(false); mdv = mdvgo.AddComponent <MarkdownView>(); mdv.rectTransform.SetParent(rectTransform); mdv.rectTransform.anchorMin = new Vector2(.5f, .5f); mdv.rectTransform.anchorMax = new Vector2(.5f, .5f); mdv.rectTransform.anchoredPosition = new Vector2(-4f, -3.6f); mdv.rectTransform.sizeDelta = new Vector2(65f, 40f); mdvgo.SetActive(true); mdv.Markdown = controller.Description; icon = new GameObject("Mod Info View Icon", typeof(RectTransform)).AddComponent <Image>(); icon.gameObject.SetActive(false); icon.rectTransform.SetParent(rectTransform, false); icon.rectTransform.anchorMin = new Vector2(0.5f, 0.44f); icon.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); icon.rectTransform.sizeDelta = new Vector2(60f, 10f); icon.rectTransform.anchoredPosition = new Vector2(-27.8f, 27.3f); icon.sprite = controller.Icon; icon.preserveAspect = true; icon.useSpriteMesh = true; icon.material = CustomUI.Utilities.UIUtilities.NoGlowMaterial; icon.gameObject.SetActive(true); }