From fe6152d144f918963d8e8e316761a79c91b08b98 Mon Sep 17 00:00:00 2001
From: shenjianxing <”315615051@qq.com“>
Date: Fri, 9 May 2025 14:58:12 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E9=80=82=E9=85=8D4K=E5=88=86=E8=BE=A8?=
=?UTF-8?q?=E7=8E=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/Draw/Scripts/ScreenShotPainter.cs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/Assets/Draw/Scripts/ScreenShotPainter.cs b/Assets/Draw/Scripts/ScreenShotPainter.cs
index 971cfe88..9cea52ea 100644
--- a/Assets/Draw/Scripts/ScreenShotPainter.cs
+++ b/Assets/Draw/Scripts/ScreenShotPainter.cs
@@ -700,7 +700,12 @@ public class ScreenShotPainter : MonoBehaviour
RectFactory();
break;
case Status.Circle:
- var dis = Vector2.Distance(_lastPoint, Input.mousePosition) * 2;
+ Vector2 last;
+ Vector2 mouse;
+ RectTransformUtility.ScreenPointToLocalPointInRectangle(circleImg.rectTransform.parent as RectTransform, _lastPoint, null, out last);
+ RectTransformUtility.ScreenPointToLocalPointInRectangle(circleImg.rectTransform.parent as RectTransform, Input.mousePosition, null, out mouse);
+
+ var dis = Vector2.Distance(last, mouse) * 2;
circleImg.rectTransform.sizeDelta = new Vector2(dis, dis);
break;
case Status.Arrow:
@@ -821,7 +826,7 @@ public class ScreenShotPainter : MonoBehaviour
{
if (lineStart != default)
{
- var points = GenerateArrowPoints(lineStart, Input.mousePosition,0.1f);
+ var points = GenerateArrowPoints(lineStart, Input.mousePosition, 0.1f);
_lastPoint = lineStart;
Paint(_eraserFlag, lineStart);
LerpPaint(Input.mousePosition, _eraserFlag);
@@ -1038,10 +1043,6 @@ public class ScreenShotPainter : MonoBehaviour
yield return new WaitForEndOfFrame();
float width = _rightUpConnerPoint.x - _leftDownConnerPoint.x;
float height = _rightUpConnerPoint.y - _leftDownConnerPoint.y;
- Debug.Log(_leftDownConnerPoint.x.ToString("0.00"));
- Debug.Log(_leftDownConnerPoint.y.ToString("0.00"));
- Debug.Log("width:" + width);
- Debug.Log("width:" + height);
Rect rect = new Rect(_leftDownConnerPoint.x, _leftDownConnerPoint.y, width, height); //坑爹啊 如果是开携程在WaitForEndOfFrame时候截图,那么他的坐标系换了。。rect起始点要设置在左下角
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 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BA=BF=E6=A1=86?=
=?UTF-8?q?=E6=A8=A1=E5=BC=8F=20=E8=BE=B9=E7=BA=BF=E5=AE=BD=E5=BA=A6?=
=?UTF-8?q?=E5=8F=AF=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 @@
+
From 17ae9098bf5ae9f59f8f806a3389d0eba8e37115 Mon Sep 17 00:00:00 2001
From: shenjianxing <”315615051@qq.com“>
Date: Fri, 9 May 2025 16:27:09 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8F=8D=E9=A6=88?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/Scripts/Item/Body3DObjItem.cs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Assets/Scripts/Item/Body3DObjItem.cs b/Assets/Scripts/Item/Body3DObjItem.cs
index 4d3c56ca..dbd9df84 100644
--- a/Assets/Scripts/Item/Body3DObjItem.cs
+++ b/Assets/Scripts/Item/Body3DObjItem.cs
@@ -23,8 +23,7 @@ public class Body3DObjItem : MonoBehaviour
private void Awake()
{
- shader = GetComponent()?.material.shader;
- TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this);
+
#if VR
#if Turing
@@ -77,7 +76,6 @@ public class Body3DObjItem : MonoBehaviour
#endif
private void OnChangeMatEvent(OnChangeMat t)
{
-
if (t.shader != null)
{
GetComponent().material.shader = t.shader;
@@ -97,7 +95,8 @@ public class Body3DObjItem : MonoBehaviour
public void Init(Body3D.Body body)
{
this.body = body;
-
+ shader = GetComponent()?.material.shader;
+ TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this);
if (body.subBody == null || body.subBody.Count == 0)
{
if (body.toggle != null)
From b24ab3957647190eb5bc43ca19911587801838f3 Mon Sep 17 00:00:00 2001
From: shenjianxing <”315615051@qq.com“>
Date: Fri, 9 May 2025 17:09:37 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8F=8D=E9=A6=88?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/Scripts/Controller/Body3DController.cs | 9 ++++-
Assets/Scripts/Item/Body3DObjItem.cs | 19 ----------
Assets/Scripts/Item/LineModeItem.cs | 38 +++++++++++++++++++
Assets/Scripts/Item/LineModeItem.cs.meta | 11 ++++++
Assets/Scripts/Xml/XmlParser.cs | 9 +++++
Data/Xml/3DJiePao.xml | 2 +-
6 files changed, 67 insertions(+), 21 deletions(-)
create mode 100644 Assets/Scripts/Item/LineModeItem.cs
create mode 100644 Assets/Scripts/Item/LineModeItem.cs.meta
diff --git a/Assets/Scripts/Controller/Body3DController.cs b/Assets/Scripts/Controller/Body3DController.cs
index 3f6ffe6b..4e45c22f 100644
--- a/Assets/Scripts/Controller/Body3DController.cs
+++ b/Assets/Scripts/Controller/Body3DController.cs
@@ -213,14 +213,21 @@ public class Body3DController : MonoSingleton
{
Parser(item.Value);
}
+
+ if (body.isLineModeItem)
+ {
+ GameObject obj = Utility.FindObj(body.Path);
+ obj.GetOrAddComponent().Init(body);
+ }
}
else
{
GameObject obj = Utility.FindObj(body.Path);
-
+
//if (obj != null) { Debug.Log("????" + body.Path + "????"); };
var bodyObjItem = obj.GetOrAddComponent();
bodyObjItem.Init(body);
+ var lineModeItem = obj.GetOrAddComponent().Init(body);
objs.Add(obj, bodyObjItem);
}
}
diff --git a/Assets/Scripts/Item/Body3DObjItem.cs b/Assets/Scripts/Item/Body3DObjItem.cs
index dbd9df84..5b5453b4 100644
--- a/Assets/Scripts/Item/Body3DObjItem.cs
+++ b/Assets/Scripts/Item/Body3DObjItem.cs
@@ -19,7 +19,6 @@ public class Body3DObjItem : MonoBehaviour
private float lastClickTime;
// ˫ʱֵ
private const float doubleClickTimeThreshold = 0.3f;
- Shader shader;
private void Awake()
{
@@ -74,29 +73,11 @@ public class Body3DObjItem : MonoBehaviour
}
}
#endif
- private void OnChangeMatEvent(OnChangeMat t)
- {
- if (t.shader != null)
- {
- GetComponent().material.shader = t.shader;
- if (body.lineModeWidth != 0)
- {
- GetComponent().material.SetFloat("_OutlineWidth", body.lineModeWidth);
- }
- }
- else
- {
- GetComponent().material.shader = this.shader;
- }
-
- }
public void Init(Body3D.Body body)
{
this.body = body;
- shader = GetComponent()?.material.shader;
- TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this);
if (body.subBody == null || body.subBody.Count == 0)
{
if (body.toggle != null)
diff --git a/Assets/Scripts/Item/LineModeItem.cs b/Assets/Scripts/Item/LineModeItem.cs
new file mode 100644
index 00000000..ba8377ff
--- /dev/null
+++ b/Assets/Scripts/Item/LineModeItem.cs
@@ -0,0 +1,38 @@
+using QFramework;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using XMLTool;
+
+public class LineModeItem : MonoBehaviour
+{
+ Shader shader;
+ public Body3D.Body body;
+ public LineModeItem Init(Body3D.Body body)
+ {
+ this.body = body;
+ shader = GetComponent()?.material.shader;
+ TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this);
+ return this;
+ }
+
+
+ private void OnChangeMatEvent(OnChangeMat t)
+ {
+ if (t.shader != null)
+ {
+ GetComponent().material.shader = t.shader;
+ if (body.lineModeWidth != 0)
+ {
+ GetComponent().material.SetFloat("_OutlineWidth", body.lineModeWidth);
+ }
+ }
+ else
+ {
+
+ GetComponent().material.shader = this.shader;
+ }
+
+ }
+
+}
diff --git a/Assets/Scripts/Item/LineModeItem.cs.meta b/Assets/Scripts/Item/LineModeItem.cs.meta
new file mode 100644
index 00000000..223e80d0
--- /dev/null
+++ b/Assets/Scripts/Item/LineModeItem.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c29f8a68d4de741499c43ccf8a9d6bf0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs
index 884dd17a..071d1403 100644
--- a/Assets/Scripts/Xml/XmlParser.cs
+++ b/Assets/Scripts/Xml/XmlParser.cs
@@ -187,6 +187,7 @@ namespace XMLTool
public Body parent;
public float lineModeWidth = 0;
+ public bool isLineModeItem = false;
//public Dictionary bodyList { get; set; } = new Dictionary();
}
@@ -447,6 +448,14 @@ namespace XMLTool
{
float.TryParse(lineModeWidth.Value, out body.lineModeWidth);
}
+
+
+ var isLineModeItem = bodyElement.Attribute("isLineModeItem");
+ if (isLineModeItem != null)
+ {
+ bool.TryParse(isLineModeItem.Value, out body.isLineModeItem);
+ }
+
return body;
}
diff --git a/Data/Xml/3DJiePao.xml b/Data/Xml/3DJiePao.xml
index 3fda8c5a..fc5dfd38 100644
--- a/Data/Xml/3DJiePao.xml
+++ b/Data/Xml/3DJiePao.xml
@@ -11432,7 +11432,7 @@
-
+