internal static void showSongRequirements(CustomPreviewBeatmapLevel level, Data.ExtraSongData songData, Data.ExtraSongData.DifficultyData diffData, bool wipFolder) { // suggestionsList.text = ""; reqViewController.Data.Clear(); //Contributors if (songData.contributors.Count() > 0) { foreach (Data.ExtraSongData.Contributor author in songData.contributors) { if (author.icon == null) { if (!string.IsNullOrWhiteSpace(author._iconPath)) { author.icon = Utilities.Utils.LoadSpriteFromFile(level.customLevelPath + "/" + author._iconPath); reqViewController.Data.Add(new CustomCellInfo(author._name, author._role, author.icon)); } else { reqViewController.Data.Add(new CustomCellInfo(author._name, author._role, InfoIcon)); } } else { reqViewController.Data.Add(new CustomCellInfo(author._name, author._role, author.icon)); } } } //WIP Check if (wipFolder) { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + "WIP", "Warning", WarningIcon)); } //Additional Diff Info if (diffData != null) { if (diffData.additionalDifficultyData._requirements.Count() > 0) { foreach (string req in diffData.additionalDifficultyData._requirements) { // Console.WriteLine(req); if (!Collections.capabilities.Contains(req)) { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Missing Requirement", MissingReqIcon)); } else { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Requirement", HaveReqIcon)); } } } if (diffData.additionalDifficultyData._warnings.Count() > 0) { foreach (string req in diffData.additionalDifficultyData._warnings) { // Console.WriteLine(req); reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Warning", WarningIcon)); } } if (diffData.additionalDifficultyData._information.Count() > 0) { foreach (string req in diffData.additionalDifficultyData._information) { // Console.WriteLine(req); reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Info", InfoIcon)); } } if (diffData.additionalDifficultyData._suggestions.Count() > 0) { foreach (string req in diffData.additionalDifficultyData._suggestions) { // Console.WriteLine(req); if (!Collections.capabilities.Contains(req)) { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Missing Suggestion", MissingSuggestionIcon)); } else { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Suggestion", HaveSuggestionIcon)); } } } } reqDialog.Present(); reqViewController._customListTableView.ReloadData(); }
/// <summary> /// Display a keyboard interface to accept user input. /// </summary> /// <param name="title">The title to be displayed above the keyboard.</param> /// <param name="initialValue">The starting value of the keyboard.</param> /// <param name="TextChangedEvent">Callback when the text is modified by the user (when any key is pressed basically).</param> /// <param name="TextEntrySuccessEvent">Callback when the user successfully submits the changed text.</param> /// <param name="TextEntryCancelledEvent">Callback when the user presses the cancel button.</param> /// <returns></returns> public static bool DisplayKeyboard(string title, string initialValue, Action <string> TextChangedEvent = null, Action <string> TextEntrySuccessEvent = null, Action TextEntryCancelledEvent = null) { if (_isKeyboardOpen) { return(false); } if (_keyboardMenu == null) { _keyboardMenu = CreateCustomMenu <CustomMenu>(title); var mainViewController = CreateViewController <CustomViewController>(); _keyboardMenu.SetMainViewController(mainViewController, false, (firstActivation, type) => { if (firstActivation) { var _customKeyboardGO = Instantiate(Resources.FindObjectsOfTypeAll <UIKeyboard>().First(x => x.name != "CustomUIKeyboard"), mainViewController.rectTransform, false).gameObject; Destroy(_customKeyboardGO.GetComponent <UIKeyboard>()); _keyboard = _customKeyboardGO.AddComponent <CustomUIKeyboard>(); _inputText = CreateText(mainViewController.rectTransform, String.Empty, new Vector2(0f, 22f)); _inputText.alignment = TextAlignmentOptions.Center; _inputText.fontSize = 6f; _keyboard.okButtonWasPressedEvent += () => { _textEntrySuccessEvent?.Invoke(_inputText.text); _inputText.text = String.Empty; _keyboard.OkButtonInteractivity = false; _keyboardMenu.Dismiss(); _isKeyboardOpen = false; }; _keyboard.cancelButtonWasPressedEvent += () => { _textEntryCancelledEvent?.Invoke(); _inputText.text = String.Empty; _keyboard.OkButtonInteractivity = false; _keyboardMenu.Dismiss(); _isKeyboardOpen = false; }; _keyboard.textKeyWasPressedEvent += (key) => { _inputText.text += key; _textChangedEvent?.Invoke(_inputText.text); if (_inputText.text.Length > 0) { _keyboard.OkButtonInteractivity = true; } }; _keyboard.deleteButtonWasPressedEvent += () => { if (_inputText.text.Length > 0) { _inputText.text = _inputText.text.Substring(0, _inputText.text.Length - 1); _textChangedEvent?.Invoke(_inputText.text); } if (_inputText.text.Length == 0) { _keyboard.OkButtonInteractivity = false; } }; } _inputText.text = _initialValue; _keyboard.OkButtonInteractivity = _inputText.text.Length > 0; }); } _keyboardMenu.title = title == null ? String.Empty : title; _initialValue = initialValue == null ? String.Empty : initialValue; _textChangedEvent = TextChangedEvent; _textEntrySuccessEvent = TextEntrySuccessEvent; _textEntryCancelledEvent = TextEntryCancelledEvent; if (!_keyboardMenu.Present(false)) { return(false); } _isKeyboardOpen = true; return(true); }
internal static void showSongRequirements(CustomLevel.CustomDifficultyBeatmap beatmap) { if (reqDialog == null) { InitRequirementsMenu(); } // suggestionsList.text = ""; reqViewController.Data.Clear(); if (beatmap.warnings.Count > 0) { foreach (string req in beatmap.warnings) { // Console.WriteLine(req); reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Warning", WarningIcon)); } } if (beatmap.requirements.Count > 0) { foreach (string req in beatmap.requirements) { // Console.WriteLine(req); if (!capabilities.Contains(req)) { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Missing Requirement", MissingReqIcon)); } else { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Requirement", HaveReqIcon)); } } } if (beatmap.suggestions.Count > 0) { foreach (string req in beatmap.suggestions) { // Console.WriteLine(req); if (!capabilities.Contains(req)) { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Missing Suggestion", MissingSuggestionIcon)); } else { reqViewController.Data.Add(new CustomCellInfo("<size=75%>" + req, "Suggestion", HaveSuggestionIcon)); } } } /* * if (!SongLoader.capabilities.Contains(req)) * { * reqString += "<#FF0000>" + req + "<#FFD42A> | "; * ____playButton.interactable = false; * ____practiceButton.interactable = false; * ____playButton.gameObject.GetComponentInChildren<UnityEngine.UI.Image>().color = Color.red; * * } * else * {//(0.000, 0.706, 1.000, 0.784) * reqString += "<#FFD42A>" + req + " | "; * } * * */ reqDialog.Present(); reqViewController._customListTableView.ReloadData(); }