diff --git a/Assets/Scripts/Actions/MatAction.cs b/Assets/Scripts/Actions/MatAction.cs index 14af6ca1..0ee2c157 100644 --- a/Assets/Scripts/Actions/MatAction.cs +++ b/Assets/Scripts/Actions/MatAction.cs @@ -24,6 +24,7 @@ namespace QFramework string deviceName; string matName; string index; + string mainTexture; public static MatAction Allocate(Dictionary datas, System.Action OnFinished = null) { var retNode = mPool.Allocate(); @@ -34,6 +35,7 @@ namespace QFramework retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : ""; retNode.matName = datas.ContainsKey("matName") ? datas["matName"] : ""; retNode.index = datas.ContainsKey("index") ? datas["index"] : "0"; + retNode.mainTexture = datas.ContainsKey("mainTexture") ? datas["mainTexture"] : null; retNode.OnFinished = OnFinished; return retNode; } @@ -56,7 +58,22 @@ namespace QFramework var mesh = obj.GetComponent(); int matIndex = 0; int.TryParse(index, out matIndex); - mesh.materials[matIndex] = Resources.Load("Mat/" + matName); + if (string.IsNullOrEmpty(matName) == false) + { + mesh.materials[matIndex] = Resources.Load("Mat/" + matName); + } + if (mainTexture != null) + { + if (mainTexture == "") + { + mesh.materials[matIndex].mainTexture = null; + } + else + { + mesh.materials[matIndex].mainTexture = Resources.Load("Mat/" + mainTexture); + } + } + this.Finish(); } diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index ab62047c..1a0548d6 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -1122,6 +1122,11 @@ namespace XMLTool { act.args.Add("index", index.Value); } + XAttribute mainTexture = action.Attribute("mainTexture"); + if (mainTexture != null) + { + act.args.Add("mainTexture", mainTexture.Value); + } newAction = act; } break; diff --git a/Doc/Xml配置文档.xml b/Doc/Xml配置文档.xml index 74fe120d..381962ab 100644 --- a/Doc/Xml配置文档.xml +++ b/Doc/Xml配置文档.xml @@ -162,7 +162,8 @@ - + +