using BigSpace.XRCore.Base; using System.Collections; using System.Collections.Generic; using System.Net.NetworkInformation; using UnityEngine; #if PICO_SDK || PXR_SDK using Unity.XR.PICO.TOBSupport; #endif public class PicoFunc : Singleton { public string GetCode() { #if PICO_SDK || PXR_SDK if (Application.platform == RuntimePlatform.Android) { return PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.EQUIPMENT_SN); } #endif string mac = ""; NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adaper in nis) { if (adaper.Description == "en0") { mac = adaper.GetPhysicalAddress().ToString(); break; } else { mac = adaper.GetPhysicalAddress().ToString(); if (mac != "") break; } } return mac; } #region ��ȡ���������� private static AndroidJavaObject audioManager = null; private const string currentVolume = "getStreamVolume";//��ǰ���� private const string maxVolume = "getStreamMaxVolume";//������� private const int STREAM_SYSTEM = 1; private float maxvo = 0; private float nowvo = 0; int volum = 0; public uint GetSystemVolume() { if (Application.platform == RuntimePlatform.Android) { if (audioManager == null) { AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = UnityPlayer.GetStatic("currentActivity"); audioManager = currentActivity.Call("getSystemService", new AndroidJavaObject("java.lang.String", "audio")); maxvo = float.Parse(audioManager.Call(maxVolume, STREAM_SYSTEM).ToString()); } nowvo = float.Parse(audioManager.Call(currentVolume, STREAM_SYSTEM).ToString()); volum = Mathf.CeilToInt((nowvo / maxvo) * 100); //Debug.Log("����:" + volum); return (uint)volum; //Debug.Log("STREAM_VOICE_CALL:" + audioManager.Call(currentVolume, STREAM_VOICE_CALL).ToString()); //Debug.Log("STREAM_RING:" + audioManager.Call(currentVolume, STREAM_RING).ToString()); //Debug.Log("STREAM_MUSIC:" + audioManager.Call(currentVolume, STREAM_MUSIC).ToString()); //Debug.Log("STREAM_ALARM:" + audioManager.Call(currentVolume, STREAM_ALARM).ToString()); //Debug.Log("STREAM_NOTIFICATION:" + audioManager.Call(currentVolume, STREAM_NOTIFICATION).ToString()); //Debug.Log("STREAM_DTMF:" + audioManager.Call(currentVolume, STREAM_DTMF).ToString()); } return 100; } public uint GetBatter() { #if PICO_SDK || PXR_SDK if (Application.platform == RuntimePlatform.Android) { return uint.Parse(PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.ELECTRIC_QUANTITY)); } #endif return 100; } #endregion }