Compare commits

..

No commits in common. "646c6fd75bf85f3b0c7bbe42f3b40a241c1c484f" and "476bb452294a8081e38e1f655875de96faddb0f4" have entirely different histories.

7 changed files with 13 additions and 99 deletions

View File

@ -74,33 +74,12 @@ namespace QFramework
data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]);
}
}
if (datas.ContainsKey("vrPos"))
{
data.vrPos = Utility.GetVector3FromStrArray(datas["vrPos"]);
}
if (datas.ContainsKey("vrRot"))
{
data.vrRot = Utility.GetVector3FromStrArray(datas["vrRot"]);
}
if (datas.ContainsKey("isOn"))
{
data.isOn = datas["isOn"];
}
if (datas.ContainsKey("nearTime"))
{
float.TryParse(datas["nearTime"], out data.nearTime);
}
if (datas.ContainsKey("normalTime"))
{
float.TryParse(datas["normalTime"], out data.normalTime);
}
if (datas.ContainsKey("vrTime"))
{
float.TryParse(datas["vrTime"], out data.vrTime);
}
float.TryParse(datas["nearTime"], out data.nearTime);
float.TryParse(datas["normalTime"], out data.normalTime);
UIKit.OpenPanelAsync<UICameraSwitch>(uiData: data, canvasLevel: UILevel.RightBottom).ToAction().StartGlobal(() => this.Finish());
}

View File

@ -47,14 +47,12 @@ public class DeviceItem : MonoBehaviour
tipItem = gameObject.GetOrAddComponent<TipItem>();
tipItem.Set(device.Tip);
}
#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);
UIRoot.Instance.transform.Find("ZMouse").GetComponent<ZPointer>().OnClick.AddListener(OnClick);
UIRoot.Instance.transform.Find("ZStylus").GetComponent<ZPointer>().OnClick.AddListener(OnClick);
#endif
}
@ -62,8 +60,10 @@ public class DeviceItem : MonoBehaviour
private void OnClick(ZPointer arg0, int arg1, GameObject arg2)
{
Debug.LogError($"当前物体:{gameObject.name} 目标物体:{arg2.name}");
if (gameObject == arg2)
{
Debug.LogError("OnClick:" + arg2.name);
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect != null)
{
@ -75,17 +75,12 @@ public class DeviceItem : MonoBehaviour
{
if (gameObject == arg1)
{
var trigger = gameObject.GetComponent<HighlightTrigger>();
if (trigger == null || trigger.enabled == false)
{
return;
}
Debug.LogError("OnObjExit:" + arg1.name);
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect)
{
effect.highlighted = false;
}
}
}
@ -93,11 +88,7 @@ public class DeviceItem : MonoBehaviour
{
if (gameObject == arg1)
{
var trigger = gameObject.GetComponent<HighlightTrigger>();
if (trigger == null || trigger.enabled == false)
{
return;
}
Debug.LogError("OnObjEnter:" + arg1.name);
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect)
{

View File

@ -12,9 +12,6 @@ public class Launch : MonoBehaviour
{
loader = ResLoader.Allocate();
StartCoroutine(StartApp());
#if VR
Utility.FindObj("FlyCamera")?.SetActive(false);
#endif
}

View File

@ -14,9 +14,9 @@ public class TimeScaleController : MonoBehaviour
private void Awake()
{
//#if VR
// gameObject.SetActive(false);
//#endif
#if VR
gameObject.SetActive(false);
#endif
}
private void Update()
{

View File

@ -14,11 +14,8 @@ namespace QFramework.Example
public Vector3 nearRot;
public Vector3 normalPos;
public Vector3 normalRot;
public Vector3 vrPos;
public Vector3 vrRot;
public float nearTime;
public float normalTime;
public float vrTime;
public string isOn;
}
@ -82,31 +79,10 @@ namespace QFramework.Example
Near.gameObject.SetActive(mData.nearPos != default);
Far.gameObject.SetActive(mData.normalPos != default);
#if VR
Transform trans = UIRoot.Instance.transform.Find("ZFrame");
if (mData.vrPos != default)
{
mData.nearPos = mData.vrPos;
mData.nearRot = mData.vrRot;
mData.nearTime = mData.vrTime;
mData.isOn = "near";
}
else
{
if (mData.nearPos != default)
{
mData.isOn = "near";
}
else if (mData.normalPos != default)
{
mData.isOn = "normal";
}
}
Near.gameObject.SetActive(false);
Far.gameObject.SetActive(false);
#endif
if (string.IsNullOrEmpty(mData.isOn))
{
if (Near.isOn && Near.gameObject.activeSelf)
@ -144,10 +120,7 @@ namespace QFramework.Example
break;
}
}
#if VR
Near.gameObject.SetActive(false);
Far.gameObject.SetActive(false);
#endif
}

View File

@ -824,30 +824,6 @@ namespace XMLTool
{
act.args.Add("isOn", isOn.Value);
}
XAttribute vrPos = action.Attribute("vrPos");
if (vrPos != null)
{
act.args.Add("vrPos", vrPos.Value);
}
XAttribute vrRot = action.Attribute("vrRot");
if (vrRot != null)
{
act.args.Add("vrRot", vrRot.Value);
}
XAttribute vrTime = action.Attribute("vrTime");
if (vrTime != null)
{
act.args.Add("vrTime", vrTime.Value);
}
else
{
act.args.Add("vrTime", "0");
}
newAction = act;
}
break;

View File

@ -112,10 +112,8 @@
<!--镜头切换 近距离和默认 如果有了nearDevice就可以不用nearPos和nearRot了 按照device的坐标和旋转来处理镜头 normalDevice同理
只设置坐标 不执行镜头切换 是否执行要根据UI的按钮操作来
如果不配置 nearPos或者normalPos 则自动隐藏对应的视角UI按钮
VR版 单独的相机位置使用vrPos和vrRot来配置
-->
<Action type="CameraSwitch" nearDevice="肠钳" normalDevice="组织钳" nearPos="-3.942,3.24,-4.319" nearRot="16.42331,180,0" nearTime="1" normalPos="-3.942,3.24,-3.946" normalRot="16.42331,180,-5.305351E-14" normalTime="1" vrPos="0,0,0" vrRot="0,0,0" vrTime="0"></Action>
<Action type="CameraSwitch" nearDevice="肠钳" normalDevice="组织钳" nearPos="-3.942,3.24,-4.319" nearRot="16.42331,180,0" nearTime="1" normalPos="-3.942,3.24,-3.946" normalRot="16.42331,180,-5.305351E-14" normalTime="1"></Action>
<!--文字弹窗 按钮可以多个 点击事件使用UIClick
alpha 0-1 背景的透明度
-->