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 @@ - +