public void SetParams(string message, Action <int> result, string[] buttonText, TMP_FontAsset[] buttonAsset) { if (IsEnabled) { throw new Exception("Dialog box is already enabled! Please wait until this Dialog Box has been disabled."); } CMInputCallbackInstaller.DisableActionMaps(typeof(CM_DialogBox), disabledActionMaps); UpdateGroup(true); CameraController.ClearCameraMovement(); // Ignore yes/no colours for the dark theme and just use the default (no-outline) font UIMessage.text = message; resultAction = result; for (int i = 0; i < buttonText.Length; i++) { SetupButton( i, buttonText[i], Settings.Instance.DarkTheme || buttonAsset == null ? defaultFont : buttonAsset[i], buttonText.Length > 3 ? 80 : 100 ); } // Make sure any extra buttons are hidden for (int i = buttonText.Length; i < TempButtons.Count + 1; i++) { SetupButton(i, null, null); } }
public void NodeEditor_StartEdit(string _) { if (IsActive) { CMInputCallbackInstaller.DisableActionMaps(actionMapsDisabled); CMInputCallbackInstaller.DisableActionMaps(new[] { typeof(CMInput.INodeEditorActions) }); } }
public static void ShowOptions(int loadGroup = 0) { if (IsActive) { return; } SceneManager.LoadScene("04_Options", LoadSceneMode.Additive); CMInputCallbackInstaller.DisableActionMaps(typeof(OptionsController), typeof(CMInput).GetNestedTypes().Where(x => x.IsInterface)); OptionsLoadedEvent?.Invoke(); IsActive = true; }
public void SetParams(string message, Action <string> result, string defaultText = "") { if (IsEnabled) { throw new Exception("Input box is already enabled! Please wait until this Input Box has been disabled."); } CMInputCallbackInstaller.DisableActionMaps(disabledActionMaps); UpdateGroup(true); UIMessage.text = message; InputField.text = defaultText; resultAction = result; }
public void BrowseForImage() { var extensions = new[] { new ExtensionFilter("Image Files", "png", "jpg", "jpeg"), new ExtensionFilter("All Files", "*"), }; string songDir = BeatSaberSongContainer.Instance.song.directory; CMInputCallbackInstaller.DisableActionMaps(typeof(ContributorListItem), new[] { typeof(CMInput.IMenusExtendedActions) }); var paths = StandaloneFileBrowser.OpenFilePanel("Open File", songDir, extensions, false); StartCoroutine(ClearDisabledActionMaps()); if (paths.Length > 0) { DirectoryInfo directory = new DirectoryInfo(songDir); FileInfo file = new FileInfo(paths[0]); string fullDirectory = directory.FullName; string fullFile = file.FullName; #if UNITY_STANDALONE_WIN bool ignoreCase = true; #else bool ignoreCase = false; #endif if (!fullFile.StartsWith(fullDirectory, ignoreCase, CultureInfo.InvariantCulture)) { if (FileExistsAlready(songDir, file.Name)) { return; } PersistentUI.Instance.ShowDialogBox("SongEditMenu", "files.badpath", result => { if (FileExistsAlready(songDir, file.Name)) { return; } if (result == 0) { File.Copy(fullFile, Path.Combine(songDir, file.Name)); SetImageLocation(file.Name); } }, PersistentUI.DialogBoxPresetType.YesNo); } else { SetImageLocation(fullFile.Substring(fullDirectory.Length + 1)); } } }
public void OnReplaceBPMinExistingBPMChangeClick(InputAction.CallbackContext context) { if (context.performed && modifierPressed) { RaycastFirstObject(out containerToEdit); if (containerToEdit != null) { CMInputCallbackInstaller.DisableActionMaps(actionMapsDisabled); PersistentUI.Instance.ShowInputBox("Please enter the new BPM for this BPM change.", AttemptPlaceBPMChange, containerToEdit.bpmData._BPM.ToString()); } } }
public void NodeEditor_StartEdit(string content) { if (IsActive) { if (!CMInputCallbackInstaller.IsActionMapDisabled(actionMapsDisabled[0])) { CMInputCallbackInstaller.DisableActionMaps(typeof(NodeEditorController), new[] { typeof(CMInput.INodeEditorActions) }); CMInputCallbackInstaller.DisableActionMaps(typeof(NodeEditorController), actionMapsDisabled); } } oldInputText = content; oldCaretPosition = nodeEditorInputField.caretPosition; }
public void OnToggleNodeEditor(InputAction.CallbackContext context) { if (Settings.Instance.NodeEditor_UseKeybind && AdvancedSetting && context.performed && !PersistentUI.Instance.InputBox_IsEnabled) { StopAllCoroutines(); if (IsActive) { CMInputCallbackInstaller.ClearDisabledActionMaps(new[] { typeof(CMInput.INodeEditorActions) }); CMInputCallbackInstaller.ClearDisabledActionMaps(actionMapsDisabled); } else { CMInputCallbackInstaller.DisableActionMaps(actionMapsDisabled); } StartCoroutine(UpdateGroup(!IsActive, transform as RectTransform)); } }
internal override void ApplyToMap() { if (objectContainerCollection.LoadedContainers.Count >= BPMChangesContainer.ShaderArrayMaxSize) { if (!PersistentUI.Instance.DialogBox_IsEnabled) { PersistentUI.Instance.ShowDialogBox( "Due to Unity shader restrictions, the maximum amount of BPM Changes you can have is " + (BPMChangesContainer.ShaderArrayMaxSize - 1) + ".", null, PersistentUI.DialogBoxPresetType.Ok); } return; } CMInputCallbackInstaller.DisableActionMaps(actionMapsDisabled); PersistentUI.Instance.ShowInputBox("Please enter the BPM for this new BPM change.", AttemptPlaceBPMChange, BeatSaberSongContainer.Instance.song.beatsPerMinute.ToString()); }
public void TogglePause() { IsPaused = !IsPaused; if (IsPaused) { CMInputCallbackInstaller.DisableActionMaps(typeof(PauseManager), disabledActionMaps); previousUIModeType = uiMode.selectedMode; uiMode.SetUIMode(UIModeType.NORMAL, false); foreach (LightsManager e in platform.gameObject.GetComponentsInChildren <LightsManager>()) { e.ChangeAlpha(0, 1, e.ControllingLights); } } else { CMInputCallbackInstaller.ClearDisabledActionMaps(typeof(PauseManager), disabledActionMaps); uiMode.SetUIMode(previousUIModeType, false); } StartCoroutine(TransitionMenu()); }
public void SetParams(string message, Action <int> result, string button0Text = null, string button1Text = null, string button2Text = null, TMP_FontAsset button0Asset = null, TMP_FontAsset button1Asset = null, TMP_FontAsset button2Asset = null) { if (IsEnabled) { throw new Exception("Dialog box is already enabled! Please wait until this Dialog Box has been disabled."); } CMInputCallbackInstaller.DisableActionMaps(disabledActionMaps); UpdateGroup(true); UIMessage.text = message; resultAction = result; UIButtons[0].gameObject.SetActive(button0Text != null); UIButtons[1].gameObject.SetActive(button1Text != null); UIButtons[2].gameObject.SetActive(button2Text != null); UIButtons[0].GetComponentInChildren <TextMeshProUGUI>().text = button0Text ?? ""; UIButtons[1].GetComponentInChildren <TextMeshProUGUI>().text = button1Text ?? ""; UIButtons[2].GetComponentInChildren <TextMeshProUGUI>().text = button2Text ?? ""; UIButtons[0].GetComponentInChildren <TextMeshProUGUI>().font = button0Asset ?? defaultFont; UIButtons[1].GetComponentInChildren <TextMeshProUGUI>().font = button1Asset ?? defaultFont; UIButtons[2].GetComponentInChildren <TextMeshProUGUI>().font = button2Asset ?? defaultFont; }
public void OnToggleNodeEditor(InputAction.CallbackContext context) { if (nodeEditorInputField.isFocused) { return; } if (Settings.Instance.NodeEditor_UseKeybind && context.performed && !PersistentUI.Instance.InputBox_IsEnabled) { StopAllCoroutines(); if (IsActive) { CMInputCallbackInstaller.ClearDisabledActionMaps(typeof(NodeEditorController), new[] { typeof(CMInput.INodeEditorActions) }); CMInputCallbackInstaller.ClearDisabledActionMaps(typeof(NodeEditorController), actionMapsDisabled); BeatmapActionContainer.RemoveAllActionsOfType <NodeEditorTextChangedAction>(); } else { closeButton.gameObject.SetActive(true); CMInputCallbackInstaller.DisableActionMaps(typeof(NodeEditorController), actionMapsDisabled); } StartCoroutine(UpdateGroup(!IsActive, transform as RectTransform)); } }
public void BrowserForFile() { var exts = new[] { new ExtensionFilter(filetypeName, extensions), new ExtensionFilter("All Files", "*"), }; if (BeatSaberSongContainer.Instance.song is null || BeatSaberSongContainer.Instance.song.directory is null) { PersistentUI.Instance.ShowDialogBox("Cannot locate song directory. Did you forget to save your map?", null, PersistentUI.DialogBoxPresetType.Ok); OnUpdate(); return; } string songDir = BeatSaberSongContainer.Instance.song.directory; CMInputCallbackInstaller.DisableActionMaps(typeof(InputBoxFileValidator), new[] { typeof(CMInput.IMenusExtendedActions) }); var paths = StandaloneFileBrowser.OpenFilePanel("Open File", songDir, exts, false); StartCoroutine(ClearDisabledActionMaps()); if (paths.Length > 0) { DirectoryInfo directory = new DirectoryInfo(songDir); FileInfo file = new FileInfo(paths[0]); string fullDirectory = directory.FullName; string fullFile = file.FullName; #if UNITY_STANDALONE_WIN bool ignoreCase = true; #else bool ignoreCase = false; #endif if (!fullFile.StartsWith(fullDirectory, ignoreCase, CultureInfo.InvariantCulture)) { if (FileExistsAlready(songDir, file.Name)) { return; } PersistentUI.Instance.ShowDialogBox("SongEditMenu", "files.badpath", result => { if (FileExistsAlready(songDir, file.Name)) { return; } if (result == 0) { File.Copy(fullFile, Path.Combine(songDir, file.Name)); input.text = file.Name; OnUpdate(); } }, PersistentUI.DialogBoxPresetType.YesNo); } else { input.text = fullFile.Substring(fullDirectory.Length + 1); OnUpdate(); } } }
private IEnumerator WaitToEnable() { yield return(new WaitForEndOfFrame()); CMInputCallbackInstaller.DisableActionMaps(GetType(), typeof(CMInput).GetNestedTypes().Where(x => x.IsInterface)); }
public void OnSelect(BaseEventData eventData) { CMInputCallbackInstaller.DisableActionMaps(typeof(ColorTMPField), typeof(CMInput).GetNestedTypes().Where(x => x.IsInterface)); }