67 lines
1.5 KiB
C#
67 lines
1.5 KiB
C#
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);
|
|
[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;
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
}
|