新增镜头设定

This commit is contained in:
shenjianxing 2025-01-09 14:10:59 +08:00
parent 1812e5c2ec
commit 57a871eeb2
4 changed files with 31 additions and 7 deletions

View File

@ -63,7 +63,10 @@ namespace QFramework
data.normalPos = Utility.GetVector3FromStrArray(datas["normalPos"]); data.normalPos = Utility.GetVector3FromStrArray(datas["normalPos"]);
data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]); data.normalRot = Utility.GetVector3FromStrArray(datas["normalRot"]);
} }
if (datas.ContainsKey("isOn"))
{
data.isOn = datas["isOn"];
}
float.TryParse(datas["nearTime"], out data.nearTime); float.TryParse(datas["nearTime"], out data.nearTime);
float.TryParse(datas["normalTime"], out data.normalTime); float.TryParse(datas["normalTime"], out data.normalTime);

View File

@ -16,6 +16,7 @@ namespace QFramework.Example
public Vector3 normalRot; public Vector3 normalRot;
public float nearTime; public float nearTime;
public float normalTime; public float normalTime;
public string isOn;
} }
public partial class UICameraSwitch : UIPanel public partial class UICameraSwitch : UIPanel
@ -58,7 +59,8 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null) protected override void OnOpen(IUIData uiData = null)
{ {
mData = uiData as UICameraSwitchData ?? new UICameraSwitchData(); mData = uiData as UICameraSwitchData ?? new UICameraSwitchData();
if (string.IsNullOrEmpty(mData.isOn))
{
if (Near.isOn) if (Near.isOn)
{ {
SetNear(); SetNear();
@ -68,6 +70,19 @@ namespace QFramework.Example
SetNormal(); SetNormal();
} }
} }
else
{
switch (mData.isOn)
{
case "near":
SetNear();
break;
case "normal":
SetNormal();
break;
}
}
}
private void Update() private void Update()
{ {

View File

@ -666,6 +666,11 @@ namespace XMLTool
{ {
act.args.Add("normalTime", "0"); act.args.Add("normalTime", "0");
} }
XAttribute isOn = action.Attribute("isOn");
if (isOn != null)
{
act.args.Add("isOn", isOn.Value);
}
newAction = act; newAction = act;
} }
break; break;

View File

@ -51,8 +51,9 @@
<Action type="SetScore" name="步骤名字" value="1"></Action> <Action type="SetScore" name="步骤名字" value="1"></Action>
<!--镜头切换 近距离和默认 如果有了nearDevice就可以不用nearPos和nearRot了 按照device的坐标和旋转来处理镜头 normalDevice同理 <!--镜头切换 近距离和默认 如果有了nearDevice就可以不用nearPos和nearRot了 按照device的坐标和旋转来处理镜头 normalDevice同理
只设置坐标 不执行镜头切换 是否执行要根据UI的按钮操作来 只设置坐标 不执行镜头切换 是否执行要根据UI的按钮操作来
isOn: near或者normal 作为强制选择一个镜头
--> -->
<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> <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" isOn="near"></Action>
<!--文字弹窗 按钮可以多个 点击事件使用UIClick--> <!--文字弹窗 按钮可以多个 点击事件使用UIClick-->
<Action type="TextTip" value="这里是文字描述" audio="q001.mp3" btns="确定,取消"/> <Action type="TextTip" value="这里是文字描述" audio="q001.mp3" btns="确定,取消"/>
<!--锁定镜头 value为是否锁定--> <!--锁定镜头 value为是否锁定-->