From 90b1694ab846e1c6fca4ef2dc1015edc53e22237 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 9 May 2025 16:15:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BA=BF=E6=A1=86=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20=E8=BE=B9=E7=BA=BF=E5=AE=BD=E5=BA=A6=E5=8F=AF?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Item/Body3DObjItem.cs | 4 ++++ Assets/Scripts/Item/ObjectColorToggle.cs | 5 ++--- Assets/Scripts/Xml/XmlParser.cs | 7 +++++++ Data/Xml/3DJiePao.xml | 4 +++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Item/Body3DObjItem.cs b/Assets/Scripts/Item/Body3DObjItem.cs index 0f2118b5..4d3c56ca 100644 --- a/Assets/Scripts/Item/Body3DObjItem.cs +++ b/Assets/Scripts/Item/Body3DObjItem.cs @@ -81,6 +81,10 @@ public class Body3DObjItem : MonoBehaviour if (t.shader != null) { GetComponent().material.shader = t.shader; + if (body.lineModeWidth != 0) + { + GetComponent().material.SetFloat("_OutlineWidth", body.lineModeWidth); + } } else { diff --git a/Assets/Scripts/Item/ObjectColorToggle.cs b/Assets/Scripts/Item/ObjectColorToggle.cs index 3afb9571..79bd50d5 100644 --- a/Assets/Scripts/Item/ObjectColorToggle.cs +++ b/Assets/Scripts/Item/ObjectColorToggle.cs @@ -18,7 +18,8 @@ public class ObjectColorToggle : MonoBehaviour private void Awake() { mesh = gameObject.GetComponent(); - isOffColor = mesh.material.color; + isOffColor = mesh.material.color; + savedTexture = mesh.material.mainTexture as Texture2D; } public void SetColor(State state) @@ -28,7 +29,6 @@ public class ObjectColorToggle : MonoBehaviour { case State.On: isOnColor.a = alpha; - savedTexture = mesh.material.mainTexture as Texture2D; mesh.material.mainTexture = null; mesh.material.color = isOnColor; break; @@ -39,7 +39,6 @@ public class ObjectColorToggle : MonoBehaviour break; case State.Hover: isHoverColor.a = alpha; - savedTexture = mesh.material.mainTexture as Texture2D; mesh.material.mainTexture = null; mesh.material.color = isHoverColor; break; diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 62845e9c..884dd17a 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -186,6 +186,7 @@ namespace XMLTool public Dictionary subBody { get; set; } = new Dictionary(); public Body parent; + public float lineModeWidth = 0; //public Dictionary bodyList { get; set; } = new Dictionary(); } @@ -440,6 +441,12 @@ namespace XMLTool body.subBody.Add(subBody.Name, subBody); } body.parent = parent; + + var lineModeWidth = bodyElement.Attribute("lineModeWidth"); + if (lineModeWidth != null) + { + float.TryParse(lineModeWidth.Value, out body.lineModeWidth); + } return body; } diff --git a/Data/Xml/3DJiePao.xml b/Data/Xml/3DJiePao.xml index cd588ce7..3fda8c5a 100644 --- a/Data/Xml/3DJiePao.xml +++ b/Data/Xml/3DJiePao.xml @@ -12198,7 +12198,9 @@ - +