Browse Source

[+]层级修改功能修改

2809621200 2 weeks ago
parent
commit
5da4bb605c

+ 1 - 1
ModeDisplay/Assets/GameAssets/06.UIPrefabs/CustomPartPanel.prefab

@@ -4923,7 +4923,7 @@ MonoBehaviour:
       m_Calls: []
   m_FontData:
     m_Font: {fileID: 12800000, guid: e3e4a2f036d982644bcb6c61b7e31b18, type: 3}
-    m_FontSize: 27
+    m_FontSize: 20
     m_FontStyle: 0
     m_BestFit: 0
     m_MinSize: 2

+ 0 - 3
ModeDisplay/Assets/Scripts/Proxys/DeviceOfPartDataProxy.cs

@@ -12,8 +12,6 @@ public class DeviceOfPartDataProxy : DataProxy
     public List<CustomPartData> m_CustomInfos;
 
     public List<GameObject> objects = new List<GameObject>();
-    Dictionary<string, Transform> pathToTransform = new Dictionary<string, Transform>();
-
     public override void OnRegister()
     {
         
@@ -96,7 +94,6 @@ public class DeviceOfPartDataProxy : DataProxy
             int j = i;
             GameObject tmpObj = GameObject.Find(m_CustomInfos[j].AbsolutePath);
             objects.Add(tmpObj);
-            pathToTransform.Add(m_CustomInfos[j].EditPath,tmpObj.transform);
             datas.Add(new RestoreData(tmpObj.transform, m_CustomInfos[j].EditPath));
         }
 

+ 42 - 20
ModeDisplay/Assets/Scripts/UI/QFramework/CustomPartPanel.cs

@@ -97,8 +97,7 @@ namespace QFramework
 			//修改名称按钮
 			PartNameBtn.onClick.AddListener(() =>
 			{
-				if(initCustomTable())
-					return;
+				initCustomTable();
 				SetBtnInteractable(false);
 				CustomState = CustomPanelBtnkState.NameEdit;
 
@@ -117,8 +116,7 @@ namespace QFramework
 			//修改媒体资源按钮
 			ResourcesBtn.onClick.AddListener(() =>
 			{
-				if (initCustomTable())
-					return;
+				initCustomTable();
 				SetBtnInteractable(false);
 				CustomState = CustomPanelBtnkState.ResourceEdit;
 
@@ -135,8 +133,7 @@ namespace QFramework
 
 			HierarchyBtn.onClick.AddListener(() =>
 			{
-				if (initCustomTable())
-					return;
+				initCustomTable();
 				IFChangeLayer = true;
 				SetBtnInteractable(false);
 				CustomState = CustomPanelBtnkState.LayerEdit;
@@ -192,22 +189,24 @@ namespace QFramework
 		}
 
 
-		private bool initCustomTable()
+		private void initCustomTable()
         {
 			if (SelectItem == null)
-				return true;
+				return;
 
-			if (DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(SelectItem.partInfo.partName) == null
-				&& DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByPartName(SelectItem.partInfo.partName) == null)
-			{
-				DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
-				CustomPartData data = new CustomPartData(SelectItem.partInfo.partName, SubtitleName.text.Substring(0, SubtitleName.text.LastIndexOf('.')), SelectItem.partInfo.partName, AbsolutePath);
-				ExcelHelper.WriteInfoToExcel(ConfigSerachPath, data);
-				ExcelIndex = data.id.ToInt()+1;
-				editObjs.Add(SelectItem);
-			}
+			if (DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(SelectItem.TitleText.text) != null)
+				return;
+
+			if (DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByPartName(SelectItem.TitleText.text) != null)
+				return;
+
+			
+			CustomPartData data = new CustomPartData(SelectItem.partInfo.partName, SubtitleName.text.Substring(0, SubtitleName.text.LastIndexOf('.')), SelectItem.partInfo.partName, AbsolutePath, AbsolutePath);
+			ExcelHelper.WriteInfoToExcel(ConfigSerachPath, data);
+			DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
+			ExcelIndex = data.id.ToInt()+1;
+			editObjs.Add(SelectItem);
 
-			return false;
 		}
 		public string GetAbsolutePath(CustomItem tmpItem)
 		{
@@ -491,9 +490,32 @@ namespace QFramework
 
 		#region 层级修改
 
+		public bool ifChangeInChild(CustomItem tmpItem)
+		{
+			foreach (CustomItem item in tmpItem.childCustomInfo)
+			{
+			
+				if (item.TitleText.text.Equals(SelectNewParent.TitleText.text))
+				{
+					PromptMessage.text = $"请先将子层级部件上移\n禁止直接将父层级下移至其子层级";
+					return false;  // 找到匹配,返回 false
+				}
+
+				if (!ifChangeInChild(item))
+				{
+					return false;  // 子项中找到匹配,返回 false
+				}
+			}
+			return true;  // 所有子项都没有匹配,返回 true
+		}
+
 		public void SaveLayerBtnOnClick()
         {
-			if (SelectNewParent == null)
+			
+			if (SelectNewParent == null )
+				return;
+
+			if (! ifChangeInChild(SelectItem))
 				return;
 
 			ChangeLayer();
@@ -693,7 +715,7 @@ namespace QFramework
 		public string AbsolutePath;
 		public string EditPath;
 
-		public CustomPartData( string partName,string audioClipName,string editName,string AbsolutePath,string EditParh = "",string EditPath = "")
+		public CustomPartData( string partName,string audioClipName,string editName,string AbsolutePath,string EditPath = "")
         {
 			id = (DAL.Instance.Get<DeviceOfPartDataProxy>().m_CustomInfos.Count+1).ToString();
 			this.partName = partName;

+ 7 - 0
ModeDisplay/Assets/Scripts/UI/QFramework/CustomPartPanel/CustomItem.cs

@@ -36,6 +36,13 @@ namespace QFramework
 					UIKit.GetPanel<CustomPartPanel>().DeleteTableBtnText.text = "µã»÷Ìí¼ÓÐÞ¸ÄÅäÖñí";
 					return;
 				}
+
+                if (UIKit.GetPanel<CustomPartPanel>().SaveEditBtn.IsActive() || UIKit.GetPanel<CustomPartPanel>().ExitEditBtn.IsActive())
+                {
+					if(UIKit.GetPanel<CustomPartPanel>().CustomState == CustomPartPanel.CustomPanelBtnkState.LayerEdit)
+						UIKit.GetPanel<CustomPartPanel>().GetSelectChangeMessage(this);
+					return;
+                }
 				if (transform.GetSiblingIndex() != 0)
                 UIKit.GetPanel<CustomPartPanel>().GetSelectChangeMessage(this); 
 

BIN
ModeDisplay/Assets/StreamingAssets/Config/内部结构设备自定义配置/联合风机.xlsx


+ 0 - 7
ModeDisplay/Assets/StreamingAssets/Config/内部结构设备自定义配置/联合风机.xlsx.meta

@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: d2a85895981050345a5697d233cccd2f
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
ModeDisplay/Assets/StreamingAssets/Config/内部结构设备自定义配置/金风GW109-2500永磁直驱风力发电机组.xlsx


+ 0 - 7
ModeDisplay/Assets/StreamingAssets/Config/内部结构设备自定义配置/金风GW109-2500永磁直驱风力发电机组.xlsx.meta

@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 878298303a2a2824f804438317dc6d10
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: