60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using System;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.XR;
|
|
|
|
public class readfile : MonoBehaviour
|
|
{
|
|
public Text text;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
string ss = $"/sdcard/cs.txt";
|
|
try
|
|
{
|
|
if (File.Exists(ss))
|
|
text.text = File.ReadAllText(ss);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
text.text = e.Message;
|
|
}
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
//A键
|
|
if (InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.primaryButton, out bool isOpen))
|
|
{
|
|
if (isOpen)
|
|
{
|
|
PicoAPI._Instance.SetAppAsHome("");//
|
|
PicoAPI._Instance.AppKeepAlive("");//
|
|
PicoAPI._Instance.OnUSBDebugging();//开启USB调试
|
|
PicoAPI._Instance.SetUSBConfigMode();//设置USB配置模式为MTP
|
|
PicoAPI._Instance.OpenSystemUpdateApp();//系统软件升级
|
|
PicoAPI._Instance.OpenSystemUpdate();//系统升级
|
|
PicoAPI._Instance.OpenNavgation();//导航栏
|
|
PicoAPI._Instance.OpenKillVRapp();//自动杀后台VR应用
|
|
PicoAPI._Instance.OnPowerCtrlWIFIEnable();//设备休眠或关闭时保持网络连接
|
|
PicoAPI._Instance.OpenAppQuitConfirmDialog();//应用程序退出对话框
|
|
PicoAPI._Instance.OnSixDof();//开启6DoF位置跟踪
|
|
PicoAPI._Instance.OpenHandRecenter();
|
|
PicoAPI._Instance.OpenHandHome();
|
|
PicoAPI._Instance.RemoveControllerHomeKey();//设置home按钮默认
|
|
}
|
|
}
|
|
//B键
|
|
if (InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.secondaryButton, out bool isinfo))
|
|
{
|
|
if (isinfo)
|
|
{
|
|
PicoAPI._Instance.Reboot();
|
|
}
|
|
}
|
|
}
|
|
}
|