高亮扩展参数

This commit is contained in:
shenjianxing 2025-02-07 13:07:29 +08:00
parent 161ea373e5
commit e73daba55f
4 changed files with 26 additions and 3 deletions

View File

@ -25,6 +25,7 @@ namespace QFramework
bool isHigh = true; bool isHigh = true;
string deviceName = string.Empty; string deviceName = string.Empty;
string isIndependent; string isIndependent;
string visibility;
public static HighLightAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null) public static HighLightAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
{ {
var retNode = mPool.Allocate(); var retNode = mPool.Allocate();
@ -45,6 +46,7 @@ namespace QFramework
} }
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty; retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
retNode.isIndependent = datas.ContainsKey("isIndependent") ? datas["isIndependent"] : string.Empty; retNode.isIndependent = datas.ContainsKey("isIndependent") ? datas["isIndependent"] : string.Empty;
retNode.visibility = datas.ContainsKey("visibility") ? datas["visibility"] : string.Empty;
retNode.OnFinished = OnFinished; retNode.OnFinished = OnFinished;
return retNode; return retNode;
} }
@ -72,6 +74,9 @@ namespace QFramework
var effect = obj.GetOrAddComponent<HighlightEffect>(); var effect = obj.GetOrAddComponent<HighlightEffect>();
effect.outlineColor = color; effect.outlineColor = color;
effect.highlighted = true; effect.highlighted = true;
Visibility visibility = Visibility.Normal;
Enum.TryParse(this.visibility, out visibility);
effect.outlineVisibility = visibility;
obj.GetOrAddComponent<HighLightOnStepChanged>(); obj.GetOrAddComponent<HighLightOnStepChanged>();
if (string.IsNullOrEmpty(isIndependent) == false) if (string.IsNullOrEmpty(isIndependent) == false)
{ {

View File

@ -28,6 +28,7 @@ namespace QFramework
string count; string count;
string time; string time;
string finishedEvent; string finishedEvent;
string visibility;
public static HighLightFlashAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null) public static HighLightFlashAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
{ {
var retNode = mPool.Allocate(); var retNode = mPool.Allocate();
@ -51,6 +52,7 @@ namespace QFramework
retNode.count = datas.ContainsKey("count") ? datas["count"] : string.Empty; retNode.count = datas.ContainsKey("count") ? datas["count"] : string.Empty;
retNode.time = datas.ContainsKey("time") ? datas["time"] : string.Empty; retNode.time = datas.ContainsKey("time") ? datas["time"] : string.Empty;
retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : string.Empty; retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : string.Empty;
retNode.visibility = datas.ContainsKey("visibility") ? datas["visibility"] : string.Empty;
retNode.OnFinished = OnFinished; retNode.OnFinished = OnFinished;
return retNode; return retNode;
} }
@ -79,6 +81,9 @@ namespace QFramework
var effect = obj.GetOrAddComponent<HighlightEffect>(); var effect = obj.GetOrAddComponent<HighlightEffect>();
effect.outlineColor = color; effect.outlineColor = color;
effect.highlighted = true; effect.highlighted = true;
Visibility visibility = Visibility.Normal;
Enum.TryParse(this.visibility, out visibility);
effect.outlineVisibility = visibility;
obj.GetOrAddComponent<HighLightOnStepChanged>(); obj.GetOrAddComponent<HighLightOnStepChanged>();
if (string.IsNullOrEmpty(isIndependent) == false) if (string.IsNullOrEmpty(isIndependent) == false)
{ {

View File

@ -787,6 +787,11 @@ namespace XMLTool
{ {
act.args.Add("isIndependent", isIndependent.Value); act.args.Add("isIndependent", isIndependent.Value);
} }
XAttribute visibility = action.Attribute("visibility");
if (visibility != null)
{
act.args.Add("visibility", visibility.Value);
}
newAction = act; newAction = act;
} }
break; break;
@ -829,6 +834,11 @@ namespace XMLTool
{ {
act.args.Add("finishedEvent", finishedEvent.Value); act.args.Add("finishedEvent", finishedEvent.Value);
} }
XAttribute visibility = action.Attribute("visibility");
if (visibility != null)
{
act.args.Add("visibility", visibility.Value);
}
newAction = act; newAction = act;
} }
break; break;

View File

@ -89,14 +89,17 @@
如果deviceName存在 则不用isDevice 如果deviceName存在 则不用isDevice
--> -->
<Action type="Show" value="SM_QvanChangJing/sence/pPlane1" deviceName="设备名字" isShow="false" isDevice="false"></Action> <Action type="Show" value="SM_QvanChangJing/sence/pPlane1" deviceName="设备名字" isShow="false" isDevice="false"></Action>
<!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡--> <!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡
<Action type="HighLight" deviceName="设备名字" value="路径" isHigh="true" color="0,255,0,255" isIndependent="true"></Action> visibility: 有三种形式 Normal, AlwaysOnTop,OnlyWhenOccluded
-->
<Action type="HighLight" deviceName="设备名字" value="路径" isHigh="true" color="0,255,0,255" isIndependent="true" visibility="Normal"></Action>
<!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡 <!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮 isIndependent为true 可以避免模型高亮被遮挡
time是从不显示到完全显示的时间 time是从不显示到完全显示的时间
count是循环 -1为无限循环需要主动关闭 count是循环 -1为无限循环需要主动关闭
当count不为-1时 可以使用finishedEvent配合strEvent做闪烁结束的监听 当count不为-1时 可以使用finishedEvent配合strEvent做闪烁结束的监听
visibility: 有三种形式 Normal, AlwaysOnTop,OnlyWhenOccluded
--> -->
<Action type="HighLightFlash" deviceName="测试" isHigh="true" color="0,255,0,255" time="1" count="-1" finishedEvent="等待"></Action> <Action type="HighLightFlash" deviceName="测试" isHigh="true" color="0,255,0,255" time="1" count="-1" finishedEvent="等待" visibility="Normal"></Action>
<!--延迟 value是秒--> <!--延迟 value是秒-->
<Action type="Delay" value="2"></Action> <Action type="Delay" value="2"></Action>
<!-- <!--