Init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d08d4a0636fd64c698e3b13b89847379
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_UIController : MonoBehaviour
|
||||
{
|
||||
public static PXR_UIController Instance { get; private set; }
|
||||
public PXR_PicoDebuggerSO config;
|
||||
[HideInInspector] public Vector3 origin;
|
||||
private Transform _camera;
|
||||
private float distance;
|
||||
private StartPosiion state;
|
||||
public void Awake()
|
||||
{
|
||||
if (config == null)
|
||||
{
|
||||
config = Resources.Load<PXR_PicoDebuggerSO>("PXR_PicoDebuggerSO");
|
||||
}
|
||||
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
Init();
|
||||
}
|
||||
private void Init()
|
||||
{
|
||||
_camera = Camera.main.transform;
|
||||
state = config.startPosition;
|
||||
distance = GetDistance();
|
||||
}
|
||||
public float GetDistance()
|
||||
{
|
||||
return state switch
|
||||
{
|
||||
StartPosiion.Far => 3f,
|
||||
StartPosiion.Medium => 2f,
|
||||
StartPosiion.Near => 1f,
|
||||
_ => 2f,
|
||||
};
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
ResetTransform();
|
||||
}
|
||||
// Update is called once per frame
|
||||
private void ResetTransform()
|
||||
{
|
||||
origin = _camera.position;
|
||||
transform.position = origin + distance * _camera.transform.forward ;
|
||||
transform.forward = transform.position - origin;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 442a798e1fcc34e479becec159b8aaf7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_UIManager : MonoBehaviour
|
||||
{
|
||||
public PXR_PicoDebuggerSO config;
|
||||
public PXR_UIController uiController;
|
||||
private GameObject _controller = null;
|
||||
private void Start()
|
||||
{
|
||||
config = Resources.Load<PXR_PicoDebuggerSO>("PXR_PicoDebuggerSO");
|
||||
uiController = Resources.Load<GameObject>("PXR_DebuggerPanel").GetComponent<PXR_UIController>();
|
||||
if(config.isOpen)
|
||||
{
|
||||
switch (config.debuggerLauncherButton)
|
||||
{
|
||||
case LauncherButton.PressA:
|
||||
PXR_DeviceManager.Instance.OnAButtonPress += OnStartButtonPress;
|
||||
break;
|
||||
case LauncherButton.PressB:
|
||||
PXR_DeviceManager.Instance.OnBButtonPress += OnStartButtonPress;
|
||||
break;
|
||||
case LauncherButton.PressX:
|
||||
PXR_DeviceManager.Instance.OnXButtonPress += OnStartButtonPress;
|
||||
break;
|
||||
case LauncherButton.PressY:
|
||||
PXR_DeviceManager.Instance.OnYButtonPress += OnStartButtonPress;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnStartButtonPress(){
|
||||
ToggleController();
|
||||
}
|
||||
private void ToggleController(){
|
||||
if(_controller == null){
|
||||
_controller = Instantiate(uiController.gameObject);
|
||||
}else{
|
||||
_controller.SetActive(!_controller.gameObject.activeSelf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16f20e8e0453b4ff8a0517178b2117ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f68a863322194d27a20f7360a9deb30
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_InspectorItem : MonoBehaviour, IPointerDownHandler
|
||||
{
|
||||
public Text text;
|
||||
private bool isShowChildren = false;
|
||||
private bool hasChild = false;
|
||||
private string icon => hasChild?(isShowChildren?"- ":"+ "):"";
|
||||
private string nodeName;
|
||||
private GameObject target;
|
||||
public void SetTitle(){
|
||||
text.text = icon + nodeName;
|
||||
}
|
||||
public void Init(Transform item)
|
||||
{
|
||||
target = item.gameObject;
|
||||
nodeName = item.name;
|
||||
if(item.childCount > 0){
|
||||
hasChild = true;
|
||||
TraverseChild(item);
|
||||
}
|
||||
SetTitle();
|
||||
}
|
||||
public void AddItem(Transform item)
|
||||
{
|
||||
var go = Instantiate(PXR_InspectorManager.Instance.inspectItem, transform);
|
||||
if (go.TryGetComponent(out PXR_InspectorItem inspectItem))
|
||||
{
|
||||
inspectItem.Init(item);
|
||||
inspectItem.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void TraverseChild(Transform current)
|
||||
{
|
||||
for (int i = 0; i < current.childCount; i++)
|
||||
{
|
||||
// Debug.Log($"TraverseChild: {current.GetChild(i).name}");
|
||||
AddItem(current.GetChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
isShowChildren = !isShowChildren;
|
||||
// LayoutRebuilder.ForceRebuildLayoutImmediate(gameObject.GetComponent<RectTransform>());
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
// Debug.Log($"TraverseChild: {transform.GetChild(i).name}");
|
||||
transform.GetChild(i).gameObject.SetActive(isShowChildren);
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(transform.GetChild(i).GetComponent<RectTransform>());
|
||||
}
|
||||
var root = transform;
|
||||
while(root.TryGetComponent(out PXR_InspectorItem _)){
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(root.GetComponent<RectTransform>());
|
||||
root = root.parent;
|
||||
}
|
||||
SetTitle();
|
||||
PXR_InspectorManager.Instance.SetTransformInfo(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb8065e0c6c0d426490ad712bc1ce594
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_InspectorManager : MonoBehaviour, IPXR_PanelManager
|
||||
{
|
||||
public static PXR_InspectorManager Instance;
|
||||
private void Awake(){
|
||||
if(Instance == null){
|
||||
Instance = this;
|
||||
}
|
||||
}
|
||||
public GameObject inspectItem;
|
||||
public Transform content;
|
||||
public Text positionText;
|
||||
public Text rotationText;
|
||||
public Text scaleText;
|
||||
public GameObject transformInfoNode;
|
||||
private Transform target;
|
||||
void Update(){
|
||||
ShowTransformInfo();
|
||||
}
|
||||
private void ClearAllChildren(){
|
||||
int childCount = content.childCount;
|
||||
for (int i = childCount - 1; i >= 0; i--)
|
||||
{
|
||||
DestroyImmediate(content.GetChild(i).gameObject);
|
||||
}
|
||||
}
|
||||
public void CreateInspector()
|
||||
{
|
||||
GenerateInspectorTree();
|
||||
}
|
||||
public void Init(){
|
||||
CreateInspector();
|
||||
}
|
||||
public void Reset(){
|
||||
for (int i = 0; i < content.childCount; i++)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(content.GetChild(i).GetComponent<RectTransform>());
|
||||
}
|
||||
}
|
||||
public void SetTransformInfo(GameObject target){
|
||||
this.target = target.transform;
|
||||
transformInfoNode.SetActive(true);
|
||||
ShowTransformInfo();
|
||||
}
|
||||
public void Refresh(){
|
||||
ClearAllChildren();
|
||||
GenerateInspectorTree();
|
||||
}
|
||||
private void GenerateInspectorTree(){
|
||||
GameObject[] rootObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
|
||||
// 遍历所有根GameObject
|
||||
foreach (GameObject obj in rootObjects)
|
||||
{
|
||||
if(!obj.TryGetComponent<PXR_UIController>(out _) && !obj.TryGetComponent<PXR_UIManager>(out _) && obj.activeSelf){
|
||||
var go = Instantiate(inspectItem, content);
|
||||
if(go.TryGetComponent(out PXR_InspectorItem item)){
|
||||
item.Init(obj.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
private void ShowTransformInfo(){
|
||||
if(target != null){
|
||||
positionText.text = $"x:{target.position.x} y:{target.position.y} z:{target.position.z}";
|
||||
rotationText.text = $"x:{target.eulerAngles.x} y:{target.eulerAngles.y} z:{target.eulerAngles.z} ";
|
||||
scaleText.text = $"x:{target.localScale.x} y:{target.localScale.y} z:{target.localScale.z}";
|
||||
}else{
|
||||
transformInfoNode.SetActive(false);
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11c28c50e274e400ababdc4ef40ca441
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e6248719bac74cbd9b183852eea9d1b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,124 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_LogManager : MonoBehaviour, IPXR_PanelManager
|
||||
{
|
||||
public List<GameObject> infoList = new();
|
||||
public List<GameObject> warningList = new();
|
||||
public List<GameObject> errorList = new();
|
||||
public GameObject errorMessage;
|
||||
public GameObject warningMessage;
|
||||
public GameObject infoMessage;
|
||||
public Text infoText;
|
||||
public Text warningText;
|
||||
public Text errorText;
|
||||
public Transform messageContainer;
|
||||
private int ListCount => infoList.Count + warningList.Count + errorList.Count;
|
||||
private void AddMessage(string title, string content, LogType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case LogType.Error:
|
||||
CreateMessage(title, content, type, errorList, errorMessage);
|
||||
break;
|
||||
case LogType.Assert:
|
||||
break;
|
||||
case LogType.Warning:
|
||||
CreateMessage(title, content, type, warningList, warningMessage);
|
||||
break;
|
||||
case LogType.Log:
|
||||
CreateMessage(title, content, type, infoList, infoMessage);
|
||||
break;
|
||||
case LogType.Exception:
|
||||
break;
|
||||
}
|
||||
RecaculateLogCount();
|
||||
}
|
||||
private void CreateMessage(string title, string content, in LogType type, in List<GameObject> list, in GameObject template)
|
||||
{
|
||||
var msg = Instantiate(template, messageContainer).GetComponent<PXR_MessageController>();
|
||||
msg.Init(title, content);
|
||||
list.Add(msg.gameObject);
|
||||
}
|
||||
private void RecaculateLogCount()
|
||||
{
|
||||
infoText.text = infoList.Count.ToString();
|
||||
warningText.text = warningList.Count.ToString();
|
||||
errorText.text = errorList.Count.ToString();
|
||||
}
|
||||
public void FilterLogs(LogType type, bool isFilter)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case LogType.Error:
|
||||
ToggleLogs(errorList, isFilter);
|
||||
break;
|
||||
case LogType.Assert:
|
||||
break;
|
||||
case LogType.Warning:
|
||||
ToggleLogs(warningList, isFilter);
|
||||
break;
|
||||
case LogType.Log:
|
||||
ToggleLogs(infoList, isFilter);
|
||||
break;
|
||||
case LogType.Exception:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void ToggleLogs(in List<GameObject> list, bool status)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.SetActive(status);
|
||||
}
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
Application.logMessageReceived += OnLogMessageReceived;
|
||||
}
|
||||
private void OnLogMessageReceived(string logString, string stackTrace, LogType type)
|
||||
{
|
||||
if (PXR_UIController.Instance.config.maxInfoCount > ListCount)
|
||||
{
|
||||
AddMessage(logString, stackTrace, type);
|
||||
}
|
||||
}
|
||||
void OnEnable()
|
||||
{
|
||||
foreach (var item in infoList)
|
||||
{
|
||||
item.GetComponent<PXR_MessageController>().Reset();
|
||||
}
|
||||
foreach (var item in warningList)
|
||||
{
|
||||
item.GetComponent<PXR_MessageController>().Reset();
|
||||
}
|
||||
foreach (var item in errorList)
|
||||
{
|
||||
item.GetComponent<PXR_MessageController>().Reset();
|
||||
}
|
||||
}
|
||||
public void Init(){
|
||||
|
||||
}
|
||||
void OnDestroy()
|
||||
{
|
||||
Application.logMessageReceived -= OnLogMessageReceived;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37649a96b60c841e08f9e20ab7f59dfd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_MessageController : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
public Text title;
|
||||
public Text content;
|
||||
private readonly string widthMark = "------------------------------------------------------------------";
|
||||
private readonly int maxLength = 47;
|
||||
public void Init(string title, string content)
|
||||
{
|
||||
string timestamp = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string finalTitle = $"{timestamp}: {title}";
|
||||
|
||||
TextGenerator generator = new();
|
||||
var settings = this.title.GetGenerationSettings(this.title.gameObject.GetComponent<RectTransform>().rect.size);
|
||||
var targetWidth = generator.GetPreferredWidth(widthMark, settings);
|
||||
var currentWidth = generator.GetPreferredWidth(finalTitle, settings);
|
||||
if (targetWidth < currentWidth)
|
||||
{
|
||||
finalTitle = title[..(maxLength - 3)];
|
||||
currentWidth = generator.GetPreferredWidth(finalTitle, settings);
|
||||
while (targetWidth < currentWidth)
|
||||
{
|
||||
finalTitle = title[..(title.Length - 1)];
|
||||
currentWidth = generator.GetPreferredWidth(finalTitle, settings);
|
||||
}
|
||||
finalTitle += "...";
|
||||
}
|
||||
|
||||
this.title.text = finalTitle;
|
||||
this.content.text = $"{title}\n{content}";
|
||||
Reset();
|
||||
}
|
||||
public void Reset()
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(gameObject.GetComponent<RectTransform>());
|
||||
}
|
||||
public void ToggleContent()
|
||||
{
|
||||
content.gameObject.SetActive(!content.gameObject.activeSelf);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 291fd7bf1abf04b508dbc7b5609dfe15
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_BGWithTouch : MonoBehaviour, IPointerMoveHandler, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
private Material material;
|
||||
private Vector4 v;
|
||||
private void Start()
|
||||
{
|
||||
var rect = GetComponent<RectTransform>().rect;
|
||||
material = new Material(GetComponent<Image>().material);
|
||||
v.z = rect.width;
|
||||
v.w = rect.height;
|
||||
material.SetVector("_TouchPos",v);
|
||||
GetComponent<Image>().material = material;
|
||||
}
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnPointerMove(PointerEventData eventData)
|
||||
{
|
||||
Vector3 offset = eventData.pointerCurrentRaycast.worldPosition-transform.position;
|
||||
v.x= offset.x/v.z;
|
||||
v.y= offset.y/v.w;
|
||||
material.SetVector("_TouchPos", v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd02573a0bbc5408986e781f77a6ba20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_DebuggerConst{
|
||||
public static string sdkPackageName = "Packages/com.unity.xr.picoxr/";
|
||||
public static string sdkRootName = "com.unity.xr.picoxr/";
|
||||
}
|
||||
public enum LauncherButton
|
||||
{
|
||||
PressA,
|
||||
PressB,
|
||||
PressX,
|
||||
PressY,
|
||||
}
|
||||
public enum StartPosiion
|
||||
{
|
||||
Far,
|
||||
Near ,
|
||||
Medium,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa10506b4fc074aeb944e1bbed5f5632
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 680b341d8fe6a4b7582f09429fefc6ef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
|
||||
|
||||
NOTICE:All information contained herein is, and remains the property of
|
||||
PICO Technology Co., Ltd. The intellectual and technical concepts
|
||||
contained herein are proprietary to PICO Technology Co., Ltd. and may be
|
||||
covered by patents, patents in process, and are protected by trade secret or
|
||||
copyright law. Dissemination of this information or reproduction of this
|
||||
material is strictly forbidden unless prior written permission is obtained from
|
||||
PICO Technology Co., Ltd.
|
||||
*******************************************************************************/
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
namespace Unity.XR.PXR.Debugger
|
||||
{
|
||||
public class PXR_ToolManager : MonoBehaviour
|
||||
{
|
||||
private GameObject currentTool;
|
||||
public PXR_ToolButton[] toolButtons;
|
||||
public void CreateTool(GameObject tool){
|
||||
ResetButtons();
|
||||
if(currentTool != null){
|
||||
Destroy(currentTool);
|
||||
}
|
||||
currentTool = Instantiate(tool,PXR_DeviceManager.Instance.RightHand);
|
||||
PXR_DeviceManager.Instance.ToggleRightController(false);
|
||||
}
|
||||
private void ResetButtons(){
|
||||
foreach (var button in toolButtons){
|
||||
button.Reset();
|
||||
}
|
||||
PXR_DeviceManager.Instance.ToggleRightController(true);
|
||||
}
|
||||
public void DeleteTool(){
|
||||
ResetButtons();
|
||||
Destroy(currentTool);
|
||||
currentTool = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34aff3ee7450748cba11e0267142e5ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user