Compare commits

..

No commits in common. "476bb452294a8081e38e1f655875de96faddb0f4" and "8c9209050e00e8e6c30d663815b4308b774ab126" have entirely different histories.

3 changed files with 20 additions and 65 deletions

View File

@ -156,7 +156,6 @@ GameObject:
- component: {fileID: 1943472158707926008}
- component: {fileID: 6717849271440217812}
- component: {fileID: 2720570802681005941}
- component: {fileID: 3686205199050710443}
m_Layer: 0
m_Name: ZFrame
m_TagString: Untagged
@ -211,19 +210,6 @@ MonoBehaviour:
enableCollision: 1
isMov: 1
isRot: 1
--- !u!114 &3686205199050710443
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 765259898297824089}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2c08eae7cce6c9479adebcaad5706c3, type: 3}
m_Name:
m_EditorClassIdentifier:
animSpeed: 1
--- !u!1 &1270204780161445289
GameObject:
m_ObjectHideFlags: 0
@ -1688,7 +1674,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 132536, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
propertyPath: m_Name
value: Debug
value: w
objectReference: {fileID: 0}
- target: {fileID: 11414302, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
propertyPath: m_Size

View File

@ -5,7 +5,6 @@ using QFramework.Example;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
using static OperationController;
@ -26,7 +25,12 @@ public class DeviceItem : MonoBehaviour
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
#if VR
effect.constantWidth = false;
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnClick);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnClick);
#endif
}
if (device.MeshCollider)
@ -47,40 +51,26 @@ public class DeviceItem : MonoBehaviour
tipItem = gameObject.GetOrAddComponent<TipItem>();
tipItem.Set(device.Tip);
}
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnClick.AddListener(OnClick);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnClick.AddListener(OnClick);
}
#if VR
private void OnClick(ZPointer arg0, int arg1, GameObject arg2)
private void OnClick(ZPointer arg0, GameObject arg1)
{
Debug.LogError($"µ±Ç°ÎïÌ壺{gameObject.name} Ä¿±êÎïÌå:{arg2.name}");
if (gameObject == arg2)
if (gameObject == arg1)
{
Debug.LogError("OnClick:" + arg2.name);
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect != null)
{
effect.highlighted = false;
}
}
}
private void OnObjExit(ZPointer arg0, GameObject arg1)
{
if (gameObject == arg1)
{
Debug.LogError("OnObjExit:" + arg1.name);
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect)
{
effect.highlighted = false;
}
gameObject.GetComponent<HighlightEffect>().highlighted = false;
}
}
@ -88,12 +78,7 @@ public class DeviceItem : MonoBehaviour
{
if (gameObject == arg1)
{
Debug.LogError("OnObjEnter:" + arg1.name);
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect)
{
effect.highlighted = true;
}
gameObject.GetComponent<HighlightEffect>().highlighted = true;
}
}
#endif

View File

@ -15,38 +15,22 @@ public class TipItem : MonoBehaviour
public void Set(string label)
{
this.label = label;
#if VR
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnClick.AddListener(OnClick);
#endif
}
private void OnClick(ZPointer arg0, int arg1, GameObject arg2)
{
if (arg2 == gameObject)
{
if (tip != null)
{
tip.Active(false);
}
}
//#if VR
// UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
// UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectEntered.AddListener(OnObjEnter);
// UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
// UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnObjectExited.AddListener(OnObjExit);
//#endif
}
#if VR
private void OnObjExit(ZPointer arg0, GameObject arg1)
{
if (arg1 == gameObject)
{
OnExit();
}
OnExit();
}
private void OnObjEnter(ZPointer arg0, GameObject arg1)
{
if (arg1 == gameObject)
{
OnEnter();
}
OnEnter();
}
#endif
private void OnMouseEnter()