This commit is contained in:
2025-11-13 17:40:28 +08:00
parent 962ab49609
commit 10156da245
5503 changed files with 805282 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll 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.Events;
#if UNITY_EDITOR || DEVELOPMENT_BUILD
namespace Unity.XR.PXR.Debugger
{
public class PXR_CloseButton : MonoBehaviour, IPointerDownHandler
{
public UnityEvent onButtonCLick;
// Called when the button is selected
public void OnPointerDown(PointerEventData args)
{
onButtonCLick?.Invoke();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7fdd7d43df6054d408dc941060858139
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll 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_DefaultButton : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
{
bool isButtonPress = false;
bool isButtonHover = false;
private float hoverSpeed = 0.8f;
[SerializeField] private Color defaultColor;
[SerializeField] private Color hoverColor;
[SerializeField] private GameObject panelGO;
[SerializeField] private GameObject[] panelList;
[SerializeField] private PXR_DefaultButton[] buttonList;
[SerializeField] private MeshRenderer bg;
[SerializeField] private MeshRenderer border;
[SerializeField] private Sprite sprite;
private float borderAlpha;
private void Start()
{
Reset();
}
private void OnValidate()
{
transform.GetChild(0).GetComponent<Image>().sprite = sprite;
}
// Called when the button is selected
public void OnPointerDown(PointerEventData eventData)
{
if (!isButtonPress)
{
border.material.color = hoverColor;
bg.material.color = defaultColor;
isButtonHover = false;
isButtonPress = true;
OpenPanel();
}
}
private void Update()
{
if (isButtonHover)
{
bg.material.color = Color.Lerp(bg.material.color, hoverColor, hoverSpeed * Time.deltaTime);
var borderColor = Color.Lerp(border.material.color, hoverColor, hoverSpeed * Time.deltaTime);
borderAlpha += hoverSpeed * Time.deltaTime;
borderColor.a = borderAlpha;
border.material.color = borderColor;
}
}
private void OpenPanel(){
for (var i = 0; i < panelList.Length; i++)
{
panelList[i].SetActive(false);
}
for (var i = 0; i<buttonList.Length; i++){
buttonList[i].Reset();
}
panelGO.SetActive(true);
if(panelGO.TryGetComponent(out IPXR_PanelManager manager)){
manager.Init();
}
}
public void OnPointerEnter(PointerEventData eventData)
{
if (!isButtonPress)
{
border.material.color = new Color(0, 0, 0, 0);
borderAlpha = 0f;
isButtonHover = true;
}
}
public void OnPointerExit(PointerEventData eventData)
{
if (!isButtonPress)
{
isButtonHover = false;
border.material.color = new Color(0, 0, 0, 0);
bg.material.color = defaultColor;
}
}
public void Reset()
{
bg.material.color = defaultColor;
border.material.color = new Color(0, 0, 0, 0);
isButtonPress = false;
isButtonHover = false;
panelGO.SetActive(false);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40cb8883085df4ffa8cca5f3a0072dfa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll 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_DragButton : MonoBehaviour, IBeginDragHandler, IDragHandler,IEndDragHandler
{
private Image image;
private Transform _camera;
public PXR_UIController uiController;
private Vector3 origin; // Center of a sphere
private float radius = 5f; // Radius of a sphere
public Transform container;
[SerializeField]private Color defaultColor;
[SerializeField]private Color hoverColor;
private void Start()
{
_camera = Camera.main.transform;
image = GetComponent<Image>();
}
private void UpdateTransformPosition(PointerEventData eventData)
{
// Gets the position and direction of the controller
Vector3 controllerPosition = eventData.pointerCurrentRaycast.worldPosition;
// Calculate the point at which the ray intersects the sphere
Vector3 sphereCenterToController = controllerPosition - origin;
Vector3 intersectionPoint = origin + sphereCenterToController.normalized * radius;
Vector3 intersectionDirection = (intersectionPoint - origin).normalized;
float angle = Vector3.Angle(intersectionDirection, Vector3.up);
if (angle < 45 || angle > 135)return;
var forward = container.position - _camera.position;
forward.y = 0;
image.color = Color.Lerp(image.color,hoverColor,Time.deltaTime);
container.forward = forward;
container.position = intersectionPoint;
}
public void OnBeginDrag(PointerEventData eventData)
{
if (eventData.pointerCurrentRaycast.gameObject != gameObject) return;
origin = uiController.origin;
radius = uiController.GetDistance();
// Update the position when you start dragging
UpdateTransformPosition(eventData);
}
public void OnEndDrag(PointerEventData eventData)
{
if (eventData.pointerCurrentRaycast.gameObject != gameObject) return;
image.color = defaultColor;
}
public void OnDrag(PointerEventData eventData)
{
if (eventData.pointerCurrentRaycast.gameObject != gameObject) return;
// Update position while dragging
UpdateTransformPosition(eventData);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b3c9f458c1e945d7b07755d7c90f336
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll 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_FolderButton : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
{
private Image image;
public GameObject content;
private bool isShowContent = false;
private float hoverSpeed = 0.5f;
[SerializeField] private Color defaultColor = new(184, 235, 255);
bool isButtonHover = false;
private void Start()
{
image = GetComponent<Image>();
image.color = defaultColor;
}
public void OnPointerDown(PointerEventData eventData)
{
// text.color = Color.red;
isShowContent = !isShowContent;
content.SetActive(isShowContent);
image.transform.Rotate(0, 0, 180);
LayoutRebuilder.ForceRebuildLayoutImmediate(content.transform.parent.gameObject.GetComponent<RectTransform>());
}
public void OnPointerEnter(PointerEventData eventData)
{
isButtonHover = true;
}
public void OnPointerExit(PointerEventData eventData)
{
isButtonHover = false;
image.color = defaultColor;
}
private void Update()
{
if (isButtonHover)
{
image.color = Color.Lerp(image.color, Color.white, hoverSpeed * Time.deltaTime);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac9571667b43a4f9aabba6f70428aa17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll 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_LogButton : MonoBehaviour, IPointerDownHandler
{
public LogType type;
[SerializeField]private Color defaultColor;
[SerializeField]private PXR_LogManager logManager;
[SerializeField]private Image icon;
[SerializeField]private Text text;
private bool isFilter = true;
public void OnPointerDown(PointerEventData eventData)
{
isFilter = !isFilter;
logManager.FilterLogs(type,isFilter);
icon.color = isFilter?defaultColor:Color.gray;
text.color = isFilter?defaultColor:Color.gray;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f54a5e3c6193443d894c8d0fffe39d3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,66 @@
/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICEAll 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;
using UnityEngine.EventSystems;
using UnityEngine.Events;
#if UNITY_EDITOR || DEVELOPMENT_BUILD
namespace Unity.XR.PXR.Debugger
{
public class PXR_ToolButton : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
{
private bool isButtonPress = false;
private bool isButtonHover = false;
// private float hoverSpeed = 0.8f;
[SerializeField] private Color defaultColor;
[SerializeField] private Color hoverColor;
[SerializeField] private Image icon;
public UnityEvent onButtonPressed;
public void OnPointerDown(PointerEventData eventData)
{
if (!isButtonPress)
{
onButtonPressed?.Invoke();
icon.color = hoverColor;
isButtonHover = false;
isButtonPress = true;
}
}
public void OnPointerEnter(PointerEventData eventData)
{
if (!isButtonPress)
{
icon.color = hoverColor;
isButtonHover = true;
}
}
public void Reset(){
icon.color = defaultColor;
isButtonHover = false;
isButtonPress = false;
}
public void OnPointerExit(PointerEventData eventData)
{
if (!isButtonPress)
{
isButtonHover = false;
icon.color = defaultColor;
}
}
public void CreateTool(){
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7bbd53e7b18d40e5a7adfa6cbd2cdab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: