Merge remote-tracking branch 'origin/master' into LouDi_Pig

This commit is contained in:
李浩 2025-01-09 14:16:23 +08:00
commit 728ba2b6bd
15 changed files with 55 additions and 19 deletions

View File

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

View File

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

View File

@ -46,9 +46,12 @@ public class DeviceItem : MonoBehaviour
{
bool isActive = true;
bool.TryParse(obj[0], out isActive);
if (obj.Length == 1 || (obj.Length > 1 && obj[1] == device.Name))
{
gameObject.GetComponent<HighlightTrigger>().enabled = isActive;
}
}
}
private void OnMouseUpAsButton()
{

View File

@ -18,7 +18,6 @@ namespace QFramework.Example
{
mData = uiData as UIBtnsData ?? new UIBtnsData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -29,6 +28,7 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
mData = uiData as UIBtnsData ?? new UIBtnsData();
BtnContent.RemoveAllChildren();
foreach (var item in mData.btns)

View File

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

View File

@ -22,7 +22,6 @@ namespace QFramework.Example
{
mData = uiData as UIHintData ?? new UIHintData();
SetItem(0);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -32,6 +31,7 @@ namespace QFramework.Example
}
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
mData = uiData as UIHintData ?? new UIHintData();
if (curAction != null)
{

View File

@ -142,7 +142,6 @@ namespace QFramework.Example
}
protected override void OnClose()
{
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
}
}
}

View File

@ -17,7 +17,6 @@ namespace QFramework.Example
{
mData = uiData as UIPointQuestionData ?? new UIPointQuestionData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -28,6 +27,7 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
mData = uiData as UIPointQuestionData ?? new UIPointQuestionData();
Content.RemoveAllChildren();

View File

@ -20,7 +20,6 @@ namespace QFramework.Example
mData = uiData as UIResultTipData ?? new UIResultTipData();
Right.gameObject.SetActive(false);
Wrong.gameObject.SetActive(false);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -30,6 +29,7 @@ namespace QFramework.Example
}
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
Right.gameObject.SetActive(false);
Wrong.gameObject.SetActive(false);
mData = uiData as UIResultTipData ?? new UIResultTipData();

View File

@ -34,7 +34,6 @@ namespace QFramework.Example
{
mData = uiData as UITextQuestionData ?? new UITextQuestionData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -44,6 +43,7 @@ namespace QFramework.Example
}
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
mData = uiData as UITextQuestionData ?? new UITextQuestionData();
Title.text = mData.title;
OptionContent.transform.RemoveAllChildren();

View File

@ -22,8 +22,6 @@ namespace QFramework.Example
{
mData = uiData as UITextTipData ?? new UITextTipData();
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenGameObjectDestroyed(this);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -34,6 +32,7 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
mData = uiData as UITextTipData ?? new UITextTipData();
Des.text = Regex.Replace(mData.text, @"\\n", "\n");
BtnContent.RemoveAllChildren();

View File

@ -27,7 +27,6 @@ namespace QFramework.Example
mData = uiData as UITipWindowData ?? new UITipWindowData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -39,6 +38,7 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
mData = uiData as UITipWindowData ?? new UITipWindowData();
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
Label.text = mData.txt;
BtnContent.RemoveAllChildren();
if (mData != null)

View File

@ -30,7 +30,6 @@ namespace QFramework.Example
{
mData = uiData as UIToolsData ?? new UIToolsData();
// please add init code here
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -41,6 +40,7 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
mResLoader = ResLoader.Allocate();
mData = uiData as UIToolsData ?? new UIToolsData();
if (string.IsNullOrEmpty(mData.answer) == false)

View File

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

View File

@ -51,8 +51,9 @@
<Action type="SetScore" name="步骤名字" value="1"></Action>
<!--镜头切换 近距离和默认 如果有了nearDevice就可以不用nearPos和nearRot了 按照device的坐标和旋转来处理镜头 normalDevice同理
只设置坐标 不执行镜头切换 是否执行要根据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-->
<Action type="TextTip" value="这里是文字描述" audio="q001.mp3" btns="确定,取消"/>
<!--锁定镜头 value为是否锁定-->
@ -127,7 +128,7 @@
<!--通用事件通知
HighLightTriggervalue=false 关闭device悬浮高亮 value=true 开启
HighLightTriggervalue=false 关闭device悬浮高亮 value=true 开启 false value=false,deviceName 后面的参数是可以写设备名字 不写就是全部设备
-->
<Action type="StrEvent" name="HighLightTrigger" value="false"></Action>