Skip to content

Commit

Permalink
Tidy some one-time dialog things
Browse files Browse the repository at this point in the history
Confirm message is no longer hard-coded to the anti-piracy dialog's
  • Loading branch information
TheNathannator committed Sep 21, 2024
1 parent a91c6ac commit f10ef48
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
3 changes: 1 addition & 2 deletions Assets/Script/Menu/History/ViewTypes/ReplayViewType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public override async void ViewClick()
if (SettingsManager.Settings.ShowEngineInconsistencyDialog)
{
var dialog = DialogManager.Instance.ShowOneTimeMessage(
Localize.Key("Menu.Dialog.EngineInconsistency.Title"),
Localize.Key("Menu.Dialog.EngineInconsistency.Description"),
"Menu.Dialog.EngineInconsistency",
() =>
{
SettingsManager.Settings.ShowEngineInconsistencyDialog = false;
Expand Down
5 changes: 2 additions & 3 deletions Assets/Script/Menu/Main/MainMenu.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using TMPro;
using TMPro;
using UnityEngine;
using YARG.Core.Input;
using YARG.Helpers;
Expand Down Expand Up @@ -27,8 +27,7 @@ private void Start()
if (!_antiPiracyDialogShown && SettingsManager.Settings.ShowAntiPiracyDialog)
{
DialogManager.Instance.ShowOneTimeMessage(
Localize.Key("Menu.Dialog.AntiPiracy.Title"),
Localize.Key("Menu.Dialog.AntiPiracy.Description"),
"Menu.Dialog.AntiPiracy",
() =>
{
SettingsManager.Settings.ShowAntiPiracyDialog = false;
Expand Down
15 changes: 11 additions & 4 deletions Assets/Script/Menu/Persistent/DialogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,25 @@ public MessageDialog ShowMessage(string title, string message)
/// Displays and returns a one time message dialog. If the "dont show again" toggle is checked,
/// <paramref name="dontShowAgainAction"/> will be invoked.
/// </summary>
/// <remarks>
/// The given localization key must have <c>Title</c>, <c>Description</c>, and <c>Confirm</c> children.
/// </remarks>
/// <inheritdoc cref="ShowDialog{MessageDialog}(MessageDialog)"/>
public OneTimeMessageDialog ShowOneTimeMessage(string title, string message, Action dontShowAgainAction)
public OneTimeMessageDialog ShowOneTimeMessage(string localizationKey, Action dontShowAgainAction)
{
var dialog = ShowDialog(_oneTimeMessagePrefab);

dialog.Title.text = title;
dialog.Message.text = message;
dialog.Title.text = Localize.Key(localizationKey, "Title");
dialog.Message.text = Localize.Key(localizationKey, "Description");

dialog.DontShowAgainAction = dontShowAgainAction;

dialog.ClearButtons();
dialog.AddDialogButton("Menu.Dialog.AntiPiracy.Confirm", MenuData.Colors.ConfirmButton, ClearDialog);
dialog.AddDialogButton(
Localize.MakeKey(localizationKey, "Confirm"),
MenuData.Colors.ConfirmButton,
ClearDialog
);

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public UniTask BuildPreviewUI(Transform uiContainer)
if (!_experimentalDialogShown && SettingsManager.Settings.ShowExperimentalWarningDialog)
{
DialogManager.Instance.ShowOneTimeMessage(
Localize.Key("Menu.Dialog.Experimental.Title"),
Localize.Key("Menu.Dialog.Experimental.Description"),
"Menu.Dialog.Experimental",
() =>
{
SettingsManager.Settings.ShowExperimentalWarningDialog = false;
Expand Down
19 changes: 11 additions & 8 deletions Assets/StreamingAssets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,17 @@
}
},
"Dialog": {
"DontShowAgain": "Don't Show Again",

"AntiPiracy": {
"Title": "YARG Anti-Piracy Statement",
"Description": "<b>YARG stands firmly against all forms of piracy.</b> We neither support nor endorse piracy, as it is a violation of copyright law with serious legal consequences. Our platform's importable content—designed for creators to share their work and for educational purposes—does not justify or excuse piracy.\n\nYARG itself <b>does not</b> use any ripped/pirated assets or music and never will. By using YARG, users agree not to promote or endorse piracy in any way through our platform. Upholding these principles ensures a community that respects copyright, creativity, and legal standards.\n\nYARG stands for \"Yet Another Rhythm Game\" and NOT for pirates.",
"Confirm": "I Understand"
},
"BadSongs": {
"Title": "Some Songs Could Not Be Scanned",
"Description": "One or more of the songs you scanned were corrupted, formatted incorrectly, or encrypted, and <b>could not be loaded into the game.</b>\n\nFor more info, please check the file located at \"{0}\"."
},
"ColorPicker": {
"Title": "Color Picker"
},
Expand All @@ -176,17 +182,14 @@
},
"EngineInconsistency": {
"Title": "Replays Are In Beta",
"Description": "Currently, the replay system is in beta, <b>and <i>may</i> provide inconsistent scores/stats</b>, especially for guitar.\n\nThe end goal is for replays to be reliable and accurate, and we're working on fixing these problems!"
"Description": "Currently, the replay system is in beta, <b>and <i>may</i> provide inconsistent scores/stats</b>, especially for guitar.\n\nThe end goal is for replays to be reliable and accurate, and we're working on fixing these problems!",
"Confirm": "I Understand"
},
"Experimental": {
"Title": "Experimental Features Notice",
"Description": "The options about to be displayed represent a work in progress. These features are subject to change, may contain bugs, and <b>could even cause major problems if enabled</b>."
},
"BadSongs": {
"Title": "Some Songs Could Not Be Scanned",
"Description": "One or more of the songs you scanned were corrupted, formatted incorrectly, or encrypted, and <b>could not be loaded into the game.</b>\n\nFor more info, please check the file located at \"{0}\"."
},
"DontShowAgain": "Don't Show Again"
"Description": "The options about to be displayed represent a work in progress. These features are subject to change, may contain bugs, and <b>could even cause major problems if enabled</b>.",
"Confirm": "I Understand"
}
},
"DifficultySelect": {
"Instrument": "Instrument",
Expand Down

0 comments on commit f10ef48

Please sign in to comment.