changhong/wb_unity_pro/Assets/Scripts/Platform/PlatformIOS.cs

67 lines
1.5 KiB
C#
Raw Permalink Normal View History

using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class PlatformIOS : MonoBehaviour
{
public static PlatformIOS Instance;
void Awake()
{
Instance = this;
}
#if UNITY_IPHONE
[DllImport("__Internal")]
public static extern void ShareLink(int id, string json_data);
[DllImport("__Internal")]
public static extern void WXLogin();
[DllImport("__Internal")]
public static extern float GetBatteryLevel();
[DllImport("__Internal")]
public static extern int GetWIFISignalStrength();
[DllImport("__Internal")]
public static extern int GetTeleSignalStrength();
[DllImport("__Internal")]
public static extern void CopyToClipboard(string input);
2026-01-13 18:35:26 +08:00
[DllImport("__Internal")]
public static extern void WX_SetAppId(string appid);
[DllImport("__Internal")]
public static extern void WX_Register();
#endif
static string _roomid = string.Empty;
public void InsertRoom(string roomid)
{
_roomid = roomid;
}
public static string GetRoomID()
{
var tem = _roomid;
_roomid = string.Empty;
return tem;
}
2026-01-13 18:35:26 +08:00
public void SetWeChatAppId(string appId)
{
#if UNITY_IPHONE && !UNITY_EDITOR
Debug.Log("[WX] SSS SetWeChatAppId: " + appId);
WX_SetAppId(appId);
#else
Debug.Log("[WX] SetWeChatAppId: " + appId);
#endif
}
public void RegisterWeChat()
{
#if UNITY_IPHONE && !UNITY_EDITOR
WX_Register();
#else
Debug.Log("[WX] RegisterWeChat");
#endif
}
}