|
|
@@ -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);
|