From dcbecd6c46c8042930128dcfe3227fa87071d71e Mon Sep 17 00:00:00 2001 From: yzx Date: Tue, 4 Jun 2024 20:13:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scenes/工具间Scenes/工具间.unity | 178 +++++++++++++++++- .../Scripts/ToolsPack/ToolsPackManager.cs | 52 ++--- .../ToolsPackWindowItemBtComponent.cs | 7 +- .../ToolsPack/ToolsPackWindowManager.cs | 5 +- 4 files changed, 211 insertions(+), 31 deletions(-) diff --git a/SXElectricityInformationAcquisition/Assets/Scenes/工具间Scenes/工具间.unity b/SXElectricityInformationAcquisition/Assets/Scenes/工具间Scenes/工具间.unity index 53d92e4b..68570cb9 100644 --- a/SXElectricityInformationAcquisition/Assets/Scenes/工具间Scenes/工具间.unity +++ b/SXElectricityInformationAcquisition/Assets/Scenes/工具间Scenes/工具间.unity @@ -242,6 +242,62 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1771205975173060022} m_Modifications: + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_DirtyAABB + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.x + value: -0.00000013411045 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.y + value: -0.000000059604645 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.z + value: 0.000002694549 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.x + value: 0.0060756058 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.y + value: 0.013877571 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.z + value: 0.0044264225 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_DirtyAABB + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.x + value: -0.00000013411045 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.y + value: -0.000000059604645 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.z + value: 0.000002694549 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.x + value: 0.0060756058 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.y + value: 0.013877571 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.z + value: 0.0044264225 + objectReference: {fileID: 0} - target: {fileID: 7063737413586441568, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} propertyPath: m_LocalPosition.x value: -3.1579 @@ -284,7 +340,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7587649942819475418, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} propertyPath: m_Name - value: "I\u578B\u96C6\u4E2D\u5668 (1)" + value: "\u96C6\u4E2D\u5668" objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -990,6 +1046,62 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1771205975173060022} m_Modifications: + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_DirtyAABB + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.x + value: -0.00000013411045 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.y + value: -0.000000059604645 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.z + value: 0.000002694549 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.x + value: 0.0060756058 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.y + value: 0.013877571 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.z + value: 0.0044264225 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_DirtyAABB + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.x + value: -0.00000013411045 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.y + value: -0.000000059604645 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.z + value: 0.000002694549 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.x + value: 0.0060756058 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.y + value: 0.013877571 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.z + value: 0.0044264225 + objectReference: {fileID: 0} - target: {fileID: 7063737413586441568, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} propertyPath: m_LocalPosition.x value: -3.1579 @@ -1032,7 +1144,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7587649942819475418, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} propertyPath: m_Name - value: "I\u578B\u96C6\u4E2D\u5668 (2)" + value: "\u96C6\u4E2D\u5668" objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -1808,8 +1920,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 963194225} serializedVersion: 2 - m_LocalRotation: {x: -0.0015304144, y: 0.99706376, z: -0.07372659, w: -0.020641118} - m_LocalPosition: {x: 1.2103322, y: 1.4038103, z: 1.5464077} + m_LocalRotation: {x: -0.07771084, y: 0.8584069, z: -0.13659753, w: -0.48830304} + m_LocalPosition: {x: -1.5510933, y: 1.7070881, z: -0.29013184} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -4367,6 +4479,62 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1771205975173060022} m_Modifications: + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_DirtyAABB + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.x + value: -0.00000013411045 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.y + value: -0.000000059604645 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.z + value: 0.000002694549 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.x + value: 0.0060756058 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.y + value: 0.013877571 + objectReference: {fileID: 0} + - target: {fileID: 2173600290560809397, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.z + value: 0.0044264225 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_DirtyAABB + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.x + value: -0.00000013411045 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.y + value: -0.000000059604645 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Center.z + value: 0.000002694549 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.x + value: 0.0060756058 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.y + value: 0.013877571 + objectReference: {fileID: 0} + - target: {fileID: 5210755541034202660, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} + propertyPath: m_AABB.m_Extent.z + value: 0.0044264225 + objectReference: {fileID: 0} - target: {fileID: 7063737413586441568, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} propertyPath: m_LocalPosition.x value: -3.1579 @@ -4409,7 +4577,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7587649942819475418, guid: 6c9d41f3e96937c4f960e7fc87ca2d32, type: 3} propertyPath: m_Name - value: "I\u578B\u96C6\u4E2D\u5668" + value: "\u96C6\u4E2D\u5668" objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] diff --git a/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackManager.cs b/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackManager.cs index 0f081ec8..b8ffce13 100644 --- a/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackManager.cs +++ b/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackManager.cs @@ -18,22 +18,21 @@ public enum ToolsPackScene /// /// 工具包 /// -public class ToolsPackManager : ModuleSingleton, IModule -{ - - private Dictionary _toolsPack; +public class ToolsPackManager : ModuleSingleton, IModule +{ + private Dictionary> _toolsPack; private Dictionary _toolsPackWindowBtImage; //工具窗口下的按钮图集 - private List _toolsPackWindowItemBts;//工具窗口下创建的按钮集合,点击按钮的X用来删除和新增 - private GameObject _toolsPackWindow; + private List _toolsPackWindowItemBts; //工具窗口下创建的按钮集合,点击按钮的X用来删除和新增 + private GameObject _toolsPackWindow; private GameObject _toolsPackWindowBt; private Transform _canvas; - + private GameObject _toolsPackWindowTemp; private ToolsPackScene _toolsPackScene; - + public void OnCreate(object createParam) { - _toolsPack = new Dictionary(); + _toolsPack = new Dictionary>(); _toolsPackWindowItemBts = new List(); //加载工具窗口按钮 _toolsPackWindowBt = Resources.Load("Prefabs/Window/ToolsPack/ToolsPackWindowItemBt"); @@ -76,7 +75,11 @@ public class ToolsPackManager : ModuleSingleton, IModule { if (!_toolsPack.ContainsKey(toolsName)) { - _toolsPack.Add(toolsName, toolsGame); + _toolsPack.Add(toolsName, new List() { toolsGame }); + } + else + { + _toolsPack[toolsName].Add(toolsGame); } } @@ -109,15 +112,21 @@ public class ToolsPackManager : ModuleSingleton, IModule /// 根据名字查询工具包内容 /// /// - public (string, GameObject) GetToolsPack(string toolsName) + public GameObject GetToolsPack(string toolsName,int index) { - GameObject game; + List game; if (_toolsPack.TryGetValue(toolsName, out game)) { - return (toolsName, game); + for (int i = 0; i < game.Count; i++) + { + if (i == index) + { + return (game[i]); + } + } } - return (toolsName, null); + return null; } public Texture2D GetToolsPackWindowBtImage(string gName) @@ -135,17 +144,17 @@ public class ToolsPackManager : ModuleSingleton, IModule { return _toolsPackWindow; } - + public GameObject GetToolsPackWindowBt() { return _toolsPackWindowBt; } - + public GameObject GetToolsPackWindowTemp() { return _toolsPackWindowTemp; } - + public void SetToolsPackWindowTemp(GameObject win) { _toolsPackWindowTemp = win; @@ -160,10 +169,12 @@ public class ToolsPackManager : ModuleSingleton, IModule return _canvas; } + public ToolsPackScene GetToolsPackScene() { return _toolsPackScene; } + public void SetToolsPackScene(ToolsPackScene toolsPackScene) { _toolsPackScene = toolsPackScene; @@ -173,14 +184,15 @@ public class ToolsPackManager : ModuleSingleton, IModule { _toolsPackWindowItemBts.Add(toolGame); } + public void ClearToolsPackWindowItemBts() { _toolsPackWindowItemBts.Clear(); } + public void DeleteToolsPackWindowItemBts(string toolName) { - - List list = MotionEngine.GetModule().GetToolsPackData(toolName); + List list = MotionEngine.GetModule().GetToolsPackData(toolName); if (list != null) { for (int i = 0; i < _toolsPackWindowItemBts.Count; i++) @@ -208,7 +220,5 @@ public class ToolsPackManager : ModuleSingleton, IModule } } } - - } } \ No newline at end of file diff --git a/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackWindowItemBtComponent.cs b/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackWindowItemBtComponent.cs index f1663995..797accce 100644 --- a/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackWindowItemBtComponent.cs +++ b/SXElectricityInformationAcquisition/Assets/Scripts/ToolsPack/ToolsPackWindowItemBtComponent.cs @@ -12,6 +12,7 @@ namespace ToolsPack [SerializeField] private RawImage ico; [SerializeField] private GameObject closeBt; [SerializeField] private string btName; + [SerializeField] private int index; [SerializeField] private Text btNameText; @@ -19,18 +20,18 @@ namespace ToolsPack { closeBt.GetComponent