diff --git a/Assets/Scripts/Actions/ActionBase.cs b/Assets/Scripts/Actions/ActionBase.cs index 140d45dc..b1dafcd9 100644 --- a/Assets/Scripts/Actions/ActionBase.cs +++ b/Assets/Scripts/Actions/ActionBase.cs @@ -10,10 +10,6 @@ namespace XMLTool public float time; } - public class AnimationAction : Action - { - public string animName; - } public class StringListAction : Action diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index d39d6ed1..17c96bef 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -99,8 +99,10 @@ public class ActionHelper case "Btns": return BtnsAction.Allocate(act.Value); case "Anim": - var anim = (XMLTool.AnimationAction)act; - return QFramework.AnimationAction.Allocate(anim.Value, anim.animName); + { + var strAction = (XMLTool.StringListAction)act; + return QFramework.AnimationAction.Allocate(act.Value, strAction.args[0], strAction.args[1]); + } case "UITools": { var strAction = (XMLTool.StringListAction)act; diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index 8f976538..c211d434 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -20,15 +20,17 @@ namespace QFramework string path; string animName; + bool reset = false; Animation anim; - public static AnimationAction Allocate(string path, string animName, System.Action OnFinished = null) + public static AnimationAction Allocate(string path, string animName, string reset, System.Action OnFinished = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; + retNode.Reset(); retNode.path = path; retNode.animName = animName; - retNode.Reset(); + bool.TryParse(reset, out retNode.reset); retNode.OnFinished = OnFinished; return retNode; } @@ -44,6 +46,10 @@ namespace QFramework { anim = obj.GetComponent(); anim.Play(animName); + if (reset) + { + ActionKit.DelayFrame(1, () => anim.Stop()); + } } else { diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 8d9f385c..eb047213 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -317,8 +317,26 @@ namespace XMLTool break; case "Anim": { - var act = new AnimationAction(); - act.animName = action.Attribute("animName").Value; + var act = new StringListAction(); + var animName = action.Attribute("animName"); + if (animName != null) + { + act.args.Add(animName.Value); + } + else + { + act.args.Add(""); + } + var reset = action.Attribute("reset"); + if (reset != null) + { + act.args.Add(reset.Value); + } + else + { + act.args.Add("false"); + } + newAction = act; } break; diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 1d08b8b7..63d97c07 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -15,8 +15,8 @@ - - + +