2022-08-05 11:47:04 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
using UnityEngine.Scripting;
|
|
|
|
|
|
|
|
|
|
|
|
[assembly: Preserve]
|
|
|
|
|
|
|
2024-03-07 12:12:48 +00:00
|
|
|
|
namespace StarkSDKSpace
|
2022-08-05 11:47:04 +00:00
|
|
|
|
{
|
2024-03-07 12:12:48 +00:00
|
|
|
|
public class StarkWebGLInterface
|
2022-08-05 11:47:04 +00:00
|
|
|
|
{
|
|
|
|
|
|
#if UNITY_WEBPLAYER || UNITY_WEBGL
|
|
|
|
|
|
//以下接口为Web使用,用于调用JS代码。
|
|
|
|
|
|
[method: Preserve]
|
|
|
|
|
|
[DllImport("__Internal")]
|
|
|
|
|
|
public static extern void unityCallJs(string msg);
|
2024-03-07 12:12:48 +00:00
|
|
|
|
|
2022-08-05 11:47:04 +00:00
|
|
|
|
[method: Preserve]
|
|
|
|
|
|
[DllImport("__Internal")]
|
|
|
|
|
|
public static extern string unityCallJsSync(string msg);
|
2024-03-07 12:12:48 +00:00
|
|
|
|
|
2022-08-05 11:47:04 +00:00
|
|
|
|
[method: Preserve]
|
|
|
|
|
|
[DllImport("__Internal")]
|
|
|
|
|
|
public static extern bool h5HasAPI(string apiName);
|
2024-03-07 12:12:48 +00:00
|
|
|
|
|
2022-08-05 11:47:04 +00:00
|
|
|
|
[method: Preserve]
|
|
|
|
|
|
[DllImport("__Internal")]
|
|
|
|
|
|
public static extern string unityMixCallJs(string msg);
|
2024-03-07 12:12:48 +00:00
|
|
|
|
#else
|
|
|
|
|
|
public static void unityCallJs(string msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string unityCallJsSync(string msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool h5HasAPI(string apiName)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string unityMixCallJs(string msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
2022-08-05 11:47:04 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|