2809621200 1 周之前
父節點
當前提交
0adc597d39

+ 28 - 2
ModeDisplay/Assets/ChivaFramework/Framework/Init/GameLaunch.cs

@@ -1,4 +1,5 @@
-using System;
+using Grpc.Core;
+using System;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
@@ -34,9 +35,13 @@ public class GameLaunch : MonoBehaviour
         }
 
         //模拟数据
-        //string simulationData = "11111111111/10kV真空断路器及开关柜例行检修/练习/47.92.0.243:15156";
+        
+        //string simulationData = "4f92a652b13518f36f5d241291fc4df4892b29d5/联合风机///47.92.0.243:15155/None/联合风机/124444  ";
         //string[] tmpArgs = simulationData.Split('/');
         //截断
+        //13q7cxZXA2yqjZHT1P36JCkgMcWahBkYl5AzaTF7zCEmF6I6uVdtLN3klkg38FYVJ5UXjfU2GFRSPs2t1tyi8lZOuX1w2y0IpB1SeaCCnuJLMu4Z368EM / IPCb4xzxETok + I996fvrBVpcZNW / CAIlZ / FTqO9Xzz + YaNHq5aWji6ueQ9lLssuRVfn6d4Yt0lwwsXDNLxiFM1gLMa6JaQYA ==
+        //string a = "13q7cxZXA2yqjZHT1P36JCkgMcWahBkYl5AzaTF7zCEmF6I6uVdtLN3klkg38FYVJ5UXjfU2GFRSPs2t1tyi8lZOuX1w2y0IpB1SeaCCnuJLMu4Z368EM/IPCb4xzxETok+I996fvrBVpcZNW/CAIlZ/FTqO9Xzz+YaNHq5aWji6ueQ9lLssuRVfn6d4Yt0lwwsXDNLxiFM1gLMa6JaQYA== ";
+        //string[] tmpArgs = a.Decrypt("chivatech").Split('/');
         string[] tmpArgs = args[1].Decrypt("chivatech").Split('/');
 
         // 文件各种:手机号/课程名/模式/地址
@@ -87,6 +92,27 @@ public class GameLaunch : MonoBehaviour
             Debug.Log(tmpCourseName + " --" + tmpMode);
             #endregion
         }
+
+        //自由模式场景进自由练考模式
+        if (tmpCourseName.Contains("自由模式"))
+        {
+            SetOperationMode(tmpMode, true);
+        }
+        else
+        {
+            SetOperationMode(tmpMode);
+        }
+
+        GlobalConfig.m_SelectDevice = tmpCourseName;
+
+        if (!string.IsNullOrEmpty(tmpCourseName))
+        {
+            m_asyncLoad.Init(tmpCourseName, m_isOpenAsyncLoad);
+        }
+        else
+        {
+            Debug.Log($"ERROR:请检查是否存在 {tmpCourseName} 课程");
+        }
     }
 
     /// <summary>

+ 2 - 2
ModeDisplay/Assets/Scenes/AsyncLoad.unity

@@ -660,7 +660,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_Sprite: {fileID: 21300000, guid: 648c7786efa5e1547a87aff98f811862, type: 3}
+  m_Sprite: {fileID: 21300000, guid: 353d508bd57fb6345889648deb2f49c0, type: 3}
   m_Type: 0
   m_PreserveAspect: 0
   m_FillCenter: 1
@@ -901,7 +901,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &1052246916
 RectTransform:
   m_ObjectHideFlags: 0

+ 4 - 2
ModeDisplay/Assets/Scripts/DeviceController.cs

@@ -21,6 +21,8 @@ public class DeviceController : MonoBehaviour
     public bool ShowCustomPanel = false;
     public bool ifShowCoustom = true;
 
+    public bool isDelectCustomTable = false;
+
     private void Awake()
     {
         instance = this;
@@ -57,10 +59,10 @@ public class DeviceController : MonoBehaviour
 
         if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
         {
-            if (Input.GetKeyDown(KeyCode.F4))
+            if (Input.GetKeyDown(KeyCode.F4) && !isDelectCustomTable)
             {
                 if (ShowCustomPanel)
-                    UIKit.ClosePanel<CustomPartPanel>();
+                    UIKit.HidePanel<CustomPartPanel>();
                 else
                     UIKit.OpenPanel<CustomPartPanel>();
                 ShowCustomPanel = !ShowCustomPanel;

+ 5 - 1
ModeDisplay/Assets/Scripts/Proxys/DeviceOfPartDataProxy.cs

@@ -70,6 +70,11 @@ public class DeviceOfPartDataProxy : DataProxy
         return m_CustomInfos.Find(t => t.partName == partName);
     }
 
+    public CustomPartData GetCustomByIdName(string id)
+    {
+        return m_CustomInfos.Find(t => t.id == id);
+    }
+
     public void CoverTableInfos()
     {
         for (int i = 0; i < m_CustomInfos.Count; i++)
@@ -87,7 +92,6 @@ public class DeviceOfPartDataProxy : DataProxy
     }
     public void endTableEditInfos(bool first = false)
     {
-        List<string> paths = new List<string>();
         List<RestoreData> datas = new List<RestoreData>();
         for (int i = 0; i < m_CustomInfos.Count; i++)
         {

+ 68 - 10
ModeDisplay/Assets/Scripts/UI/QFramework/CustomPartPanel.cs

@@ -28,7 +28,7 @@ namespace QFramework
 		private string ConfigSerachPath;
 		private string AbsolutePath;
 
-		private List<PartItem> PartListData;
+		public List<CustomItem> CustomAllData;
 
 		private int ExcelIndex;
 
@@ -37,7 +37,7 @@ namespace QFramework
 		/// <summary> 是否修改存储文件修改 </summary>
 		private bool ifSaveFileChange = false;
 
-		List<CustomItem> editObjs;
+		public List<CustomItem> editObjs;
 
 		public enum CustomPanelBtnkState
 		{
@@ -67,8 +67,8 @@ namespace QFramework
 			AudioSearchPath = $"{Application.streamingAssetsPath}/Config/Audios/内部结构/{DeviceController.instance.DeviceName}";
 			SubtitleSearchPath = $"{Application.streamingAssetsPath}/SubTitles/内部结构/{DeviceController.instance.DeviceName}";
 			ConfigSerachPath = $"{Application.streamingAssetsPath}/Config/内部结构设备自定义配置/{DeviceController.instance.DeviceName}.xlsx";
-			
-			PartListData =  new List<PartItem>();
+
+			CustomAllData = new List<CustomItem>();
 			editObjs = new List<CustomItem>();
 
 			//如果修改表格不存在就创建表格
@@ -84,10 +84,14 @@ namespace QFramework
 
 			//创建Item
 			CustomItem customExample = Instantiate(CustomItem.gameObject,Content).GetComponent<CustomItem>();
-			customExample.gameObject.SetActive(true);
-			customExample.InitData(DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>()));
+			customExample.InitData(DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>()),ref CustomAllData);
 			customExample.UnExpandChildPartItem();
 			customExample.ExpandChildPartItem();
+
+            for (int i = 0; i < DAL.Instance.Get<DeviceOfPartDataProxy>().m_CustomInfos.Count; i++)
+            {
+				editObjs.Add( CustomAllData.Find(t => t.partInfo.partName == DAL.Instance.Get<DeviceOfPartDataProxy>().m_CustomInfos[i].partName));
+			}
 			
 			addBtnOnclick();
 		}
@@ -97,6 +101,10 @@ namespace QFramework
 			//修改名称按钮
 			PartNameBtn.onClick.AddListener(() =>
 			{
+				if (SelectItem == null)
+				{
+					return;
+				}
 				initCustomTable();
 				SetBtnInteractable(false);
 				CustomState = CustomPanelBtnkState.NameEdit;
@@ -116,6 +124,10 @@ namespace QFramework
 			//修改媒体资源按钮
 			ResourcesBtn.onClick.AddListener(() =>
 			{
+				if(SelectItem == null)
+                {
+					return;
+                }
 				initCustomTable();
 				SetBtnInteractable(false);
 				CustomState = CustomPanelBtnkState.ResourceEdit;
@@ -133,6 +145,10 @@ namespace QFramework
 
 			HierarchyBtn.onClick.AddListener(() =>
 			{
+				if (SelectItem == null)
+				{
+					return;
+				}
 				initCustomTable();
 				IFChangeLayer = true;
 				SetBtnInteractable(false);
@@ -150,7 +166,8 @@ namespace QFramework
 
 			PanelExitBtn.onClick.AddListener(() =>
 			{
-				UIKit.ClosePanel<CustomPartPanel>();
+				UIKit.HidePanel<CustomPartPanel>();
+				
 				DeviceController.instance.ShowCustomPanel = !DeviceController.instance.ShowCustomPanel;
 			});
 
@@ -172,7 +189,12 @@ namespace QFramework
 					
 					RefreshPartItemList();
 					RefreshCustomItemList();
-					DeleteTableBtnText.text = "点击添加修改配置表";
+					DeleteTableBtnText.text = "配置表已删除";
+					PromptMessage.text = "重新启动以恢复配置修改。\n配置表将在下次打开编辑页面时自动生成。";
+					DeleteCustomTbaleBtn.interactable = false;
+					SelectItem = null;
+					DeviceController.instance.isDelectCustomTable = true;
+					isDelectTable = true;
 				}
                 else
                 {
@@ -189,6 +211,7 @@ namespace QFramework
 		}
 
 
+
 		private void initCustomTable()
         {
 			if (SelectItem == null)
@@ -227,11 +250,15 @@ namespace QFramework
 			PartNameBtn.interactable = ifOpen;
 		}
 
+		public bool isDelectTable = false;
+
 		#region 获取选中信息
 		/// <summary> 获取选中的组件信息 </summary>
 		/// <param name="customItem"></param>
 		public void GetSelectChangeMessage(CustomItem customItem)
 		{
+			if (isDelectTable)
+				return;
 			if (IFChangeLayer)
 			{
 				if (SelectItem == customItem)
@@ -680,9 +707,40 @@ namespace QFramework
 			DeviceController.instance.ifShowCoustom = false;
 
 		}
-				
-		protected override void OnClose()
+
+        protected override void OnHide()
+        {
+			FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
+			if (!tmpFileInfo.Exists)
+				return;
+
+			DeviceController.instance.ifShowCoustom = true;
+
+			DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
+			DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
+			RefreshPartItemList();
+
+			foreach (CustomItem item in editObjs)
+			{
+
+				CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(item.TitleText.text);
+				ExcelIndex = customPartData.id.ToInt() + 1;
+
+				using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(ConfigSerachPath)))
+				{
+					ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];
+					worksheet.Cells[ExcelIndex, 6].Value = GetAbsolutePath(item);
+					excelPackage.Save();
+				}
+			}
+		}
+
+        protected override void OnClose()
 		{
+			FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
+			if (!tmpFileInfo.Exists)
+				return;
+
 			DeviceController.instance.ifShowCoustom = true;
 
 			DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);

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

@@ -17,7 +17,6 @@ namespace QFramework
 		public CustomItem parentItem;
 		public PartInfo partInfo;
 		public int level;
-		public string partName;
 
 		public List<CustomItem> childCustomInfo;
 
@@ -30,10 +29,8 @@ namespace QFramework
 
             ClickBtn.onClick.AddListener(() =>
             {
-				if (!new FileInfo(Path.Combine(GlobalConfig.partEditTablePath, DeviceController.instance.DeviceName + GlobalConfig.excelSuffix)).Exists)
+				if (UIKit.GetPanel<CustomPartPanel>().isDelectTable)
 				{
-					UIKit.GetPanel<CustomPartPanel>().PromptMessage.text = "确少可修改的配置表\n点击左下角进行创建可修改的配置表";
-					UIKit.GetPanel<CustomPartPanel>().DeleteTableBtnText.text = "点击添加修改配置表";
 					return;
 				}
 
@@ -79,13 +76,13 @@ namespace QFramework
 		}
 	
 
-		public void InitData(PartInfo partInfo, CustomItem parentItem = null, int level = 0 )
+		public void InitData(PartInfo partInfo, ref List<CustomItem> customs, CustomItem parentItem = null, int level = 0 )
 		{
 			gameObject.SetActive(true);
 			this.level = level;
 			this.partInfo = partInfo;
 			this.parentItem = parentItem;
-
+			customs.Add(this);
 			TitleText.text = partInfo.partName;
 
 			RectTransform tmpRt = Position.GetComponent<RectTransform>();
@@ -96,7 +93,7 @@ namespace QFramework
 				GameObject tmpPartItem = Instantiate(UIKit.GetPanel<CustomPartPanel>().CustomItem.gameObject, transform.parent);
 				tmpPartItem.name = item.partName;
 				childCustomInfo.Add(tmpPartItem.GetComponent<CustomItem>());
-				tmpPartItem.GetComponent<CustomItem>().InitData(item,this, level + 1);
+				tmpPartItem.GetComponent<CustomItem>().InitData(item,ref customs, this, level + 1);
 			}
 
 			if (childCustomInfo.Count == 0)

+ 1 - 1
ModeDisplay/Assets/Scripts/UI/QFramework/PartListPanel.cs

@@ -216,7 +216,7 @@ namespace QFramework
             AllCmaera();
             UIKit.HidePanel<PartListPanel>();
 
-            UIKit.ClosePanel<CustomPartPanel>();
+            UIKit.HidePanel<CustomPartPanel>();
             DeviceController.instance.ShowCustomPanel = false;
             DeviceController.instance.gameObject.SetActive(false);
         }

+ 7 - 0
ModeDisplay/Assets/StreamingAssets/Config/内部结构设备自定义配置/空白占位.txt.meta

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

+ 4 - 4
ModeDisplay/ProjectSettings/EditorBuildSettings.asset

@@ -56,9 +56,6 @@ EditorBuildSettings:
   - enabled: 0
     path: "Assets/Scenes/\u8FD0\u884C\u539F\u7406/\u673A\u68B0\u8054\u52A8\u7279\u6027/500kV\u9694\u79BB\u5F00\u5173-\u673A\u68B0\u8054\u52A8\u7279\u6027.unity"
     guid: 40cbdb3f83227594db74194e3c2ba0d0
-  - enabled: 0
-    path: "Assets/Scenes/\u8FD0\u884C\u539F\u7406/\u71C3\u5F27\u7184\u5F27\u7279\u6027/10kV\u5F00\u5173\u67DC-\u71C3\u5F27\u7184\u5F27\u7279\u6027.unity"
-    guid: baf33622a9bbdbc418caa93786c13323
   - enabled: 0
     path: "Assets/Scenes/\u8FD0\u884C\u539F\u7406/\u71C3\u5F27\u7184\u5F27\u7279\u6027/10kV\u771F\u7A7A\u65AD\u8DEF\u5668-\u71C3\u5F27\u7184\u5F27\u7279\u6027.unity"
     guid: e5a564aa1bf68a548ba91f53dacc554d
@@ -92,7 +89,7 @@ EditorBuildSettings:
   - enabled: 1
     path: "Assets/Scenes/\u5185\u90E8\u7ED3\u6784/\u91D1\u98CE\u98CE\u529B\u53D1\u7535\u7EC4.unity"
     guid: 5345154bff89b394bb7434f77bef5310
-  - enabled: 0
+  - enabled: 1
     path: "Assets/Scenes/\u5185\u90E8\u7ED3\u6784/\u8054\u5408\u98CE\u673A.unity"
     guid: 74806e7da0e1d0948b7506f04f75b999
   - enabled: 0
@@ -116,4 +113,7 @@ EditorBuildSettings:
   - enabled: 0
     path: "Assets/Scenes/\u5185\u90E8\u7ED3\u6784/220kV GIS_ZF16-252.unity"
     guid: fabde7f3ef1195a45921e1253c5eb72c
+  - enabled: 0
+    path: "Assets/Scenes/\u8FD0\u884C\u539F\u7406/\u71C3\u5F27\u7184\u5F27\u7279\u6027/10kV\u5F00\u5173\u67DC-\u71C3\u5F27\u7184\u5F27\u7279\u6027.unity"
+    guid: baf33622a9bbdbc418caa93786c13323
   m_configObjects: {}