Merge branch 'master' into LouDi_Quan

This commit is contained in:
shenjianxing 2025-01-02 14:20:02 +08:00
commit 2af4526c91
7 changed files with 162 additions and 28 deletions

View File

@ -130,8 +130,8 @@ public class ActionHelper
return SetVarAction.Allocate(act.Name, act.Value); return SetVarAction.Allocate(act.Name, act.Value);
case "Show": case "Show":
{ {
var strAction = (XMLTool.StringListAction)act; var strAction = (XMLTool.DictionaryAction)act;
return ShowAction.Allocate(act.Value, strAction.args[0], strAction.args[1]); return ShowAction.Allocate(act.Value, strAction.args);
} }
case "TextTip": case "TextTip":
{ {
@ -213,6 +213,12 @@ public class ActionHelper
{ {
return StrEventAction.Allocate(act.Name, act.Value); return StrEventAction.Allocate(act.Name, act.Value);
} }
case "SkinnedBake":
{
var dictAction = (XMLTool.DictionaryAction)act;
return SkinnedBakeAction.Allocate(act.Value, dictAction.args);
}
default: default:
Debug.LogError($"没有找到此Action的类型{act.Type}"); Debug.LogError($"没有找到此Action的类型{act.Type}");
break; break;

View File

@ -25,6 +25,7 @@ namespace QFramework
Animation anim; Animation anim;
string frame; string frame;
string speed; string speed;
string deviceName;
public static AnimationAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null) public static AnimationAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
{ {
var retNode = mPool.Allocate(); var retNode = mPool.Allocate();
@ -35,6 +36,7 @@ namespace QFramework
retNode.animName = datas.ContainsKey("animName") ? datas["animName"] : ""; retNode.animName = datas.ContainsKey("animName") ? datas["animName"] : "";
retNode.frame = datas.ContainsKey("frame") ? datas["frame"] : ""; retNode.frame = datas.ContainsKey("frame") ? datas["frame"] : "";
retNode.speed = datas.ContainsKey("speed") ? datas["speed"] : ""; retNode.speed = datas.ContainsKey("speed") ? datas["speed"] : "";
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : "";
retNode.OnFinished = OnFinished; retNode.OnFinished = OnFinished;
return retNode; return retNode;
} }
@ -43,7 +45,15 @@ namespace QFramework
public void OnStart() public void OnStart()
{ {
GameObject obj = Utility.FindObj(path); GameObject obj = null;
if (string.IsNullOrEmpty(deviceName))
{
obj = Utility.FindObj(path);
}
else
{
obj = DeviceController.Instance.GetDeviceObj(deviceName);
}
if (obj != null) if (obj != null)
{ {
try try

View File

@ -17,17 +17,19 @@ public class ShowAction : IAction
private static readonly SimpleObjectPool<ShowAction> mPool = private static readonly SimpleObjectPool<ShowAction> mPool =
new SimpleObjectPool<ShowAction>(() => new ShowAction(), null, 10); new SimpleObjectPool<ShowAction>(() => new ShowAction(), null, 10);
string path; string path;
bool isShow = true; string isShow = string.Empty;
bool isDevice = false; string deviceName = string.Empty;
public static ShowAction Allocate(string path, string isShow, string isDevice, System.Action onDelayFinish = null) string isDevice = string.Empty;
public static ShowAction Allocate(string path, Dictionary<string, string> datas, System.Action onDelayFinish = null)
{ {
var retNode = mPool.Allocate(); var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false; retNode.Deinited = false;
retNode.Reset(); retNode.Reset();
retNode.path = path; retNode.path = path;
bool.TryParse(isShow, out retNode.isShow); retNode.isShow = datas.ContainsKey("isShow") ? datas["isShow"] : string.Empty;
bool.TryParse(isDevice, out retNode.isDevice); retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
retNode.isDevice = datas.ContainsKey("isDevice") ? datas["isDevice"] : string.Empty;
return retNode; return retNode;
} }
@ -53,22 +55,31 @@ public class ShowAction : IAction
public void OnStart() public void OnStart()
{ {
GameObject obj = null; GameObject obj = null;
if (isDevice) if (string.IsNullOrEmpty(deviceName) == false)
{
obj = DeviceController.Instance.GetDeviceObj(deviceName);
}
else
{
if (string.IsNullOrEmpty(isDevice) == false && isDevice == "true")
{ {
obj = DeviceController.Instance.GetDeviceObj(path); obj = DeviceController.Instance.GetDeviceObj(path);
} }
else else
{ {
obj = Utility.FindObj(path); obj = Utility.FindObj(path);
} }
}
if (obj == null) if (obj == null)
{ {
Debug.LogError("ûÓÐÕÒµ½ÎïÌå :" + path); Debug.LogError("ûÓÐÕÒµ½ÎïÌå :" + path);
} }
else else
{ {
obj.SetActive(isShow); bool isActive = true;
bool.TryParse(isShow, out isActive);
obj.SetActive(isActive);
} }
this.Finish(); this.Finish();

View File

@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QFramework;
using System;
using QFramework.Example;
using DG.Tweening;
using System.ComponentModel.Design;
public class SkinnedBakeAction : IAction
{
public ulong ActionID { get; set; }
public bool Deinited { get; set; }
public bool Paused { get; set; }
public ActionStatus Status { get; set; }
private static readonly SimpleObjectPool<SkinnedBakeAction> mPool =
new SimpleObjectPool<SkinnedBakeAction>(() => new SkinnedBakeAction(), null, 10);
string path;
string deviceName;
public static SkinnedBakeAction Allocate(string path, Dictionary<string, string> datas, System.Action onDelayFinish = null)
{
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.Reset();
retNode.path = path;
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
return retNode;
}
public void Deinit()
{
if (!Deinited)
{
Deinited = true;
mPool.Recycle(this);
}
}
public void OnExecute(float dt)
{
}
public void OnFinish()
{
}
public void OnStart()
{
GameObject obj = null;
if (string.IsNullOrEmpty(deviceName) == false)
{
obj = DeviceController.Instance.GetDeviceObj(deviceName);
}
else
{
obj = Utility.FindObj(path);
}
if (obj == null)
{
Debug.LogError("ûÓÐÕÒµ½ÎïÌå :" + path);
}
else
{
Mesh mesh = new Mesh();
obj.GetComponent<SkinnedMeshRenderer>().BakeMesh(mesh);
obj.GetComponent<MeshCollider>().sharedMesh = mesh;
}
this.Finish();
}
public void Reset()
{
Status = ActionStatus.NotStart;
Paused = false;
}
}

View File

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

View File

@ -374,7 +374,11 @@ namespace XMLTool
{ {
act.args.Add("speed", speed.Value); act.args.Add("speed", speed.Value);
} }
var deviceName = action.Attribute("deviceName");
if (deviceName != null)
{
act.args.Add("deviceName", deviceName.Value);
}
newAction = act; newAction = act;
} }
break; break;
@ -572,25 +576,22 @@ namespace XMLTool
break; break;
case "Show": case "Show":
{ {
var act = new StringListAction(); var act = new DictionaryAction();
XAttribute isShow = action.Attribute("isShow"); XAttribute isShow = action.Attribute("isShow");
if (isShow != null) if (isShow != null)
{ {
act.args.Add(isShow.Value); act.args.Add("isShow",isShow.Value);
}
else
{
act.args.Add("true");
} }
XAttribute isDevice = action.Attribute("isDevice"); XAttribute isDevice = action.Attribute("isDevice");
if (isDevice != null) if (isDevice != null)
{ {
act.args.Add(isDevice.Value); act.args.Add("isDevice", isDevice.Value);
} }
else XAttribute deviceName = action.Attribute("deviceName");
if (deviceName != null)
{ {
act.args.Add("false"); act.args.Add("deviceName", deviceName.Value);
} }
newAction = act; newAction = act;
} }
@ -1009,6 +1010,17 @@ namespace XMLTool
newAction = act; newAction = act;
} }
break; break;
case "SkinnedBake":
{
var act = new DictionaryAction();
XAttribute deviceName = action.Attribute("deviceName");
if (deviceName != null)
{
act.args.Add("deviceName", deviceName.Value);
}
newAction = act;
}
break;
default: default:
newAction = new Action(); newAction = new Action();
break; break;

View File

@ -17,8 +17,8 @@
<Action type="Scale" value="Main Camera" to="0,180,0" time="0"></Action> <Action type="Scale" value="Main Camera" to="0,180,0" time="0"></Action>
<!--执行下一步左侧步骤列表 默认开始的时候为-1步 要主动调用一次才到第1步--> <!--执行下一步左侧步骤列表 默认开始的时候为-1步 要主动调用一次才到第1步-->
<Action type="NextOperation"></Action> <Action type="NextOperation"></Action>
<!--播放动画 reset=true则动画停在第一帧 frame是指定格在动画的某一帧 如果为-1 正常播放动画 speed 动画播放速度 默认为1 --> <!--播放动画 reset=true则动画停在第一帧 frame是指定格在动画的某一帧 如果为-1 正常播放动画 speed 动画播放速度 默认为1 deviceName与物体路径二选一 -->
<Action type="Anim" value="物体路径" animName="动画名字" frame="-1" speed="1"></Action> <Action type="Anim" value="物体路径" deviceName="" animName="动画名字" frame="-1" speed="1"></Action>
<!--右下角生成按钮 可生成多个 用逗号分开--> <!--右下角生成按钮 可生成多个 用逗号分开-->
<Action type="Btns" value="按钮1,按钮2,按钮3"></Action> <Action type="Btns" value="按钮1,按钮2,按钮3"></Action>
<!--用于右侧道具栏选择正确的道具 event用于配合StrEventCondition 做检测 rightScore 正确选择一个 得分 wrongScore 错误一个 得分 scoreStepName是评分的key --> <!--用于右侧道具栏选择正确的道具 event用于配合StrEventCondition 做检测 rightScore 正确选择一个 得分 wrongScore 错误一个 得分 scoreStepName是评分的key -->
@ -60,8 +60,10 @@
宽度不要小于500 否则进度条看不太清楚--> 宽度不要小于500 否则进度条看不太清楚-->
<Action type="Video" value="test.mp4" size="500,500" offset="10,10" finishedEvent="finished" closeEvent="close"></Action> <Action type="Video" value="test.mp4" size="500,500" offset="10,10" finishedEvent="finished" closeEvent="close"></Action>
<!--物体显隐 用于3D物体 isShow=true为显示 false为隐藏 UI的显隐使用UIShow isDevice为true的话 value就要写device配置的Name--> <!--物体显隐 用于3D物体 isShow=true为显示 false为隐藏 UI的显隐使用UIShow isDevice为true的话 value就要写device配置的Name
<Action type="Show" value="SM_QvanChangJing/sence/pPlane1" isShow="false" isDevice="false"></Action> 如果deviceName存在 则不用isDevice
-->
<Action type="Show" value="SM_QvanChangJing/sence/pPlane1" deviceName="设备名字" isShow="false" isDevice="false"></Action>
<!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮--> <!--设置物体高亮 deviceName可以用于设备名字 value是物体路径 color是rgba isHigh设置是否显示高亮-->
<Action type="HighLight" deviceName="设备名字" value="路径" isHigh="true" color="0,255,0,255"></Action> <Action type="HighLight" deviceName="设备名字" value="路径" isHigh="true" color="0,255,0,255"></Action>
<!--延迟 value是秒--> <!--延迟 value是秒-->
@ -120,7 +122,8 @@
--> -->
<Action type="TimeTip" value="这里是文字描述&lt;color=#FF00FF&gt;{0}&lt;/color&gt;-{1}" time="5" values="5,10|50,100" format="{0:F1}" finishedEvent="close" needClick="false" reverse="false" ></Action> <Action type="TimeTip" value="这里是文字描述&lt;color=#FF00FF&gt;{0}&lt;/color&gt;-{1}" time="5" values="5,10|50,100" format="{0:F1}" finishedEvent="close" needClick="false" reverse="false" ></Action>
<!--用于刷新骨骼动画执行后 meshCollider最后的位置-->
<Action type="SkinnedBake" value="路径和DeviceName二选一" deviceName="肠钳"></Action>
<!--通用事件通知 <!--通用事件通知