public static void GoToWebSearchPage() { SongDownloader.StartNewSongSearch(); if (backButton == null) { var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back"); backButton = button.GetComponentInChildren <GunButton>(); backText = button.GetComponentInChildren <TextMeshPro>(); originalBackText = backText.text; UnityEngine.Object.Destroy(button.GetComponentInChildren <Localizer>()); } if (songItemPanel == null) { secondaryPanel = GameObject.Instantiate(GameObject.Find("ShellPage_Settings")); secondaryPanel.SetActive(true); secondaryPanel.transform.Rotate(0, -65, 0); SpawnSecondaryPanel(secondaryPanel); } else { SpawnSecondaryPanel(secondaryPanel); } primaryMenu.ShowPage(OptionsMenu.Page.Customization); CleanUpPage(primaryMenu); AddButtons(primaryMenu); primaryMenu.screenTitle.text = "Filters"; Config.UpdateSongCount(SongBrowser.newSongCount); //User has seen new songs }
private static void CreateDownloadMissingButton() { if (!SongRequests.hasCompatibleSongBrowser) { return; } if (downloadMissingButton != null) { downloadMissingButton.SetActive(true); return; } GameObject backButton = GameObject.Find("menu/ShellPage_Song/page/backParent/back"); if (backButton == null) { return; } downloadMissingButton = CreateButton(backButton, "Download missing", OnDownloadMissingShot, downloadButtonPos, downloadButtonScale); downloadMissingButton.SetActive(additionalGUIActive); downloadGunButton = downloadMissingButton.GetComponentInChildren <GunButton>(); downloadButtonText = downloadMissingButton.GetComponentInChildren <TextMeshPro>(); UpdateButtonText(); }
public static IEnumerator CreateRefreshButton() { yield return(new WaitForSeconds(.8f)); if (refreshButton != null) { refreshButton.SetActive(true); yield break; } var backButton = GameObject.Find("menu/ShellPage_Song/page/backParent/back"); refreshButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform); GameObject.Destroy(refreshButton.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = refreshButton.GetComponentInChildren <TextMeshPro>(); buttonText.text = "Refresh Songs"; GunButton button = refreshButton.GetComponentInChildren <GunButton>(); button.destroyOnShot = true; button.doMeshExplosion = true; button.doParticles = true; button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(new Action(() => { OnRefreshButtonShot(); })); refreshButton.transform.position = randomButtonPos; refreshButton.transform.rotation = Quaternion.Euler(randomButtonRot); }
//creates the button used ingame for intro skipping private static GameObject CreateButton(GameObject buttonPrefab, string label, Action onHit, Vector3 position, Vector3 eulerRotation, Vector3 scale) { GameObject buttonObject = UnityEngine.Object.Instantiate(buttonPrefab); buttonObject.transform.rotation = Quaternion.Euler(eulerRotation); buttonObject.transform.position = position; buttonObject.transform.localScale = scale; UnityEngine.Object.Destroy(buttonObject.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = buttonObject.GetComponentInChildren <TextMeshPro>(); buttonText.text = label; //turn off destroy event so we don't lose the reference, disable particles so they don't hit the player's face GunButton button = buttonObject.GetComponentInChildren <GunButton>(); //don't comment this out, else you'll lose your reference to the button button.destroyOnShot = false; //comment out from here... button.doMeshExplosion = false; button.doParticles = false; //..to here if you want the explosion effect to play button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(onHit); return(buttonObject.gameObject); }
public void EnableBackButton() { if (backButton != null) { backButton.SetInteractable(true); backButtonLabel.text = "Back"; backButtonLabel.alpha = 1f; backButton = null; backButtonLabel = null; } }
private static void PrepareFavoritesButton() { favoritesButton = GameObject.Instantiate(filterButton, filterButton.transform.parent); favoritesButton.transform.localPosition = new Vector3(0f, -8.09f, 0f); GameObject.Destroy(favoritesButton.GetComponentInChildren <Localizer>()); GunButton button = favoritesButton.GetComponentInChildren <GunButton>(); button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(new Action(() => { FilterFavorites(); })); favoritesButton.GetComponentInChildren <TextMeshPro>().text = "favorites"; }
private static void AddModSettingsButton() { modSettingsButton = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Party/Button").GetComponent <GunButton>(); modSettingsButtonLabel = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Party/Label").GetComponent <TextMeshPro>(); GameObject.Destroy(modSettingsButtonLabel.gameObject.GetComponent <Localizer>()); modSettingsButtonLabel.text = "Mod Settings"; modSettingsButton.onHitEvent = new UnityEvent(); modSettingsButton.onHitEvent.AddListener(new Action(() => { OpenModSettingsMenu(); })); }
private static void UpdateButtonEnabled(GunButton button, TextMeshPro text) { if (Utility.IsCustomSong(SongDataHolder.I.songData.songID)) { button.SetInteractable(true); text.alpha = 1.0f; } else { button.SetInteractable(false); text.alpha = 0.25f; } }
private static void PrepareFilterButton(Filter filter) { filter.Button = GameObject.Instantiate(extrasButton, extrasButton.transform.parent); GameObject.Destroy(filter.Button.GetComponentInChildren <Localizer>()); GunButton button = filter.Button.GetComponentInChildren <GunButton>(); button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(new Action(() => { OnFilterHit(filter.FilterID); })); filter.ButtonText = filter.Button.GetComponentInChildren <TextMeshPro>(); filter.ButtonText.text = filter.DefaultButtonText; filter.ButtonSelectedIndicator = filter.Button.transform.GetChild(3).gameObject; filter.ButtonSelectedIndicator.SetActive(filter.IsActive); }
public static void CreateDeleteButton(ButtonUtils.ButtonLocation location = ButtonUtils.ButtonLocation.Menu) { // can only reuse the menu button, InGameUI gets recreated each time if (location == ButtonUtils.ButtonLocation.Menu && delete != null) { delete.SetActive(true); UpdateButtonEnabled(deleteButton, deleteText); return; } string name = "InGameUI/ShellPage_EndGameContinue/page/ShellPanel_Center/exit"; Vector3 localPosition = delButtonInGameUIPosition; Vector3 rotation = delButtonInGameUIRotation; Action listener = new Action(() => { OnInGameUIDeleteButtonShot(); }); if (location == ButtonUtils.ButtonLocation.Failed) { name = "InGameUI/ShellPage_Failed/page/ShellPanel_Center/exit"; } else if (location == ButtonUtils.ButtonLocation.Pause) { name = "InGameUI/ShellPage_Pause/page/ShellPanel_Center/exit"; } else if (location == ButtonUtils.ButtonLocation.PracticeModeOver) { name = "InGameUI/ShellPage_PracticeModeOver/page/ShellPanel_Center/exit"; } else if (location == ButtonUtils.ButtonLocation.Menu) { name = "menu/ShellPage_Launch/page/backParent/back"; listener = new Action(() => { OnDeleteButtonShot(); }); localPosition = delButtonMenuPosition; rotation = delButtonMenuRotation; } var refButton = GameObject.Find(name); GameObject button = GameObject.Instantiate(refButton, refButton.transform.parent.transform); GunButton gunButton = button.GetComponentInChildren <GunButton>(); TextMeshPro tmp = button.GetComponentInChildren <TextMeshPro>(); ButtonUtils.InitButton(button, "Delete", listener, localPosition, rotation); UpdateButtonEnabled(gunButton, tmp); if (location == ButtonUtils.ButtonLocation.Menu) { delete = button; deleteButton = gunButton; deleteText = tmp; } }
public void DownloadSingleSong(string filename, bool showPopup, GunButton button, TextMeshPro label) { if (backButton is null && button != null) { backButton = button; backButtonLabel = label; backButton.SetInteractable(false); backButtonLabel.text = "Loading.."; backButtonLabel.alpha = .25f; } if (showPopup) { PlaylistUtil.Popup("Downloading.."); } MelonCoroutines.Start(SongDownloader.DoSongWebSearch(filename, OnWebSearchDone, DifficultyFilter.All, false, 1, false, true)); }
public void Start() { STATIC_GUNS = PlayerPrefs.GetInt("static_guns", 0) == 1; EventManager em = EventManager.Instance(); em.RegisterForEventType("dial_locked", this); GameObject buttonHolder = GameObject.Find("GunButtons"); for (int i = 1; i <= 6; i++) { GunButton gb = buttonHolder.transform.Find("Button" + i).GetComponent <GunButton>(); gbuttons[i - 1] = gb; baseGuns[i - 1] = gb.gun; } }
public static void InitButton(GameObject button, string label, Action listener, Vector3 localPosition, Vector3 rotation) { GameObject.Destroy(button.GetComponentInChildren <Localizer>()); UpdateButtonLabel(button, label); GunButton gb = button.GetComponentInChildren <GunButton>(); gb.destroyOnShot = false; gb.doMeshExplosion = false; gb.doParticles = false; gb.onHitEvent = new UnityEvent(); gb.onHitEvent.AddListener(listener); button.transform.localPosition = localPosition; button.transform.Rotate(rotation); }
public static void CreateRandomSongButton() { if (randomSongButton != null) { randomSongButton.SetActive(true); if (enabled) { randomSongGB.SetInteractable(true); } else { randomSongGB.SetInteractable(false); } return; } var backButton = GameObject.Find("menu/ShellPage_Song/page/backParent/back"); if (backButton == null) { return; } randomSongButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform); ButtonUtils.InitButton(randomSongButton, "Random Song", new Action(() => { OnRandomSongButtonShot(); }), randomSongButtonPos, randomSongButtonRot); randomSongGB = randomSongButton.GetComponentInChildren <GunButton>(); if (enabled) { randomSongGB.SetInteractable(true); } else { randomSongGB.SetInteractable(false); } }
private static GameObject CreateButton(GameObject buttonPrefab, string label, Action onHit, Vector3 position, Vector3 eulerRotation, Vector3 scale) { GameObject buttonObject = UnityEngine.Object.Instantiate(buttonPrefab); buttonObject.transform.rotation = Quaternion.Euler(eulerRotation); buttonObject.transform.position = position; buttonObject.transform.localScale = scale; UnityEngine.Object.Destroy(buttonObject.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = buttonObject.GetComponentInChildren <TextMeshPro>(); buttonText.text = label; GunButton button = buttonObject.GetComponentInChildren <GunButton>(); button.destroyOnShot = false; button.disableOnShot = false; button.SetSelected(false); button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(onHit); return(buttonObject.gameObject); }
private static GameObject CreateButton(GameObject buttonPrefab, string label, System.Action onHit, Vector3 position, Vector3 scale) { GameObject buttonObject = Object.Instantiate(buttonPrefab, buttonPrefab.transform.parent); buttonObject.transform.localPosition = position; buttonObject.transform.localScale = scale; buttonObject.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f); Object.Destroy(buttonObject.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = buttonObject.GetComponentInChildren <TextMeshPro>(); buttonText.text = label; GunButton button = buttonObject.GetComponentInChildren <GunButton>(); button.destroyOnShot = false; button.disableOnShot = false; button.SetSelected(false); button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(onHit); return(buttonObject.gameObject); }
public static void GoToMissingSongsPage() { needsSongListRefresh = false; songItemMenu.ShowPage(OptionsMenu.Page.Customization); if (backButton == null) { var button = GameObject.Find("menu/ShellPage_Settings/page/backParent/back"); backButton = button.GetComponentInChildren <GunButton>(); // set up "download all" button downloadAllButton = UnityEngine.Object.Instantiate(button, button.transform.parent); downloadAllButton.transform.localPosition = new Vector3(-0.8f, 2.0f, 0.0f); downloadAllButton.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); downloadAllButton.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f); UnityEngine.Object.Destroy(downloadAllButton.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = downloadAllButton.GetComponentInChildren <TextMeshPro>(); buttonText.text = "Download all"; Action onHit = new Action(() => { OnDownloadAll(); }); GunButton btn = downloadAllButton.GetComponentInChildren <GunButton>(); btn.destroyOnShot = false; btn.disableOnShot = false; btn.SetSelected(false); btn.onHitEvent = new UnityEvent(); btn.onHitEvent.AddListener(onHit); } else { downloadAllButton.SetActive(true); } missingSongsIDs = new List <string>(SongRequests.missingSongs.Keys); SetupList(); AddSongItems(songItemMenu); }
public static void Init(InGameUI inGameUI) { var templateSlider = inGameUI.transform.GetChild(15).GetChild(0).GetChild(6).gameObject; offsetSlider = GameObject.Instantiate(templateSlider); GameObject.Destroy(offsetSlider.GetComponentInChildren <Localizer>()); offsetSliderLeft = offsetSlider.transform.GetChild(3).GetComponentInChildren <GunButton>(); offsetSliderRight = offsetSlider.transform.GetChild(4).GetComponentInChildren <GunButton>(); offsetSliderLeft.onHitEvent = new UnityEvent(); offsetSliderRight.onHitEvent = new UnityEvent(); offsetSliderLeft.onHitEvent.AddListener(new Action(() => { SettingsManager.ChangeInputOffset(SongDataHolder.I.songData.songID, -1); UpdateLabels(); })); offsetSliderRight.onHitEvent.AddListener(new Action(() => { SettingsManager.ChangeInputOffset(SongDataHolder.I.songData.songID, 1); UpdateLabels(); })); offsetSliderLabel = offsetSlider.transform.GetChild(0).GetComponent <TextMeshPro>(); offsetSliderLabel.text = "Input Offset"; offsetSlider.transform.position = new Vector3(-1.817f, -4.18f, 13.982f); offsetSlider.transform.localScale = new Vector3(0.4964773f, 0.4964773f, 0.4964773f); offsetSlider.transform.rotation = Quaternion.EulerAngles(Vector3.zero); targetSpeedSlider = GameObject.Instantiate(templateSlider); GameObject.Destroy(targetSpeedSlider.GetComponentInChildren <Localizer>()); targetSpeedSliderLeft = targetSpeedSlider.transform.GetChild(3).GetComponentInChildren <GunButton>(); targetSpeedSliderRight = targetSpeedSlider.transform.GetChild(4).GetComponentInChildren <GunButton>(); targetSpeedSliderLeft.onHitEvent = new UnityEvent(); targetSpeedSliderRight.onHitEvent = new UnityEvent(); targetSpeedSliderLeft.onHitEvent.AddListener(new Action(() => { SettingsManager.ChangeTargetSpeed(SongDataHolder.I.songData.songID, -0.1f); UpdateLabels(); })); targetSpeedSliderRight.onHitEvent.AddListener(new Action(() => { SettingsManager.ChangeTargetSpeed(SongDataHolder.I.songData.songID, 0.1f); UpdateLabels(); })); targetSpeedSliderLabel = targetSpeedSlider.transform.GetChild(0).GetComponent <TextMeshPro>(); targetSpeedSliderLabel.text = "Target Speed"; targetSpeedSlider.transform.position = new Vector3(1.817f, -4.18f, 13.982f); targetSpeedSlider.transform.localScale = new Vector3(0.4964773f, 0.4964773f, 0.4964773f); targetSpeedSlider.transform.rotation = Quaternion.EulerAngles(Vector3.zero); UpdateLabels(); }
/// <summary> /// Makes sure the Song and Party buttons are only available if there is not currently /// an ongoing song search. /// </summary> public static void UpdateUI() { if (!Config.SafeSongListReload) { return; } if ((!searching || disabled || MenuState.GetState() != MenuState.State.MainPage) && !PlaylistDownloadManager.IsDownloadingMissing) { return; } disabled = true; if (soloButton == null) { soloButton = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Solo/Button").GetComponent <GunButton>(); soloButtonLabel = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Solo/Label").GetComponent <TextMeshPro>(); GameObject.Destroy(soloButtonLabel.gameObject.GetComponent <Localizer>()); } originalSoloButtonText = soloButtonLabel.text; soloButtonLabel.text = "Loading..."; soloButton.SetInteractable(false); if (!SongBrowser.modSettingsInstalled) { if (partyButton == null) { partyButton = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Party/Button").GetComponent <GunButton>(); partyButtonLabel = GameObject.Find("menu/ShellPage_Main/page/ShellPanel_Center/Party/Label").GetComponent <TextMeshPro>(); GameObject.Destroy(partyButtonLabel.gameObject.GetComponent <Localizer>()); } originalPartyButtonText = partyButtonLabel.text; partyButtonLabel.text = "Loading..."; partyButton.SetInteractable(false); } }
public static void CreateRandomSongButton() { if (randomSongButton != null) { randomSongButton.SetActive(true); return; } var backButton = GameObject.Find("menu/ShellPage_Song/page/backParent/back"); randomSongButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform); GameObject.Destroy(randomSongButton.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = randomSongButton.GetComponentInChildren <TextMeshPro>(); buttonText.text = "Random Song"; GunButton button = randomSongButton.GetComponentInChildren <GunButton>(); button.destroyOnShot = false; button.doMeshExplosion = false; button.doParticles = false; button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(new Action(() => { OnRandomSongButtonShot(); })); randomSongButton.transform.position = randomButtonPos; randomSongButton.transform.rotation = Quaternion.Euler(randomButtonRot); }
public static void CreateDeleteButton() { if (deleteButton != null) { deleteButton.SetActive(true); return; } var backButton = GameObject.Find("menu/ShellPage_Launch/page/backParent/back"); deleteButton = GameObject.Instantiate(backButton, backButton.transform.parent.transform); GameObject.Destroy(deleteButton.GetComponentInChildren <Localizer>()); TextMeshPro buttonText = deleteButton.GetComponentInChildren <TextMeshPro>(); buttonText.text = "Delete"; GunButton button = deleteButton.GetComponentInChildren <GunButton>(); button.destroyOnShot = false; button.doMeshExplosion = false; button.doParticles = false; button.onHitEvent = new UnityEvent(); button.onHitEvent.AddListener(new Action(() => { OnDeleteButtonShot(); })); deleteButton.transform.localPosition = new Vector3(-12.28f, -0.68f, -6.38f); deleteButton.transform.Rotate(0f, -51.978f, 0f); }
public static void Initialize() { if (modMenu == null) { modMenu = GameObject.Instantiate(GameObject.Find("menu/ShellPage_Settings")); modMenu.hideFlags |= HideFlags.DontUnloadUnusedAsset; modMenuSP = modMenu.GetComponent <ShellPage>(); modMenuOM = modMenu.transform.Find("page/ShellPanel_Center/Settings/Options").GetComponent <OptionsMenu>(); scroller = modMenuOM.gameObject.GetComponent <ShellScrollable>(); backButton = modMenu.transform.Find("page/backParent/back/Button").GetComponent <GunButton>(); backButton.onHitEvent = new UnityEvent(); backButton.onHitEvent.AddListener(new Action(() => { if (displayState == DisplayState.Prefs) { PreparePage(); } else { HideModSettingsMenu(); } })); } }
public static void DownloadSingleSong(string songName, bool showPopup, GunButton button, TextMeshPro label) { downloadManager.DownloadSingleSong(songName, showPopup, button, label); }
public static void DownloadSongs(List <string> songs, bool showPopup, GunButton button, TextMeshPro label) { downloadManager.DownloadSongs(songs, showPopup, button, label); }