修复报错

This commit is contained in:
Sora丶kong
2026-03-03 11:32:30 +08:00
parent 82130f6146
commit 2f0862b382
10 changed files with 125 additions and 81 deletions

View File

@@ -2,42 +2,44 @@ using BigSpace.XRCore.Base;
using System.Collections;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using Unity.XR.PICO.TOBSupport;
using UnityEngine;
#if PICO_SDK || PXR_SDK
using Unity.XR.PICO.TOBSupport;
#endif
public class PicoFunc : Singleton<PicoFunc>
{
public string GetCode()
{
#if PICO_SDK || PXR_SDK
if (Application.platform == RuntimePlatform.Android)
{
return PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.EQUIPMENT_SN);
}
else
#endif
string mac = "";
NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adaper in nis)
{
string mac = "";
NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adaper in nis)
if (adaper.Description == "en0")
{
if (adaper.Description == "en0")
{
mac = adaper.GetPhysicalAddress().ToString();
break;
}
else
{
mac = adaper.GetPhysicalAddress().ToString();
if (mac != "") break;
}
mac = adaper.GetPhysicalAddress().ToString();
break;
}
else
{
mac = adaper.GetPhysicalAddress().ToString();
if (mac != "") break;
}
return mac;
}
return mac;
}
#region
#region <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private static AndroidJavaObject audioManager = null;
private const string currentVolume = "getStreamVolume";//当前音量
private const string maxVolume = "getStreamMaxVolume";//最大音量
private const string currentVolume = "getStreamVolume";//<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private const string maxVolume = "getStreamMaxVolume";//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private const int STREAM_SYSTEM = 1;
private float maxvo = 0;
private float nowvo = 0;
@@ -55,7 +57,7 @@ public class PicoFunc : Singleton<PicoFunc>
}
nowvo = float.Parse(audioManager.Call<int>(currentVolume, STREAM_SYSTEM).ToString());
volum = Mathf.CeilToInt((nowvo / maxvo) * 100);
//Debug.Log("音量:" + volum);
//Debug.Log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + volum);
return (uint)volum;
//Debug.Log("STREAM_VOICE_CALL:" + audioManager.Call<int>(currentVolume, STREAM_VOICE_CALL).ToString());
@@ -69,20 +71,13 @@ public class PicoFunc : Singleton<PicoFunc>
}
public uint GetBatter()
{
#if PICO_SDK || PXR_SDK
if (Application.platform == RuntimePlatform.Android)
{
// 打印电池信息
//Debug.Log("电池==============Battery Status: " + SystemInfo.batteryStatus);
//Debug.Log("电池==============Battery Level: " + SystemInfo.batteryLevel * 100 + "%");
//return (uint)Mathf.CeilToInt(SystemInfo.batteryLevel * 100);
//Debug.Log("电量是多少:"+ PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.ELECTRIC_QUANTITY));
return uint.Parse(PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.ELECTRIC_QUANTITY));
}
else
{
return 100;
}
#endif
return 100;
}
#endregion
}