private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Marathon Settings"); optionsMenu.scrollable.AddRow(header); string shuffleText = Config.Shuffle ? "<color=\"green\">Shuffle ON" : "<color=\"red\">Shuffle OFF"; shuffleButton = optionsMenu.AddButton(0, shuffleText, new Action(() => { ToggleShuffle(); }), null, "Shuffles the songs", optionsMenu.buttonPrefab); string showScoreText = Config.ShowScores ? "<color=\"green\">Show Score ON" : "<color=\"red\">Show Score OFF"; showScoreButton = optionsMenu.AddButton(1, showScoreText, new Action(() => { ToggleShowScore(); }), null, "Shows 'Level Complete' at the end of each song", optionsMenu.buttonPrefab); string noFailText = Config.NoFail ? "<color=\"green\">NoFail ON" : "<color=\"red\">NoFail OFF"; noFailButton = optionsMenu.AddButton(0, noFailText, new Action(() => { ToggleNoFail(); }), null, "Play the marathon with NoFail on or off", optionsMenu.buttonPrefab); string resetHealthText = Config.ResetHealth ? "<color=\"green\">Reset Health ON" : "<color=\"red\">Reset Health OFF"; resetHealthButton = optionsMenu.AddButton(1, resetHealthText, new Action(() => { ToggleResetHealth(); }), null, "Reset Health at the end of each song", optionsMenu.buttonPrefab); Il2CppSystem.Collections.Generic.List <GameObject> toggles = new Il2CppSystem.Collections.Generic.List <GameObject>(); toggles.Add(shuffleButton.gameObject); toggles.Add(showScoreButton.gameObject); optionsMenu.scrollable.AddRow(toggles); toggles.Clear(); toggles.Add(noFailButton.gameObject); toggles.Add(resetHealthButton.gameObject); optionsMenu.scrollable.AddRow(toggles); var divider = optionsMenu.AddHeader(0, ""); optionsMenu.scrollable.AddRow(divider); var start = optionsMenu.AddButton(1, "Start", new Action(() => { MelonPreferences.Save(); PlaylistEndlessManager.StartEndlessSession(); }), null, "Starts the marathon", optionsMenu.buttonPrefab); optionsMenu.scrollable.AddRow(start.gameObject); }
private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Playlist Name"); optionsMenu.scrollable.AddRow(header); var nameField = optionsMenu.AddButton(0, "Name:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Enter the desired name for the playlist", optionsMenu.textEntryButtonPrefab); optionsMenu.scrollable.AddRow(nameField.gameObject); playlistText = nameField.gameObject.GetComponentInChildren <TextMeshPro>(); var createButton = optionsMenu.AddButton(0, "Create Playlist", new Action(() => { if (newName.Length == 0) { return; } Playlist playlist = new Playlist(newName, new List <string>()); playlist.filename = newName + ".playlist"; PlaylistManager.AddNewPlaylist(playlist, true); //PlaylistManager.SelectPlaylist(playlist.name); PlaylistManager.SavePlaylist(playlist.name, false); PlaylistManager.SavePlaylistData(); CancelCreate(); }), null, "Create playlist with the entered name", optionsMenu.buttonPrefab); optionsMenu.scrollable.AddRow(createButton.gameObject); }
public static void CreateSettingsButton(OptionsMenu optionsMenu) { string toggleText = "OFF"; if (config.activated) { toggleText = "ON"; } optionsMenu.AddHeader(0, "Trippy Menu"); toggleButton = optionsMenu.AddButton (0, toggleText, new Action(() => { if (config.activated) { config.activated = false; playPsychadelia = false; toggleButton.label.text = "OFF"; SaveConfig(); GameplayModifiers.I.mPsychedeliaPhase = 0.00000001f; timer = 0; } else { config.activated = true; playPsychadelia = true; toggleButton.label.text = "ON"; SaveConfig(); } }), null, "Turns Trippy Menu on or off"); speedSlider = optionsMenu.AddSlider ( 0, "Trippy Menu Cycle Speed", "P", new Action <float>((float n) => { config.speed = Mathf.Round((config.speed + n) * 1000.0f) / 1000.0f; UpdateSlider(speedSlider, "Speed : " + config.speed.ToString()); }), null, null, "Changes color cycle speed" ); speedSlider.label.text = "Speed : " + config.speed.ToString(); //MelonModLogger.Log("Buttons created"); menuSpawned = true; }
private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Search by: Artist, Title, Mapper"); optionsMenu.scrollable.AddRow(header); var searchField = optionsMenu.AddButton(0, "Search:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Filter by: Artist, Title, Mapper", optionsMenu.textEntryButtonPrefab); optionsMenu.scrollable.AddRow(searchField.gameObject); searchText = searchField.gameObject.GetComponentInChildren <TextMeshPro>(); var infoText = optionsMenu.AddTextBlock(0, "Searching for nothing will find all songs, unless limited by additional filters."); optionsMenu.scrollable.AddRow(infoText); var filtersHeader = optionsMenu.AddHeader(0, "Additional filters"); optionsMenu.scrollable.AddRow(filtersHeader); mapTypeToggle = optionsMenu.AddButton(0, SplitCamelCase(SongSearch.mapType.ToString()), new Action(() => { SongSearch.mapType++; if ((int)SongSearch.mapType > 2) { SongSearch.mapType = SongSearch.MapType.All; } mapTypeToggle.label.text = SplitCamelCase(SongSearch.mapType.ToString()); }), null, "Filters the search to the selected map type"); mapTypeToggle.button.doMeshExplosion = false; mapTypeToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(mapTypeToggle.gameObject); }
public static void AddSongItems(OptionsMenu optionsMenu, APISongList songlist) { CleanUpPage(optionsMenu); activeSongList = songlist; optionsMenu.screenTitle.text = "Displaying page " + SongBrowser.page.ToString() + " out of " + songlist.total_pages.ToString(); var pageHeader = optionsMenu.AddHeader(0, "Listing " + songlist.song_count.ToString() + " songs"); optionsMenu.scrollable.AddRow(pageHeader.gameObject); AddPageButtons(optionsMenu); foreach (var song in songlist.songs) { CreateSongItem(song, optionsMenu); } AddPageButtons(optionsMenu); }
private static void AddButtons(OptionsMenu optionsMenu) { /*var header = optionsMenu.AddHeader(0, "Playlists"); * optionsMenu.scrollable.AddRow(header);*/ OptionsMenuButton entry = null; foreach (string playlist in PlaylistManager.playlists.Keys) { var name = optionsMenu.AddTextBlock(0, playlist); var tmp = name.transform.GetChild(0).GetComponent <TextMeshPro>(); tmp.fontSizeMax = 32; tmp.fontSizeMin = 8; optionsMenu.scrollable.AddRow(name.gameObject); OptionsMenuButton edit = null; if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting) { edit = optionsMenu.AddButton(0, "Edit", new Action(() => { PlaylistManager.state = PlaylistManager.PlaylistState.Editing; PlaylistManager.SetPlaylistToEdit(playlist); OptionsMenu.I.ShowPage(OptionsMenu.Page.Misc); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Edit this playlist", optionsMenu.buttonPrefab); } string txt = PlaylistManager.state == PlaylistManager.PlaylistState.Selecting ? "Select" : "Add"; entry = optionsMenu.AddButton(1, txt, new Action(() => { if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting) { PlaylistManager.SelectPlaylist(playlist); } else { PlaylistManager.AddSongToPlaylist(playlist, AddPlaylistButton.songToAdd); MenuState.I.GoToLaunchPage(); return; } PlaylistManager.state = PlaylistManager.PlaylistState.None; FilterPanel.ResetFilterState(); MenuState.I.GoToSongPage(); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Select this playlist", optionsMenu.buttonPrefab); Il2CppSystem.Collections.Generic.List <GameObject> row = new Il2CppSystem.Collections.Generic.List <GameObject>(); //row.Add(name.gameObject); if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting) { row.Add(edit.gameObject); } row.Add(entry.gameObject); optionsMenu.scrollable.AddRow(row); } var header = optionsMenu.AddHeader(0, "Create"); optionsMenu.scrollable.AddRow(header); entry = optionsMenu.AddButton(0, "Create new Playlist", new Action(() => { MelonLoader.MelonLogger.Msg("Create button shot"); PlaylistManager.state = PlaylistManager.PlaylistState.Creating; OptionsMenu.I.ShowPage(OptionsMenu.Page.Misc); MenuState.I.GoToSettingsPage(); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Create a new playlist", optionsMenu.buttonPrefab); optionsMenu.scrollable.AddRow(entry.gameObject); }
private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Filter by: Artist, Title, Mapper"); optionsMenu.scrollable.AddRow(header); var searchField = optionsMenu.AddButton(0, "Search:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Filter by: Artist, Title, Mapper", optionsMenu.textEntryButtonPrefab); optionsMenu.scrollable.AddRow(searchField.gameObject); searchText = searchField.gameObject.GetComponentInChildren <TextMeshPro>(); var difficultyHeader = optionsMenu.AddHeader(0, "Filter difficulty"); optionsMenu.scrollable.AddRow(difficultyHeader); string difficultyFilterText = difficultyFilter.ToString(); difficultyToggle = optionsMenu.AddButton (0, difficultyFilterText, new Action(() => { difficultyFilter++; if ((int)difficultyFilter > 4) { difficultyFilter = 0; } difficultyToggle.label.text = difficultyFilter.ToString(); SongBrowser.page = 1; SongBrowser.StartSongSearch(); }), null, "Filters the search to the selected difficulty"); difficultyToggle.button.doMeshExplosion = false; difficultyToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(difficultyToggle.gameObject); var extraHeader = optionsMenu.AddHeader(0, "Extra"); optionsMenu.scrollable.AddRow(extraHeader); string curatedFilterText = "Curated only: " + curated.ToString(); curatedToggle = optionsMenu.AddButton (0, curatedFilterText, new Action(() => { if (curated) { curated = false; } else { curated = true; } curatedToggle.label.text = "Curated only: " + curated.ToString(); SongBrowser.page = 1; SongBrowser.StartSongSearch(); }), null, "Filters the search to curated maps only"); curatedToggle.button.doMeshExplosion = false; curatedToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(curatedToggle.gameObject); var downloadFullPage = optionsMenu.AddButton (1, "Download current page", new Action(() => { DownloadFullPage(); }), null, "Downloads all songs from the current page, this will cause major stutters"); var RestoreSongs = optionsMenu.AddButton (0, "Restore Deleted Songs", new Action(() => { SongBrowser.RestoreDeletedSongs(); }), null, "Restores all the songs you have deleted."); //optionsMenu.scrollable.AddRow(RestoreSongs.gameObject); string popularityFilterText = "Sort by playcount: " + popularity.ToString(); popularityToggle = optionsMenu.AddButton (1, popularityFilterText, new Action(() => { if (popularity) { popularity = false; } else { popularity = true; } popularityToggle.label.text = "Sort by playcount: " + popularity.ToString(); SongBrowser.page = 1; SongBrowser.StartSongSearch(); }), null, "Sorts downloads by leaderboard scores rather than date."); popularityToggle.button.doMeshExplosion = false; popularityToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(popularityToggle.gameObject); var downloadFolderBlock = optionsMenu.AddTextBlock(0, "You can hotload songs by placing them in Audica/Downloads and pressing F5"); optionsMenu.scrollable.AddRow(downloadFolderBlock); }
private static void CreateCategoryPage(MelonPreferences_Category category) { WipeScroller(); displayState = DisplayState.Prefs; var categoryHeader = modMenuOM.AddHeader(0, category.DisplayName); modMenuOM.scrollable.AddRow(categoryHeader); int buttonIndex = 0; Il2CppGeneric.List <GameObject> row = new Il2CppGeneric.List <GameObject>(); foreach (var pref in category.Entries) { switch (pref.BoxedValue) { case int value: MinMaxStepDefaultInt rangesInt = ParseMinMaxStepInt(pref.DisplayName); if (rangesInt.Equals(default(MinMaxStepDefaultInt))) { break; } var intSlider = modMenuOM.AddSlider(buttonIndex % 2, AddWhitespace(pref.Identifier), null, new Action <float>((amount) => { int currentVal = MelonPreferences.GetEntryValue <int>(pref.Category.Identifier, pref.Identifier); int increment = (int)amount * rangesInt.step; int newVal = currentVal + increment; if (newVal > rangesInt.max) { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, rangesInt.max); } else if (newVal < rangesInt.min) { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, rangesInt.min); } else { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, newVal); } }), new Func <float>(() => { return(MelonPreferences.GetEntryValue <int>(pref.Category.Identifier, pref.Identifier)); }), new Action(() => { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, rangesInt.prefDefault); }), RemoveTags(pref.DisplayName), new Func <float, string>((amount) => { return(amount.ToString()); })); buttonIndex++; row.Add(intSlider.gameObject); break; case bool value: var checkbox = modMenuOM.AddButton(buttonIndex % 2, AddWhitespace(pref.Identifier), new Action(() => { bool currentVal = MelonPreferences.GetEntryValue <bool>(pref.Category.Identifier, pref.Identifier); MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, !currentVal); }), new Func <bool>(() => { return(MelonPreferences.GetEntryValue <bool>(pref.Category.Identifier, pref.Identifier)); }), pref.DisplayName); row.Add(checkbox.gameObject); buttonIndex++; break; case float value: MinMaxStepDefault rangesFloat = ParseMinMaxStep(pref.DisplayName); if (rangesFloat.Equals(default(MinMaxStepDefault))) { break; } var customSpecifier = GetFormatSpecifier(pref.DisplayName); if (customSpecifier == "") { customSpecifier = "N2"; //Default to N2 if specifier is missing } var floatSlider = modMenuOM.AddSlider(buttonIndex % 2, AddWhitespace(pref.Identifier), "N2", new Action <float>((amount) => { float currentVal = MelonPreferences.GetEntryValue <float>(pref.Category.Identifier, pref.Identifier); float increment = rangesFloat.step * amount; //(amount * Mathf.Floor(currentVal * 10f)); float newVal = currentVal + increment; if (newVal > rangesFloat.max) { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, rangesFloat.max); } else if (newVal < rangesFloat.min) { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, rangesFloat.min); } else { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, currentVal + increment); } }), new Func <float>(() => { return(MelonPreferences.GetEntryValue <float>(pref.Category.Identifier, pref.Identifier)); }), new Action(() => { MelonPreferences.SetEntryValue(pref.Category.Identifier, pref.Identifier, rangesFloat.prefDefault); }), RemoveTags(pref.DisplayName), new Func <float, string>((amount) => { return(amount.ToString(customSpecifier)); })); row.Add(floatSlider.gameObject); buttonIndex++; break; case string value: if (pref.DisplayName.ToLower().Contains("[header]")) { if (row.Count == 1) { modMenuOM.scrollable.AddRow(row[0]); row.Clear(); } var header = modMenuOM.AddHeader(0, RemoveTags(pref.DisplayName)); modMenuOM.scrollable.AddRow(header); buttonIndex = 0; } break; default: break; } if (row.Count == 2) { //This is the dumbest code I've ever wrote. Il2CppGeneric.List <GameObject> tempRow = new Il2CppGeneric.List <GameObject>(); tempRow.Add(row[0]); tempRow.Add(row[1]); modMenuOM.scrollable.AddRow(tempRow); row.Clear(); } else if (buttonIndex == category.Entries.Count && buttonIndex % 2 == 1) // This might be obsolete { modMenuOM.scrollable.AddRow(row[0]); row.Clear(); } } }
public override void OnUpdate() { if (MenuState.sState == 0) { return; } if (introSkip) { if (!isPlaying && MenuState.sState == MenuState.State.Launched && AudioDriver.I is AudioDriver) { isPlaying = true; } else if (isPlaying && (MenuState.sState != MenuState.State.Launched || AudioDriver.I is null)) { isPlaying = false; introSkipped = false; } if (isPlaying) { if (!skipQueued && !introSkipped && GetCurrentTick() < GetFirstTick() - 3840) { canSkip = true; if (popup is null) { if (button == "") { switch (VRHardwareSetup.I.hardware) { case VRHardwareSetup.VRHardwareMode.Cosmos: button = "X"; break; case VRHardwareSetup.VRHardwareMode.Knuckles: case VRHardwareSetup.VRHardwareMode.OculusNative: case VRHardwareSetup.VRHardwareMode.OculusOpenVR: button = "A"; break; case VRHardwareSetup.VRHardwareMode.ViveWand: case VRHardwareSetup.VRHardwareMode.WinMROpenVR: button = "R Menu Button"; break; case VRHardwareSetup.VRHardwareMode.Unknown: button = "?"; break; } } popup = KataConfig.I.CreateDebugText("Skip Intro by pressing <color=#85e359>" + button + "</color>", new Vector3(0f, -1f, 5f), 3f, null, false, 0.001f).gameObject; } } else { if (canSkip) { canSkip = false; } if (popup is GameObject) { GameObject.Destroy(popup); popup = null; } } } } if (MenuState.sState == MenuState.State.Launched) { return; } if (MenuState.sState != MenuState.State.SettingsPage) { miscPageFound = false; } if (MenuState.sState == MenuState.State.SettingsPage && !miscPageFound) { if (OptionsMenu.I is OptionsMenu) { optionMenu = OptionsMenu.I; } else { return; } if (optionMenu.mPage == OptionsMenu.Page.Misc) { miscPageFound = true; } if (miscPageFound && !menuSpawned) { if (optionMenu.mPage == OptionsMenu.Page.Misc) { string toggleText = "OFF"; if (introSkip) { toggleText = "ON"; } optionMenu.AddHeader(0, "Skip Intro"); toggleButton = optionMenu.AddButton (0, toggleText, new Action(() => { if (introSkip) { introSkip = false; toggleButton.label.text = "OFF"; SaveConfig(); } else { introSkip = true; toggleButton.label.text = "ON"; SaveConfig(); } }), null, "Enables Intro Skipping"); menuSpawned = true; } } else if (!miscPageFound) { menuSpawned = false; } } }
private static void AddButtons(OptionsMenu optionsMenu) { //var header = optionsMenu.AddHeader(0, PlaylistManager.playlistToEdit.name); var header = optionsMenu.AddHeader(0, "Song List"); optionsMenu.scrollable.AddRow(header); int index = 0; Il2CppSystem.Collections.Generic.List <GameObject> row = new Il2CppSystem.Collections.Generic.List <GameObject>(); foreach (KeyValuePair <string, string> song in PlaylistManager.playlistToEdit.songNames) { var name = optionsMenu.AddTextBlock(0, song.Value); var tmp = name.transform.GetChild(0).GetComponent <TextMeshPro>(); tmp.fontSizeMax = 32; tmp.fontSizeMin = 8; optionsMenu.scrollable.AddRow(name.gameObject); var delete = optionsMenu.AddButton(1, "Remove", new Action(() => { PlaylistManager.RemoveSongFromPlaylist(song.Key); RefreshList(); }), null, "Removes this song from this playlist", optionsMenu.buttonPrefab); row.Add(delete.gameObject); if (!SongLoadingManager.songDictionary.ContainsKey(song.Key + ".audica")) { var download = optionsMenu.AddButton(0, "Download", new Action(() => { var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back"); var label = button.GetComponentInChildren <TextMeshPro>(); UnityEngine.Object.Destroy(button.GetComponentInChildren <Localizer>()); var bButton = button.GetComponentInChildren <GunButton>(); PlaylistManager.DownloadSingleSong(song.Key + ".audica", true, bButton, label); }), null, "Download this song", optionsMenu.buttonPrefab); download.button.destroyOnShot = true; row.Add(download.gameObject); } optionsMenu.scrollable.AddRow(row); row = new Il2CppSystem.Collections.Generic.List <GameObject>(); if (index < PlaylistManager.playlistToEdit.songs.Count - 1) { var moveDown = optionsMenu.AddButton(0, "Move Down", new Action(() => { PlaylistManager.MoveSongDown(song.Key); RefreshList(); }), null, "Moves this song down in the playlist", optionsMenu.buttonPrefab); row.Add(moveDown.gameObject); } if (index != 0) { var moveUp = optionsMenu.AddButton(1, "Move Up", new Action(() => { PlaylistManager.MoveSongUp(song.Key); RefreshList(); }), null, "Moves this song up in the playlist", optionsMenu.buttonPrefab); row.Add(moveUp.gameObject); } optionsMenu.scrollable.AddRow(row); index++; row = new Il2CppSystem.Collections.Generic.List <GameObject>(); } header = optionsMenu.AddHeader(0, "Playlist Options"); optionsMenu.scrollable.AddRow(header); var deletePlaylistButton = optionsMenu.AddButton(0, "Delete", new Action(() => { PlaylistManager.DeletePlaylist(); PlaylistManager.state = PlaylistManager.PlaylistState.Selecting; OptionsMenu.I.ShowPage(OptionsMenu.Page.Main); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Deletes this Playlist", optionsMenu.buttonPrefab); //optionsMenu.scrollable.AddRow(deletePlaylistButton.gameObject); row.Add(deletePlaylistButton.gameObject); if (PlaylistManager.playlistToEdit.downloadedDict.Any(p => p.Value == false)) { var downloadAllButton = optionsMenu.AddButton(1, "Download All", new Action(() => { var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back"); var label = button.GetComponentInChildren <TextMeshPro>(); UnityEngine.Object.Destroy(button.GetComponentInChildren <Localizer>()); var bButton = button.GetComponentInChildren <GunButton>(); //bButton.SetInteractable(false); List <string> songs = new List <string>(); foreach (KeyValuePair <string, string> song in PlaylistManager.playlistToEdit.songNames) { if (!SongLoadingManager.songDictionary.ContainsKey(song.Key + ".audica")) { songs.Add(song.Key + ".audica"); //PlaylistManager.DownloadSong(song.Key + ".audica", true, backButton); } } if (songs.Count > 0) { PlaylistManager.DownloadSongs(songs, true, bButton, label); } }), null, "Downloads all missing songs in this Playlist", optionsMenu.buttonPrefab); //optionsMenu.scrollable.AddRow(downloadAllButton.gameObject); row.Add(downloadAllButton.gameObject); } optionsMenu.scrollable.AddRow(row); }
public static void AddOptionsButtons(OptionsMenu optionsMenu) { void UpdateSlider(OptionsMenuSlider slider, string text) { if (slider == null) { return; } else { slider.label.text = text; SaveConfig(); } } OptionsMenuSlider MakeSlider(string label, OptionsMenuSlider.AdjustActionDelegate action, string helpText) { OptionsMenuSlider slider = optionsMenu.AddSlider ( 0, label, "P", action, null, null, helpText ); return(slider); } string positionSmoothingLabel = "Position Smoothing"; OptionsMenuSlider.AdjustActionDelegate positionSmoothingAction = new Action <float>((float n) => { positionSmoothing = Mathf.Round((positionSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(positionSmoothingSlider, positionSmoothingLabel + " : " + positionSmoothing.ToString()); }); positionSmoothingSlider = MakeSlider(positionSmoothingLabel, positionSmoothingAction, "Changes how smooth positioning will be"); positionSmoothingSlider.label.text = positionSmoothingLabel + " : " + positionSmoothing.ToString(); string rotationSmoothingLabel = "Rotation Smoothing"; OptionsMenuSlider.AdjustActionDelegate rotationSmoothingAction = new Action <float>((float n) => { rotationSmoothing = Mathf.Round((rotationSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(rotationSmoothingSlider, rotationSmoothingLabel + " : " + rotationSmoothing.ToString()); }); rotationSmoothingSlider = MakeSlider(rotationSmoothingLabel, rotationSmoothingAction, "Changes how smooth rotation will be"); rotationSmoothingSlider.label.text = rotationSmoothingLabel + " : " + rotationSmoothing.ToString(); string camOffsetLabel = "Horizontal Offset"; OptionsMenuSlider.AdjustActionDelegate camOffsetAction = new Action <float>((float n) => { camOffset = Mathf.Round((camOffset + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camOffsetSlider, camOffsetLabel + " : " + camOffset.ToString()); }); camOffsetSlider = MakeSlider(camOffsetLabel, camOffsetAction, "Changes horizontal position"); camOffsetSlider.label.text = camOffsetLabel + " : " + camOffset.ToString(); string camHeightLabel = "Vertical Offset"; OptionsMenuSlider.AdjustActionDelegate camHeightAction = new Action <float>((float n) => { camHeight = Mathf.Round((camHeight + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camHeightSlider, camHeightLabel + " : " + camHeight.ToString()); }); camHeightSlider = MakeSlider(camHeightLabel, camHeightAction, "Changes vertical position"); camHeightSlider.label.text = camHeightLabel + " : " + camHeight.ToString(); string camDistanceLabel = "Distance"; OptionsMenuSlider.AdjustActionDelegate camDistanceAction = new Action <float>((float n) => { camDistance = Mathf.Round((camDistance + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camDistanceSlider, camDistanceLabel + " : " + camDistance.ToString()); }); camDistanceSlider = MakeSlider(camDistanceLabel, camDistanceAction, "Changes the distance"); camDistanceSlider.label.text = camDistanceLabel + " : " + camDistance.ToString(); string camRotationLabel = "Rotation"; OptionsMenuSlider.AdjustActionDelegate camRotationAction = new Action <float>((float n) => { camRotation = Mathf.Round((camRotation + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camRotationSlider, camRotationLabel + " : " + camRotation.ToString()); }); camRotationSlider = MakeSlider(camRotationLabel, camRotationAction, "Changes the rotation"); camRotationSlider.label.text = camRotationLabel + " : " + camRotation.ToString(); optionsMenu.scrollable.AddRow(optionsMenu.AddHeader(0, "Follow Camera <size=5>Must be set to 3rd person static</size>")); optionsMenu.scrollable.AddRow(positionSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(rotationSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(camOffsetSlider.gameObject); optionsMenu.scrollable.AddRow(camHeightSlider.gameObject); optionsMenu.scrollable.AddRow(camDistanceSlider.gameObject); optionsMenu.scrollable.AddRow(camRotationSlider.gameObject); if (activated) { spectatorCam.previewCam.gameObject.SetActive(true); spectatorCam.previewCamDisplay.SetActive(true); } }
private static void AddButtons(OptionsMenu optionsMenu) { optionsMenu.AddHeader(0, "Skybox controls"); var RotationSlider = optionsMenu.AddSlider(0, "Skybox Rotation", "P", new Action <float>(x => { ArenaLoaderMod.RotateSkybox(x * 5); }), null); RotationSlider.label.text = "Rotation"; var ExposureSlider = optionsMenu.AddSlider(1, "Skybox Exposure", "P", new Action <float>(x => { ArenaLoaderMod.ChangeExposure(x * 0.05f); }), null); ExposureSlider.label.text = "Brightness"; var ReflectionSlider = optionsMenu.AddSlider(0, "Skybox Reflection", "P", new Action <float>(x => { ArenaLoaderMod.ChangeReflectionStrength(x * 0.05f); }), null); ReflectionSlider.label.text = "Reflection"; optionsMenu.AddTextBlock(0, "These settings will reset when you enter a new arena. A way to save current arena settings will be added in a future update"); optionsMenu.AddHeader(0, "Custom skybox"); OptionsMenuSlider skyboxSlider = optionsMenu.AddSlider(0, "Custom Skybox", null, new Action <float>((amount) => { ArenaLoaderMod.skyboxLoader.Index += (int)amount; }), new Func <float>(() => { return((float)ArenaLoaderMod.skyboxLoader.Index); }), new Action(() => { ArenaLoaderMod.skyboxLoader.Index = 0; }), "Skybox to load", new Func <float, string>((amount) => { if (ArenaLoaderMod.skyboxLoader.skyboxes.Count == 0) { return("Skybox folder is empty"); } Material currentSkybox = ArenaLoaderMod.skyboxLoader.skyboxes[ArenaLoaderMod.skyboxLoader.Index]; if (currentSkybox != null) { return(currentSkybox.name); } else { return("Skybox folder is empty"); } }), optionsMenu.sliderCustomModelPrefab); skyboxSlider.transform.Find("reload").gameObject.SetActive(false); // Disables the reload icon. optionsMenu.AddButton(0, "Apply skybox", new Action(() => { if (ArenaLoaderMod.skyboxLoader.skyboxes.Count == 0) { return; } var newSkybox = ArenaLoaderMod.skyboxLoader.skyboxes[ArenaLoaderMod.skyboxLoader.Index]; if (newSkybox != null) { ArenaLoaderMod.UpdateSkybox(newSkybox); } }), null, "Apply the currently selected skybox"); optionsMenu.AddButton(0, "Reload skybox folder", new Action(() => { ArenaLoaderMod.skyboxLoader.LoadSkyboxes(); }), null, "Deletes the currently loaded skyboxes and reloads the folder.\n<color=red>Only use this for working on skyboxes</color>"); optionsMenu.AddTextBlock(0, "Create your own custom skyboxes from images in Audica\\Mods\\Arenas\\Skyboxes\nTo reset a custom skybox, load a different arena."); }
public static void ShowPage(OptionsMenu optionsMenu, OptionsMenu.Page page) { if (page == OptionsMenu.Page.SpectatorCam && !menuCreated) { /*string toggleText = "OFF"; * * if (config.activated) * { * toggleText = "ON"; * } * * toggleButton = optionsMenu.AddButton * (0, * toggleText, * new Action(() => { * if (config.activated) * { * config.activated = false; * toggleButton.label.text = "OFF"; * SaveConfig(); * } * else * { * config.activated = true; * toggleButton.label.text = "ON"; * SaveConfig(); * } * }), * null, * "Turns the follow camera on or off"); */ positionSmoothingSlider = optionsMenu.AddSlider ( 0, "Position Speed", "P", new Action <float>((float n) => { config.positionSmoothing = Mathf.Round((config.positionSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(positionSmoothingSlider, "Position Smoothing : " + config.positionSmoothing.ToString()); }), null, null, "Changes how smooth position will be" ); positionSmoothingSlider.label.text = "Position Smoothing : " + config.positionSmoothing.ToString(); rotationSmoothingSlider = optionsMenu.AddSlider ( 0, "Rotation Speed", "P", new Action <float>((float n) => { config.rotationSmoothing = Mathf.Round((config.rotationSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(rotationSmoothingSlider, "Rotation Smoothing : " + config.rotationSmoothing.ToString()); }), null, null, "Changes how smooth rotation will be" ); rotationSmoothingSlider.label.text = "Rotation Smoothing : " + config.rotationSmoothing.ToString(); camOffsetSlider = optionsMenu.AddSlider ( 0, "Horizontal Offset", "P", new Action <float>((float n) => { config.camOffset = Mathf.Round((config.camOffset + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camOffsetSlider, "Horizontal Offset : " + config.camOffset.ToString()); }), null, null, "Changes horizontal position" ); camOffsetSlider.label.text = "Horizontal Offset : " + config.camOffset.ToString(); camHeightSlider = optionsMenu.AddSlider ( 0, "Vertical Offset", "P", new Action <float>((float n) => { config.camHeight = Mathf.Round((config.camHeight + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camHeightSlider, "Vertical Offset : " + config.camHeight.ToString()); }), null, null, "Changes vertical position" ); camHeightSlider.label.text = "Vertical Offset : " + config.camHeight.ToString(); camDistanceSlider = optionsMenu.AddSlider ( 0, "Distance", "P", new Action <float>((float n) => { config.camDistance = Mathf.Round((config.camDistance + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camDistanceSlider, "Distance : " + config.camDistance.ToString()); }), null, null, "Changes the distance" ); camDistanceSlider.label.text = "Distance : " + config.camDistance.ToString(); camRotationSlider = optionsMenu.AddSlider ( 0, "Tilt", "P", new Action <float>((float n) => { config.camRotation = Mathf.Round((config.camRotation + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camRotationSlider, "Rotation : " + config.camRotation.ToString()); }), null, null, "Changes the rotation" ); camRotationSlider.label.text = "Rotation : " + config.camRotation.ToString(); optionsMenu.scrollable.AddRow(optionsMenu.AddHeader(0, "Follow Camera <size=5>Must be set to 3rd person static</size>")); //optionsMenu.scrollable.AddRow(toggleButton.gameObject); optionsMenu.scrollable.AddRow(positionSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(rotationSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(camOffsetSlider.gameObject); optionsMenu.scrollable.AddRow(camHeightSlider.gameObject); optionsMenu.scrollable.AddRow(camDistanceSlider.gameObject); optionsMenu.scrollable.AddRow(camRotationSlider.gameObject); if (config.activated) { spectatorCam.previewCam.gameObject.SetActive(true); spectatorCam.previewCamDisplay.SetActive(true); } menuCreated = true; } else { menuCreated = false; } }