public static void FancyScrollAlbumRebuildChildrenPrefix(FancyScrollView __instance) { if (__instance.name == "FancyScrollAlbum") { // 创建自定义谱面的Album按键 GameObject custom = GameObject.Instantiate(__instance.content.GetChild(0).gameObject); custom.name = "ImgAlbumCustom"; RectTransform transform = (RectTransform)custom.transform; transform.name = "ImgAlbumCustom"; var text = transform.GetChild(1).GetComponent <UnityEngine.UI.Text>(); text.text = "自定义谱面"; transform.GetComponents(typeof(UnityEngine.Object)); //custom.transform.SetSiblingIndex(__instance.content.childCount); custom.transform.SetParent(__instance.content); } }
public static void RebuildChildren(FancyScrollView __instance) { if (__instance.name == "FancyScrollAlbum") { string activeOption = SingletonScriptableObject <LocalizationSettings> .instance.GetActiveOption("Language"); if (GameObject.Find($"ImgAlbumCustom") == null) { // Add new tab gameobject var gameobject = GameObject.Find("ImgAlbumCollection"); GameObject customTab = GameObject.Instantiate(gameobject, gameobject.transform.parent); customTab.name = $"ImgAlbumCustom"; customTab.transform.SetSiblingIndex(2); // CompTrack(gameobject.transform.parent.gameObject); CompTrack(customTab); var a = customTab.GetComponent <VariableBehaviour>(); if (a != null) { ModLogger.Debug($"{a.result}:{a.variable.result} {a.variable}"); } var b = customTab.transform.Find("TxtAlbumTitle"); if (b != null) { b.GetComponent <UnityEngine.UI.Text>().text = language[activeOption]; var l18n = b.GetComponent <Localization>(); foreach (var opt in l18n.optionPairs) { ((TextOption)opt.option).value = language[opt.optionEntry.name]; ModLogger.Debug($" opt:{opt.optionEntry.name} val:{((TextOption)opt.option).value.ToString()}"); } } ModLogger.Debug("Add custom map tab"); } } }