diff --git a/Assets/Plugins/WebGL.meta b/Assets/Plugins/WebGL.meta new file mode 100644 index 00000000..2cb54477 --- /dev/null +++ b/Assets/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b79ff2536e7bd7d43a30a96d2ff0c437 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/WebGL/React.jslib b/Assets/Plugins/WebGL/React.jslib new file mode 100644 index 00000000..119743a7 --- /dev/null +++ b/Assets/Plugins/WebGL/React.jslib @@ -0,0 +1,5 @@ +mergeInto(LibraryManager.library, { + GameReady: function (userName, score) { + window.dispatchReactUnityEvent("GameReady"); + }, +}); \ No newline at end of file diff --git a/Assets/Plugins/WebGL/React.jslib.meta b/Assets/Plugins/WebGL/React.jslib.meta new file mode 100644 index 00000000..ecb6555f --- /dev/null +++ b/Assets/Plugins/WebGL/React.jslib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: dfdac476cf2dfdc4a91aae6cf6387eb3 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Cgs/Menu/MainMenu.cs b/Assets/Scripts/Cgs/Menu/MainMenu.cs index f2fb44e5..469b67bf 100644 --- a/Assets/Scripts/Cgs/Menu/MainMenu.cs +++ b/Assets/Scripts/Cgs/Menu/MainMenu.cs @@ -10,8 +10,6 @@ using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityExtensionMethods; -#if !UNITY_ANDROID && !UNITY_IOS -#endif namespace Cgs.Menu { @@ -187,17 +185,21 @@ private void ResetGameSelectionCarousel() [UsedImplicitly] public void SelectPrevious() { +#if !UNITY_WEBGL if (Time.timeSinceLevelLoad < StartBufferTime) return; CardGameManager.Instance.Select(CardGameManager.Instance.Previous.Id); +#endif } [UsedImplicitly] public void SelectNext() { +#if !UNITY_WEBGL if (Time.timeSinceLevelLoad < StartBufferTime) return; CardGameManager.Instance.Select(CardGameManager.Instance.Next.Id); +#endif } [UsedImplicitly] diff --git a/Assets/Scripts/Cgs/Menu/TitleScreen.cs b/Assets/Scripts/Cgs/Menu/TitleScreen.cs index b7babf47..30246f26 100644 --- a/Assets/Scripts/Cgs/Menu/TitleScreen.cs +++ b/Assets/Scripts/Cgs/Menu/TitleScreen.cs @@ -5,11 +5,18 @@ using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; +#if UNITY_WEBGL && !UNITY_EDITOR +using System.Runtime.InteropServices; +#endif namespace Cgs.Menu { public class TitleScreen : MonoBehaviour { +#if UNITY_WEBGL && !UNITY_EDITOR + [DllImport("__Internal")] + private static extern void GameReady(); +#endif public const string TouchlessStartMessage = "Press Any Key"; public static string VersionMessage => $"VERSION {Application.version}"; @@ -93,6 +100,9 @@ private void Start() centerText.text = TouchlessStartMessage; #endif versionText.text = VersionMessage; +#if UNITY_WEBGL && !UNITY_EDITOR + GameReady(); +#endif } private void Update()