public override void VRChat_OnUiManagerInit() { ClassInjector.RegisterTypeInIl2Cpp <EnableDisableListener>(); Config.RegisterSettings(); // Initialize Constants util Constants.UIInit(); LoadAssetBundle(); // Initialize UIManager UIManager.Init(); // Initialize submenu for the list MenuManager.CreateMainSubMenu(); // TODO: Add opacity options, maybe color too, (maybe even for each stage of ping and fps??) MenuManager.AddMenuListeners(); MenuManager.CreateSubMenus(); PlayerEntry.Patch(Harmony); EntryManager.AddGeneralInfoEntries(); MenuManager.CreateGeneralInfoSubMenus(); MenuManager.AdjustSubMenus(); // Initialize on leave and join events NetworkHooks.NetworkInit(); NetworkHooks.OnPlayerJoin += new Action <Player>((player) => OnPlayerJoin(player)); NetworkHooks.OnPlayerLeave += new Action <Player>((player) => OnPlayerLeave(player)); MelonLogger.Msg("Initialized!"); }
public void OnUiManagerInit() { // Initialize Constants util Constants.UIInit(); // TODO: Add opacity options, maybe color too, (maybe even for each stage of ping and fps??) // TODO: add indicator for those in hearing distance MenuManager.LoadAssetBundle(); // Initialize submenu for the list MenuManager.CreateMainSubMenu(); // This is kinda a mess but whatever MenuManager.AddMenuListeners(); MenuManager.CreateSortPages(); MenuManager.CreateSubMenus(); EntryManager.AddGeneralInfoEntries(); MenuManager.CreateGeneralInfoSubMenus(); MenuManager.AdjustSubMenus(); PlayerListConfig.OnConfigChange(false); MelonLogger.Msg("Initialized!"); }
public override void OnUpdate() { EntryManager.OnUpdate(); if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F1) || Input.GetKeyDown(KeyCode.LeftControl) && Input.GetKey(KeyCode.F1)) { MenuManager.ToggleMenu(); } }
public override void OnUpdate() { if (timer.Elapsed.TotalSeconds > 1) { timer.Restart(); EntryManager.RefreshAllEntries(); } if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F1) || Input.GetKeyDown(KeyCode.LeftControl) && Input.GetKey(KeyCode.F1)) { MenuManager.ToggleMenu(); } }
public static void CreateSubMenus() { // Initialize Movement menu playerListMenus.Add(new SubMenu("UserInterface/QuickMenu", "PlayerListMenuPage2")); new SingleButton(playerListMenus[1].gameObject, new Vector3(3, 0), "Edit PlayerList Position", new Action(ListPositionManager.MovePlayerList), "Click to edit the position of the PlayerList", "EditPlayerListPosButton", true); new SingleButton(playerListMenus[1].gameObject, new Vector3(3, 1), "Move to Right of QuickMenu", new Action(ListPositionManager.MovePlayerListToEndOfMenu), "Move PlayerList to right side of menu, this can also serve as a reset position button", "LockPlayerListToRightButton", true); new QuarterButton(playerListMenus[1].gameObject, new Vector3(3, 2), new Vector2(0, 0), "1", new Action(() => PlayerListConfig.menuButtonPosition.Value = MenuButtonPositionEnum.TopRight), "Move PlayerList menu button to the top right", "1PlayerListMenuButton"); new QuarterButton(playerListMenus[1].gameObject, new Vector3(3, 2), new Vector2(1, 0), "2", new Action(() => PlayerListConfig.menuButtonPosition.Value = MenuButtonPositionEnum.TopLeft), "Move PlayerList menu button to the top left", "2PlayerListMenuButton"); new QuarterButton(playerListMenus[1].gameObject, new Vector3(3, 2), new Vector2(1, 1), "3", new Action(() => PlayerListConfig.menuButtonPosition.Value = MenuButtonPositionEnum.BottomLeft), "Move PlayerList menu button to the bottom left", "3PlayerListMenuButton"); new QuarterButton(playerListMenus[1].gameObject, new Vector3(3, 2), new Vector2(0, 1), "4", new Action(() => PlayerListConfig.menuButtonPosition.Value = MenuButtonPositionEnum.BottomRight), "Move PlayerList menu button to the bottom right", "4PlayerListMenuButton"); new SingleButton(playerListMenus[1].gameObject, new Vector3(1, 0), "Snap Grid\nSize +", new Action(() => PlayerListConfig.snapToGridSize.Value += 10), "Increase the size of the snap to grid by 10", "IncreaseSnapGridSize", true); new SingleButton(playerListMenus[1].gameObject, new Vector3(1, 2), "Snap Grid\nSize -", new Action(() => PlayerListConfig.snapToGridSize.Value -= 10), "Decrease the size of the snap to grid by 10", "DecreaseSnapGridSize", true); new SingleButton(playerListMenus[1].gameObject, new Vector3(0, 0), "Reset Snap\nGrid Size", new Action(() => PlayerListConfig.snapToGridSize.Value = 420), "Set snap to grid to the default value (420)", "DefaultSnapGridSize", true); ListPositionManager.snapToGridSizeLabel = new Label(playerListMenus[1].gameObject, new Vector3(1, 1), $"Snap Grid\nSize: {PlayerListConfig.snapToGridSize.Value}", "SnapToGridSizeLabel", resize: true); new SingleButton(playerListMenus[1].gameObject, new Vector3(2, 0), "Font\nSize +", new Action(() => PlayerListConfig.fontSize.Value++), "Increase font size of the list by 1", "IncreaseFontSizeButton", true); new SingleButton(playerListMenus[1].gameObject, new Vector3(2, 2), "Font\nSize -", new Action(() => PlayerListConfig.fontSize.Value--), "Decrease font size of the list by 1", "DecreaseFontSizeButton", true); new SingleButton(playerListMenus[1].gameObject, new Vector3(0, 1), "Reset\nFont", new Action(() => PlayerListConfig.fontSize.Value = 35), "Set font size to the default value (35)", "DefaultFontSizeButton", true); fontSizeLabel = new Label(playerListMenus[1].gameObject, new Vector3(2, 1), "", "FontSizeLabel", resize: true); EntryManager.SetFontSize(PlayerListConfig.fontSize.Value); playerListMenus.Add(new SubMenu("UserInterface/QuickMenu", "PlayerListMenuPage3")); new SingleButton(playerListMenus[2].gameObject, new Vector3(1, 0), "Base Sort Type", new Action(() => { EntrySortManager.currentComparisonProperty = EntrySortManager.baseComparisonProperty; sortMenu.OpenSubMenu(); }), "Set base sort which will run when the upper sort and highest sort creates ambiguous entries", "BaseSortTypeButton", true); new SingleButton(playerListMenus[2].gameObject, new Vector3(2, 0), "Upper Sort Type", new Action(() => { EntrySortManager.currentComparisonProperty = EntrySortManager.upperComparisonProperty; sortMenu.OpenSubMenu(); }), "Set upper sort which will run on top of the base sort type and below the highest", "UpperSortTypeButton", true); new SingleButton(playerListMenus[2].gameObject, new Vector3(3, 0), "Highest Sort Type", new Action(() => { EntrySortManager.currentComparisonProperty = EntrySortManager.highestComparisonProperty; sortMenu.OpenSubMenu(); }), "Set highest sort which will run on top of the base and upper sort type", "UpperSortTypeButton", true); new ToggleButton(playerListMenus[2].gameObject, new Vector3(1, 1), "Reverse Base", "Disabled", new Action <bool>((state) => PlayerListConfig.reverseBaseSort.Value = state), "Toggle reverse order of base sort", "Toggle reverse order of base sort", "BaseReverseToggle", PlayerListConfig.reverseBaseSort.Value, true); new ToggleButton(playerListMenus[2].gameObject, new Vector3(2, 1), "Reverse Upper", "Disabled", new Action <bool>((state) => PlayerListConfig.reverseUpperSort.Value = state), "Toggle reverse order of upper sort", "Toggle reverse order of upper sort", "UpperReverseToggle", PlayerListConfig.reverseUpperSort.Value, true); new ToggleButton(playerListMenus[2].gameObject, new Vector3(3, 1), "Reverse Highest", "Disabled", new Action <bool>((state) => PlayerListConfig.reverseHighestSort.Value = state), "Toggle reverse order of upper sort", "Toggle reverse order of upper sort", "HighestReverseToggle", PlayerListConfig.reverseHighestSort.Value, true); new ToggleButton(playerListMenus[2].gameObject, new Vector3(1, 2), "Show Self On Top", "Disabled", new Action <bool>((state) => PlayerListConfig.showSelfAtTop.Value = state), "Show the local player on top of the list always", "Show the local player on top of the list always", "ShowSelfOnTopToggle", PlayerListConfig.showSelfAtTop.Value, true); new ToggleButton(playerListMenus[2].gameObject, new Vector3(2, 2), "Freeze sort when visible", "Disabled", new Action <bool>((state) => PlayerListConfig.freezeSortWhenVisible.Value = state), "Freeze sorting while the list is visible", "Freeze sorting while the list is visible", "FreezeSortWhenVisibleToggle", PlayerListConfig.freezeSortWhenVisible.Value, true); // Initialize PlayerList Customization menu playerListMenus.Add(new SubMenu("UserInterface/QuickMenu", "PlayerListMenuPage4")); new ToggleButton(playerListMenus[3].gameObject, new Vector3(1, 0), "Enable Ping", "Disabled", new Action <bool>((state) => PlayerListConfig.pingToggle.Value = state), "Toggle player ping", "Toggle player ping", "PingToggle", PlayerListConfig.pingToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(2, 0), "Enable Fps", "Disabled", new Action <bool>((state) => PlayerListConfig.fpsToggle.Value = state), "Toggle player fps", "Toggle player fps", "FpsToggle", PlayerListConfig.fpsToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(3, 0), "Enable Platform", "Disabled", new Action <bool>((state) => PlayerListConfig.platformToggle.Value = state), "Toggle player Platform", "Toggle player Platform", "PlatformToggle", PlayerListConfig.platformToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(1, 1), "Enable Avatar Performance", "Disabled", new Action <bool>((state) => PlayerListConfig.perfToggle.Value = state), "Toggle avatar performance", "Toggle avatar performance", "PerfToggle", PlayerListConfig.perfToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(2, 1), "Enable Distance", "Disabled", new Action <bool>((state) => PlayerListConfig.distanceToggle.Value = state), "Toggle distance to player", "Toggle distance to player", "DistanceToPlayerToggle", PlayerListConfig.distanceToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(3, 1), "Enable Photon ID", "Disabled", new Action <bool>((state) => PlayerListConfig.photonIdToggle.Value = state), "Toggles the photon ID. Not generally useful", "Toggles the photon ID. Not generally useful", "PhotonIDToggle", PlayerListConfig.photonIdToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(1, 2), "Enable Owned Object Count", "Disabled", new Action <bool>((state) => PlayerListConfig.ownedObjectsToggle.Value = state), "Toggles the how many objects a player owns. Not accurate right after world join and in worlds alone", "Toggles the how many objects a player owns. Not accurate right after world join and in worlds alone", "OwnedObjectsToggle", PlayerListConfig.ownedObjectsToggle.Value, true); new ToggleButton(playerListMenus[3].gameObject, new Vector3(2, 2), "Enable DisplayName", "Disabled", new Action <bool>((state) => PlayerListConfig.displayNameToggle.Value = state), "Why...?", "Why...?", "DisplayNameToggle", PlayerListConfig.displayNameToggle.Value, true); new QuarterButton(playerListMenus[3].gameObject, new Vector3(3, 2), new Vector2(0, 0), "TF", new Action(() => PlayerListConfig.displayNameColorMode.Value = PlayerEntry.DisplayNameColorMode.TrustAndFriends), "Set displayname coloring to show friends and trust rank", "TrustAndFriendsButton"); new QuarterButton(playerListMenus[3].gameObject, new Vector3(3, 2), new Vector2(1, 0), "T", new Action(() => PlayerListConfig.displayNameColorMode.Value = PlayerEntry.DisplayNameColorMode.TrustOnly), "Set displayname coloring to show trust rank only", "TrustOnlyButton"); new QuarterButton(playerListMenus[3].gameObject, new Vector3(3, 2), new Vector2(1, 1), "F", new Action(() => PlayerListConfig.displayNameColorMode.Value = PlayerEntry.DisplayNameColorMode.FriendsOnly), "Set displayname coloring to show friends only", "FriendsOnlyButton"); new QuarterButton(playerListMenus[3].gameObject, new Vector3(3, 2), new Vector2(0, 1), "N", new Action(() => PlayerListConfig.displayNameColorMode.Value = PlayerEntry.DisplayNameColorMode.None), "Set displayname coloring to none", "NoneButton"); }
public override void OnApplicationStart() { Instance = this; PlayerListConfig.RegisterSettings(); EntryManager.Init(); ListPositionManager.Init(); MenuManager.Init(); EntrySortManager.Init(); PlayerEntry.EntryInit(); LocalPlayerEntry.EntryInit(); MelonCoroutines.Start(StartUiManagerInitIEnumerator()); }
public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (buildIndex == -1) { if (Constants.quickMenuColliderSize != null) { Constants.quickMenuColliderSize = Constants.quickMenu.GetComponent <BoxCollider>().size; ListPositionManager.CombineQMColliderAndPlayerListRect(); } EntryManager.OnSceneWasLoaded(); UIManager.OnSceneWasLoaded(); } }
public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (buildIndex != -1) { return; } if (MelonHandler.Mods.Any(mod => mod.Info.Name == "emmVRCLoader")) { typeof(EmmManager).GetMethod("OnSceneWasLoaded").Invoke(null, null); } MenuManager.OnSceneWasLoaded(); Constants.OnSceneWasLoaded(); EntryManager.OnSceneWasLoaded(); }
public static void OnPlayerLeave(Player player) { EntryManager.OnPlayerLeave(player); }
public static void OnPlayerJoin(Player player) { EntryManager.OnPlayerJoin(player); }
public static void CreateSubMenus() { // Initialize Movement menu playerListMenus.Add(new SubMenu("UserInterface/QuickMenu", "PlayerListMenuPage2")); new SingleButton(playerListMenus[1].path, new Vector3(3, 0), "Edit PlayerList Position", new Action(ListPositionManager.MovePlayerList), "Click to edit the position of the PlayerList", "EditPlayerListPosButton", true); new SingleButton(playerListMenus[1].path, new Vector3(3, 1), "Move to Right of QuickMenu", new Action(ListPositionManager.MovePlayerListToEndOfMenu), "Move PlayerList to right side of menu, this can also serve as a reset position button", "LockPlayerListToRightButton", true); new QuarterButton(playerListMenus[1].path, new Vector3(3, 2), new Vector2(0, 0), "1", new Action(() => PlayerListMod.MenuButtonPosition = PlayerListMod.MenuButtonPositionEnum.TopRight), "Move PlayerList menu button to the top right", "1PlayerListMenuButton"); new QuarterButton(playerListMenus[1].path, new Vector3(3, 2), new Vector2(1, 0), "2", new Action(() => PlayerListMod.MenuButtonPosition = PlayerListMod.MenuButtonPositionEnum.TopLeft), "Move PlayerList menu button to the top left", "2PlayerListMenuButton"); new QuarterButton(playerListMenus[1].path, new Vector3(3, 2), new Vector2(1, 1), "3", new Action(() => PlayerListMod.MenuButtonPosition = PlayerListMod.MenuButtonPositionEnum.BottomLeft), "Move PlayerList menu button to the bottom left", "3PlayerListMenuButton"); new QuarterButton(playerListMenus[1].path, new Vector3(3, 2), new Vector2(0, 1), "4", new Action(() => PlayerListMod.MenuButtonPosition = PlayerListMod.MenuButtonPositionEnum.BottomRight), "Move PlayerList menu button to the bottom right", "4PlayerListMenuButton"); new SingleButton(playerListMenus[1].path, new Vector3(1, 0), "Snap Grid\nSize +", new Action(() => ListPositionManager.SnapToGridSize += 10), "Increase the size of the snap to grid by 10", "IncreaseSnapGridSize", true); new SingleButton(playerListMenus[1].path, new Vector3(1, 2), "Snap Grid\nSize -", new Action(() => ListPositionManager.SnapToGridSize -= 10), "Decrease the size of the snap to grid by 10", "DecreaseSnapGridSize", true); new SingleButton(playerListMenus[1].path, new Vector3(0, 0), "Reset Snap\nGrid Size", new Action(() => ListPositionManager.SnapToGridSize = 420), "Set snap to grid to the default value (420)", "DefaultSnapGridSize", true); ListPositionManager.snapToGridSizeLabel = new Label(playerListMenus[1].path, new Vector3(1, 1), $"Snap Grid\nSize: {ListPositionManager.SnapToGridSize}", "SnapToGridSizeLabel", resize: true); ListPositionManager.SnapToGridSize = Config.snapToGridSize.Value; new SingleButton(playerListMenus[1].path, new Vector3(2, 0), "Font\nSize +", new Action(() => PlayerListMod.FontSize++), "Increase font size of the list by 1", "IncreaseFontSizeButton", true); new SingleButton(playerListMenus[1].path, new Vector3(2, 2), "Font\nSize -", new Action(() => PlayerListMod.FontSize--), "Decrease font size of the list by 1", "DecreaseFontSizeButton", true); new SingleButton(playerListMenus[1].path, new Vector3(0, 1), "Reset\nFont", new Action(() => PlayerListMod.FontSize = 35), "Set font size to the default value (35)", "DefaultFontSizeButton", true); PlayerListMod.fontSizeLabel = new Label(playerListMenus[1].path, new Vector3(2, 1), $"Font\nSize: {PlayerListMod.FontSize}", "FontSizeLabel", resize: true); // Initialize PlayerList Customization menu playerListMenus.Add(new SubMenu("UserInterface/QuickMenu", "PlayerListMenuPage3")); new ToggleButton(playerListMenus[2].path, new Vector3(1, 0), "Enable Ping", "Disabled", new Action <bool>((state) => { Config.pingToggle.Value = state; EntryManager.RefreshPlayerEntries(true); }), "Toggle player ping", "Toggle player ping", "PingToggle", Config.pingToggle.Value, true); new ToggleButton(playerListMenus[2].path, new Vector3(2, 0), "Enable Fps", "Disabled", new Action <bool>((state) => { Config.fpsToggle.Value = state; EntryManager.RefreshPlayerEntries(true); }), "Toggle player fps", "Toggle player fps", "FpsToggle", Config.fpsToggle.Value, true); new ToggleButton(playerListMenus[2].path, new Vector3(3, 0), "Enable Platform", "Disabled", new Action <bool>((state) => { Config.platformToggle.Value = state; EntryManager.RefreshPlayerEntries(true); }), "Toggle player Platform", "Toggle player Platform", "PlatformToggle", Config.platformToggle.Value, true); new ToggleButton(playerListMenus[2].path, new Vector3(1, 1), "Enable Avatar Performance", "Disabled", new Action <bool>((state) => { Config.perfToggle.Value = state; EntryManager.RefreshPlayerEntries(true); }), "Toggle avatar performance", "Toggle avatar performance", "PerfToggle", Config.perfToggle.Value, true); new ToggleButton(playerListMenus[2].path, new Vector3(2, 1), "Enable Distance", "Disabled", new Action <bool>((state) => { Config.distanceToggle.Value = state; EntryManager.RefreshPlayerEntries(true); }), "Toggle distance to player", "Toggle distance to player", "DistanceToPlayerToggle", Config.distanceToggle.Value, true); new ToggleButton(playerListMenus[2].path, new Vector3(3, 1), "Enable DisplayName", "Disabled", new Action <bool>((state) => { Config.displayNameToggle.Value = state; EntryManager.RefreshPlayerEntries(true); }), "Why...?", "Why...?", "DisplayNameToggle", Config.displayNameToggle.Value, true); new QuarterButton(playerListMenus[2].path, new Vector3(3, 2), new Vector2(0, 0), "TF", new Action(() => { Config.DisplayNameColorMode = PlayerListMod.DisplayNameColorMode.TrustAndFriends; EntryManager.RefreshPlayerEntries(true); }), "Set displayname coloring to show friends and trust rank", "TrustAndFriendsButton"); new QuarterButton(playerListMenus[2].path, new Vector3(3, 2), new Vector2(1, 0), "T", new Action(() => { Config.DisplayNameColorMode = PlayerListMod.DisplayNameColorMode.TrustOnly; EntryManager.RefreshPlayerEntries(true); }), "Set displayname coloring to show trust rank only", "TrustOnlyButton"); new QuarterButton(playerListMenus[2].path, new Vector3(3, 2), new Vector2(1, 1), "F", new Action(() => { Config.DisplayNameColorMode = PlayerListMod.DisplayNameColorMode.FriendsOnly; EntryManager.RefreshPlayerEntries(true); }), "Set displayname coloring to show friends only", "FriendsOnlyButton"); new QuarterButton(playerListMenus[2].path, new Vector3(3, 2), new Vector2(0, 1), "N", new Action(() => { Config.DisplayNameColorMode = PlayerListMod.DisplayNameColorMode.None; EntryManager.RefreshPlayerEntries(true); }), "Set displayname coloring to none", "NoneButton"); }
public static void CreateMainSubMenu() { MelonLogger.Msg("Initializing Menu..."); playerListMenus.Add(new SubMenu("UserInterface/QuickMenu", "PlayerListMenuPage1")); SingleButton backButton = new SingleButton(playerListMenus[0].path, new Vector3(5, 2), "Back", new Action(() => UIManager.OpenPage("UserInterface/QuickMenu/ShortcutMenu")), "Press to go back", "BackButton"); backButton.textComponent.color = Color.yellow; menuToggleButton = new ToggleButton(playerListMenus[0].path, new Vector3(5, 0), "Enabled", "Disabled", new Action <bool>((state) => ToggleMenu()), "Toggle the menu. Can also be toggled using Left Ctrl + F1", "Toggle the menu. Can also be toggled using Left Ctrl + F1", "ToggleMenuToggle", !shouldStayHidden); new ToggleButton(playerListMenus[0].path, new Vector3(5, -1), "Enabled on Start", "Disabled", new Action <bool>((state) => { Config.enabledOnStart.Value = state; EntryManager.shouldSaveConfig = true; }), "Toggle if the list is toggled hidden on start", "Toggle if the list is toggled hidden on start", "EnabledOnStartToggle", Config.enabledOnStart.Value, true); new ToggleButton(playerListMenus[0].path, new Vector3(0, 1), "Condense Text", "Regular Text", new Action <bool>((state) => { Config.condensedText.Value = !Config.condensedText.Value; EntryManager.RefreshPlayerEntries(true); }), "Toggle if text should be condensed", "Toggle if text should be condensed", "CondensedTextToggle", Config.condensedText.Value, true); new ToggleButton(playerListMenus[0].path, new Vector3(0, 0), "Numbered List", "Tick List", new Action <bool>((state) => { Config.numberedList.Value = !Config.numberedList.Value; EntryManager.RefreshPlayerEntries(true); }), "Toggle if the list should be numbered or ticked", "Toggle if the list should be numbered or ticked", "NumberedTickToggle", Config.numberedList.Value, true); PlayerListMod.menuButton.GetComponent <Button>().onClick.AddListener(new Action(() => { UIManager.OpenPage(playerListMenus[0].path); PlayerListMod.playerList.SetActive(!shouldStayHidden); })); }