Reformat more files

This commit is contained in:
Santiago Lo Coco 2024-11-06 00:25:24 +01:00
parent f9b441bb51
commit 95d62675e3
2 changed files with 27 additions and 10 deletions

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.MixedReality.Toolkit.UI;
using UnityEngine;
using System;
public class DialogHandler : MonoBehaviour
{
@ -9,7 +9,13 @@ public class DialogHandler : MonoBehaviour
public void OpenDialog(string title, string question, Action action)
{
Dialog dialog = Dialog.Open(dialogPrefab, DialogButtonType.Yes | DialogButtonType.No, title, question, true);
Dialog dialog = Dialog.Open(
dialogPrefab,
DialogButtonType.Yes | DialogButtonType.No,
title,
question,
true
);
if (dialog != null)
{
// myDialog.OnClosed += OnClosedDialogEvent;

View File

@ -51,10 +51,16 @@ public class EndpointLoader : MonoBehaviour
if (availableServices.Count == 0)
{
Debug.LogWarning("Timeout reached. Loading default endpoints...");
dialogHandler.OpenDialog("Timeout reached", "No services found. Load default endpoints?", () =>
{
StartCoroutine(TryLoadingFromDefaultEndpoints());
});
dialogHandler.OpenDialog(
"Timeout reached",
"No services were found within the time limit.\r\n"
+ "Would you like to load the default endpoints now?\r\n"
+ "If you click \"No\", we will continue waiting for mDNS services to appear.",
() =>
{
StartCoroutine(TryLoadingFromDefaultEndpoints());
}
);
}
}
@ -135,10 +141,15 @@ public class EndpointLoader : MonoBehaviour
if (!defaultEndpointLoaded)
{
Debug.LogError("Failed to load default endpoints");
dialogHandler.OpenDialog("Failed to load default endpoints", "Do you want to try one more time?", () =>
{
StartCoroutine(TryLoadingFromDefaultEndpoints());
});
dialogHandler.OpenDialog(
"Failed to load the default endpoints\r\n",
"Do you want to try one more time?\r\n"
+ "If you click \"No\", we will continue waiting for mDNS services to appear.",
() =>
{
StartCoroutine(TryLoadingFromDefaultEndpoints());
}
);
}
}