23 lines
907 B
C#
23 lines
907 B
C#
using System.Runtime.InteropServices;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace AOT.Boot
|
|
{
|
|
/// <summary>AOT-owned native imports; hot-update code polls events on Unity's main thread.</summary>
|
|
[Preserve]
|
|
public static class WebSocketBridge
|
|
{
|
|
#if UNITY_WEBGL && !UNITY_EDITOR
|
|
[DllImport("__Internal")] public static extern int AIGame_WsCreate(string url);
|
|
[DllImport("__Internal")] public static extern string AIGame_WsPoll(int id);
|
|
[DllImport("__Internal")] public static extern void AIGame_WsSend(int id, string text);
|
|
[DllImport("__Internal")] public static extern void AIGame_WsDispose(int id);
|
|
#else
|
|
public static int AIGame_WsCreate(string url) => 0;
|
|
public static string AIGame_WsPoll(int id) => null;
|
|
public static void AIGame_WsSend(int id, string text) { }
|
|
public static void AIGame_WsDispose(int id) { }
|
|
#endif
|
|
}
|
|
}
|