コード例 #1
0
ファイル: ButtonAPI.cs プロジェクト: VRCMG/IceBurn
        public static Transform CreateMenuNestedButton(string text, string tooltip, Color textColor, Color backgroundColor, float x_pos, float y_pos, Transform parent)
        {
            var       quickMenu = Wrappers.GetQuickMenu();
            Transform menu      = InstantiateGameobject("menu");

            menu.name = $"MENU_INDEX_{x_pos}_{y_pos}";

            CreateButton(ButtonType.Default, text, tooltip, textColor, backgroundColor, x_pos, y_pos, parent, new Action(() =>
            {
                ButtonAPI.ShowCustomMenu(menu.name);
            }));

            IEnumerator enumerator = menu.transform.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Il2CppSystem.Object obj     = enumerator.Current;
                Transform           btnEnum = obj.Cast <Transform>();
                if (btnEnum != null)
                {
                    UnityEngine.Object.Destroy(btnEnum.gameObject);
                }
            }

            CreateButton(ButtonType.Default, "Back", "Go Back to the previous menu", Color.cyan, Color.white, 4, 2, menu, new Action(() => { ButtonAPI.ShowCustomMenu($"MENU_INDEX_0_0"); }));

            return(menu);
        }
コード例 #2
0
            internal static void Prefix(MonkeySelectMenu __instance, Il2CppSystem.Object data)
            {
                if (!reOpening)
                {
                    var towerSets = new List <string>(__instance.TowerSets);
                    foreach (var modTowerSet in ModContent.GetContent <ModTowerSet>())
                    {
                        var towerSetIndex = modTowerSet.GetTowerSetIndex(towerSets);
                        towerSets.Insert(towerSetIndex, modTowerSet.Id);
                    }
                    __instance.TowerSets = towerSets.ToArray();
                }

                if (data == null)
                {
                    menu = null;

                    var model = Game.instance.model;
                    foreach (var set in __instance.TowerSets)
                    {
                        Offsets[set]      = 0;
                        TowersInSets[set] = model.towerSet.Where(details =>
                                                                 model.GetTowerFromId(details.towerId).towerSet == set).ToList();
                        TotalSpotses[set] = ((TowersInSets[set].Count - 1) / 8 + 1) * 8;
                    }
                }

                if (!reOpening)
                {
                    CreatePips(__instance);
                    CreateCustomButtons(__instance);
                }
            }
コード例 #3
0
 internal static void Postfix(MonkeySelectMenu __instance, Il2CppSystem.Object data)
 {
     menu = __instance;
     UpdateTowerSet(__instance);
     UpdatePips();
 }