public static void Initialize() { Page = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList); Page.AddLabel("Title", new Action <GameObject>((obj) => { titleObject = obj; })); Page.AddLabel("Waiting for key...", new Action <GameObject>((obj) => { textObject = obj; })); Page.AddSimpleButton("Clear", new Action(() => { selectedKeys.Clear(); })); Page.AddSimpleButton("Accept", new Action(() => { AcceptAction?.Invoke(selectedKeys); fetchingKeys = false; Page.Hide(); })); Page.AddSimpleButton("Cancel", new Action(() => { CancelAction?.Invoke(); fetchingKeys = false; Page.Hide(); })); }
public void DefaultsMenu(bool useBigMenu) { ICustomShowableLayoutedMenu mirrorLayerMenu = null; mirrorLayerMenu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column_Longer); mirrorLayerMenu.AddLabel("Set Default Layer Mask On World Join"); mirrorLayerMenu.AddToggleButton("Set on Join", b => setMaskOnJoin.Value = b, () => setMaskOnJoin.Value); //mirrorLayerMenu.AddLabel($"Mask: {defaultMask.Value}"); mirrorLayerMenu.AddSpacer(); mirrorLayerMenu.AddSpacer(); mirrorLayerMenu.AddSimpleButton($"Enable All", () => { defaultMask.Value = -1; UpdateButtons(defaultMask.Value); }); mirrorLayerMenu.AddSimpleButton($"Disable All", () => { defaultMask.Value = 0; UpdateButtons(defaultMask.Value); }); foreach (KeyValuePair <int, string> entry in layerList) { mirrorLayerMenu.AddLabel($"Layer #{entry.Key} {(IsLayerEnabled(defaultMask.Value, entry.Key) ? "++++++++" : "-----------")} \n{entry.Value}", (button) => buttonList[entry.Key] = button.transform); mirrorLayerMenu.AddSimpleButton($"Enable", () => { defaultMask.Value = defaultMask.Value | (1 << entry.Key); UpdateButtons(defaultMask.Value); }); //Remove Layer mirrorLayerMenu.AddSimpleButton($"Disable", () => { defaultMask.Value = defaultMask.Value & ~(1 << entry.Key); UpdateButtons(defaultMask.Value); }); //Add Layer } mirrorLayerMenu.AddSimpleButton($"Close", () => { mirrorLayerMenu.Hide(); }); mirrorLayerMenu.AddSimpleButton($"Back", () => { EditMirrorLayersMenu(useBigMenu, null); }); mirrorLayerMenu.Show(); }
private static void ColorMenuAdj() { ICustomShowableLayoutedMenu Menu = null; Menu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row); foreach (KeyValuePair <string, float> entry in colorList) { string c = entry.Key; Menu.AddSimpleButton($"{(c)} -", () => { colorList[c] = Clamp(entry.Value - 10, 0, 100); Menu.Hide(); ColorMenuAdj(); }); Menu.AddSimpleButton($"{(c)} - 0/100", () => { if (colorList[c] != 0f) { colorList[c] = 0f; } else { colorList[c] = 100f; } Menu.Hide(); ColorMenuAdj(); }); Menu.AddSimpleButton($"{(c)} +", () => { colorList[c] = Clamp(colorList[c] + 10, 0, 100); Menu.Hide(); ColorMenuAdj(); }); } Menu.AddSimpleButton($"<-Back", () => { CamSettingsMenu(); }); Menu.AddLabel($"R:{colorList["Red"]}\nG:{colorList["Green"]}\nB:{colorList["Blue"]}"); camColor.Value = new Color(colorList["Red"] / 100, colorList["Green"] / 100, colorList["Blue"] / 100); Menu.Show(); }
public override void Init() { AvatarInfoMenuButton = MelonPreferences.CreateEntry("UserInfoExtensionsSettings", nameof(AvatarInfoMenuButton), true, "Show \"Avatar Info Menu\" button in Avatar Menu"); ExpansionKitApi.GetExpandedMenu(ExpandedMenu.AvatarMenu).AddSimpleButton("Avatar Info Menu", new Action(() => { avatarInfoMenu?.Show(); OnMenuShown(); }), new Action <GameObject>((go) => { avatarInfoMenuButtonGameObject = go; GetAvatarAuthor.avatarPage.GetComponent <EnableDisableListener>().OnDisabled += new Action(() => avatarInfoMenu?.Hide()); })); avatarInfoMenu = ExpansionKitApi.CreateCustomFullMenuPopup(new LayoutDescription() { RowHeight = 80, NumColumns = 3, NumRows = 5 }); avatarInfoMenu.AddLabel("Avatar information:"); avatarInfoMenu.AddSpacer(); avatarInfoMenu.AddSimpleButton("Back", new Action(() => avatarInfoMenu.Hide())); avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => authorNameLabel = gameObject.transform.GetChild(0).GetComponent <Text>())); avatarInfoMenu.AddSimpleButton("Show Avatar Description", new Action(() => { avatarInfoMenu.Hide(); UiManager.OpenSmallPopup("Description:", avatar.description == null ? "" : avatar.description, "Close", UiManager.ClosePopup); })); avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => avatarNameLabel = gameObject.transform.GetChild(0).GetComponent <Text>())); avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => platformLabel = gameObject.transform.GetChild(0).GetComponent <Text>())); avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => releaseTypeLabel = gameObject.transform.GetChild(0).GetComponent <Text>())); avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => lastUpdatedLabel = gameObject.transform.GetChild(0).GetComponent <Text>())); avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => VersionLabel = gameObject.transform.GetChild(0).GetComponent <Text>())); }
public void ColorMenuAdj(bool useBigMenu) { ICustomShowableLayoutedMenu Menu = null; Menu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column4Row) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row); string[] colorList = { "Red", "Green", "Blue" }; for (int i = 0; i < colorList.GetLength(0); i++) { string c = colorList[i].Substring(0, 1); Menu.AddSimpleButton($"{(colorList[i])} -", () => { category.GetEntry <float>($"CubeColor{c}").Value = Clamp(category.GetEntry <float>($"CubeColor{c}").Value - 10, 0, 100); OnPreferencesSaved(); Menu.Hide(); ColorMenuAdj(useBigMenu); }); Menu.AddSimpleButton($"{(colorList[i])} -0-", () => { category.GetEntry <float>($"CubeColor{c}").Value = 0f; OnPreferencesSaved(); Menu.Hide(); ColorMenuAdj(useBigMenu); }); Menu.AddSimpleButton($"{(colorList[i])} +", () => { category.GetEntry <float>($"CubeColor{c}").Value = Clamp(category.GetEntry <float>($"CubeColor{c}").Value + 10, 0, 100); OnPreferencesSaved(); Menu.Hide(); ColorMenuAdj(useBigMenu); }); } Menu.AddSimpleButton("Color Adj\n----\nBack", () => { CubeMenu(useBigMenu); }); Menu.AddLabel($"R:{category.GetEntry<float>("CubeColorR").Value}\nG:{category.GetEntry<float>("CubeColorG").Value}\nB:{category.GetEntry<float>("CubeColorB").Value}"); Menu.Show(); }
private static void ShowWorlds() { ICustomShowableLayoutedMenu worldsPermissionsPopup = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList); if (WorldPermissionHandler.BlacklistedWorlds.Count > 0) { worldsPermissionsPopup.AddLabel("Blacklisted Worlds"); foreach (WorldPermissionHandler.PermissionEntry blacklistedWorld in WorldPermissionHandler.BlacklistedWorlds) { worldsPermissionsPopup.AddSimpleButton( blacklistedWorld.WorldName, () => { worldsPermissionsPopup.Hide(); WorldPermissionHandler.RemoveFromBlacklist(blacklistedWorld.WorldId); WorldPermissionHandler.SaveSettings(); ShowWorlds(); }); } worldsPermissionsPopup.AddSpacer(); } worldsPermissionsPopup.AddSimpleButton("Close", () => worldsPermissionsPopup.Hide()); worldsPermissionsPopup.Show(); }
public void ViewMirrorLayers(bool useBigMenu) { ICustomShowableLayoutedMenu mirrorLayerView = null; mirrorLayerView = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescription.WideSlimList); mirrorLayerView.AddLabel("All mirrors in world\n Layer format is 'Layer:E/D' E - Enabled, D-Disabled"); foreach (var vrcMirrorReflection in UnityEngine.Object.FindObjectsOfType <VRC_MirrorReflection>()) { mirrorLayerView.AddSimpleButton($"Edit Mirror: {vrcMirrorReflection.gameObject.name}", () => { EditMirrorLayersMenu(useBigMenu, vrcMirrorReflection); }); mirrorLayerView.AddLabel($"Path: {GetHierarchyPath(vrcMirrorReflection.gameObject.transform)}"); mirrorLayerView.AddLabel($"{FindLayerString(vrcMirrorReflection.m_ReflectLayers.value)}"); } mirrorLayerView.AddSimpleButton($"Back", () => { EditMirrorLayersMenu(useBigMenu, null); }); mirrorLayerView.AddSimpleButton($"Close", () => { mirrorLayerView.Hide(); }); mirrorLayerView.Show(); }
private static void ShowUsers() { ICustomShowableLayoutedMenu userPermissionsPopup = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList); if (UserPermissionHandler.BlacklistedUsers.Count > 0) { userPermissionsPopup.AddLabel("Blacklisted Users"); foreach (UserPermissionHandler.PermissionEntry blacklistedUser in UserPermissionHandler.BlacklistedUsers) { userPermissionsPopup.AddSimpleButton( blacklistedUser.DisplayName, () => { userPermissionsPopup.Hide(); UserPermissionHandler.RemoveFromBlacklist(blacklistedUser.UserId); UserPermissionHandler.SaveSettings(); ShowUsers(); }); } userPermissionsPopup.AddSpacer(); } if (UserPermissionHandler.WhitelistedUsers.Count > 0) { userPermissionsPopup.AddLabel("Whitelisted Users"); foreach (UserPermissionHandler.PermissionEntry whitelistedUser in UserPermissionHandler.WhitelistedUsers) { userPermissionsPopup.AddSimpleButton( whitelistedUser.DisplayName, () => { userPermissionsPopup.Hide(); UserPermissionHandler.RemoveFromWhitelist(whitelistedUser.UserId); UserPermissionHandler.SaveSettings(); ShowUsers(); }); } userPermissionsPopup.AddSpacer(); } userPermissionsPopup.AddSimpleButton("Close", () => userPermissionsPopup.Hide()); userPermissionsPopup.Show(); }
public void initMenus() { ExpansionKitApi.GetExpandedMenu(ExpandedMenu.CameraQuickMenu).AddSimpleButton("Resolution", delegate() { camMenu.Show(); }); settingsMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescription.WideSlimList); settingsMenu.AddLabel("\nChange Resolutions"); settingsMenu.AddSimpleButton("Add Resolution", delegate() { MelonCoroutines.Start(addCam()); }); settingsMenu.AddSimpleButton("Delete Resolution", delegate() { MelonCoroutines.Start(removeCam()); }); settingsMenu.AddLabel("\nChange Default Settings"); settingsMenu.AddSimpleButton("Default Aspect Ratio", delegate() { MelonCoroutines.Start(ChangeDefaultAspectRatio()); }); settingsMenu.AddSimpleButton("Default Resolution", delegate() { MelonCoroutines.Start(ChangeDefaultRes()); }); settingsMenu.AddSimpleButton("Clipping Planes", delegate() { MelonCoroutines.Start(ChangeClipSetting()); }); settingsMenu.AddSpacer(); settingsMenu.AddSimpleButton("Back", delegate() { settingsMenu.Hide(); }); loadCamMenu(); }
public override void OnApplicationStart() { Instance = this; CacheManager.Init(); foreach (MethodInfo method in typeof(MenuController).GetMethods().Where(mi => mi.Name.StartsWith("Method_Public_Void_APIUser_") && !mi.Name.Contains("_PDM_"))) { HarmonyInstance.Patch(method, postfix: new HarmonyMethod(typeof(UserInfoExtensionsMod).GetMethod("OnUserInfoOpen", BindingFlags.Static | BindingFlags.Public))); } HarmonyInstance.Patch(AccessTools.Method(typeof(PageUserInfo), "Back"), postfix: new HarmonyMethod(typeof(UserInfoExtensionsMod).GetMethod("OnUserInfoClose", BindingFlags.Static | BindingFlags.Public))); LayoutDescription popupLayout = new LayoutDescription { RowHeight = 80, NumColumns = 3, NumRows = 5 }; menu = ExpansionKitApi.CreateCustomFullMenuPopup(popupLayout); userDetailsMenu = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserDetailsMenu); menu.AddLabel("General Things"); menu.AddSpacer(); menu.AddSimpleButton("Back", () => menu.Hide()); userDetailsMenu.AddSimpleButton("UserInfoExtensions", () => { HideAllPopups(); menu.Show(); foreach (ModuleBase module in modules) { module.OnUIXMenuOpen(); } }); AddModule(new QuickMenuFromSocial()); AddModule(new GetAvatarAuthor()); AddModule(new BioButtons()); AddModule(new UserInformation()); AddModule(new AvatarInformation()); VRCUtils.OnUiManagerInit += OnUiManagerInit; MelonLogger.Msg("Initialized!"); }
public void EditMirrorLayersMenu(bool useBigMenu, VRC_MirrorReflection mirror) { ICustomShowableLayoutedMenu mirrorLayerMenu = null; mirrorLayerMenu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column_Longer); if (mirror is null) { mirrorLayerMenu.AddLabel("Enable/Disable Layers on All Mirrors in a world"); } else { mirrorLayerMenu.AddLabel("Enable/Disable Layers on specific mirror:"); } if (mirror is null) { mirrorLayerMenu.AddSimpleButton($"All to Full", () => { SetSingleLayerOnMirrors(0, 10, mirror); }); } else { mirrorLayerMenu.AddLabel($"{mirror.gameObject.name}"); } if (mirror is null) { mirrorLayerMenu.AddSimpleButton($"All to Optimized", () => { SetSingleLayerOnMirrors(0, 11, mirror); }); } else { mirrorLayerMenu.AddLabel($"{GetHierarchyPath(mirror.gameObject.transform)}"); } mirrorLayerMenu.AddSimpleButton($"View Mirrors", () => { ViewMirrorLayers(useBigMenu); }); if (mirror is null) { mirrorLayerMenu.AddSimpleButton($"Enable All", () => { SetSingleLayerOnMirrors(0, 5, mirror); }); } else { mirrorLayerMenu.AddSimpleButton($"Enable All", () => { SetSingleLayerOnMirrors(0, 5, mirror); UpdateButtons(mirror.m_ReflectLayers); }); } if (mirror is null) { mirrorLayerMenu.AddSimpleButton($"Disable All", () => { SetSingleLayerOnMirrors(0, 6, mirror); }); } else { mirrorLayerMenu.AddSimpleButton($"Disable All", () => { SetSingleLayerOnMirrors(0, 6, mirror); UpdateButtons(mirror.m_ReflectLayers); }); } foreach (KeyValuePair <int, string> entry in layerList) { if (mirror is null) { mirrorLayerMenu.AddLabel($"Layer #{entry.Key} ----------- \n{entry.Value}"); mirrorLayerMenu.AddSimpleButton($"Enable", () => { SetSingleLayerOnMirrors(entry.Key, 1, mirror); }); mirrorLayerMenu.AddSimpleButton($"Disable", () => { SetSingleLayerOnMirrors(entry.Key, 0, mirror); }); } else { //If editing solo mirror, show current state on lables mirrorLayerMenu.AddLabel($"Layer #{entry.Key} {(IsLayerEnabled(mirror.m_ReflectLayers.value, entry.Key) ? "++++++++" : "-----------")} \n{entry.Value}", (button) => buttonList[entry.Key] = button.transform); //mirrorLayerMenu.AddToggleButton($"Enable", b => { // if (b) // SetSingleLayerOnMirrors(entry.Key, 1, mirror); // else // SetSingleLayerOnMirrors(entry.Key, 0, mirror); //}, () => IsLayerEnabled(mirror.m_ReflectLayers.value, entry.Key)); mirrorLayerMenu.AddSimpleButton($"Enable", () => { SetSingleLayerOnMirrors(entry.Key, 1, mirror); UpdateButtons(mirror.m_ReflectLayers.value); }); mirrorLayerMenu.AddSimpleButton($"Disable", () => { SetSingleLayerOnMirrors(entry.Key, 0, mirror); UpdateButtons(mirror.m_ReflectLayers.value); }); } } mirrorLayerMenu.AddSimpleButton($"View Mirrors", () => { ViewMirrorLayers(useBigMenu); }); mirrorLayerMenu.AddSimpleButton($"Close", () => { mirrorLayerMenu.Hide(); }); if (mirror is null) { mirrorLayerMenu.AddSimpleButton($"Defaults Menu", () => { DefaultsMenu(useBigMenu); }); } else { mirrorLayerMenu.AddSimpleButton($"Back", () => { EditMirrorLayersMenu(useBigMenu, null); }); } mirrorLayerMenu.Show(); }