|
|
@@ -7,793 +7,818 @@ using OfficeOpenXml;
|
|
|
using System;
|
|
|
using System.Collections;
|
|
|
using static FileDialogHelper;
|
|
|
+using System.Text;
|
|
|
|
|
|
namespace QFramework
|
|
|
{
|
|
|
- public class CustomPartPanelData : UIPanelData
|
|
|
- {
|
|
|
- }
|
|
|
- public partial class CustomPartPanel : UIPanel
|
|
|
- {
|
|
|
- /// <summary> 选中的Item </summary>
|
|
|
- CustomItem SelectItem;
|
|
|
- /// <summary> 选中的新父级Item </summary>
|
|
|
- CustomItem SelectNewParent;
|
|
|
-
|
|
|
- /// <summary> 音频路径 </summary>
|
|
|
- private string AudioSearchPath;
|
|
|
- /// <summary> </summary>
|
|
|
- private string SubtitleSearchPath;
|
|
|
- /// <summary> </summary>
|
|
|
- private string ConfigSerachPath;
|
|
|
- private string AbsolutePath;
|
|
|
-
|
|
|
- public List<CustomItem> CustomAllData;
|
|
|
-
|
|
|
- private int ExcelIndex;
|
|
|
-
|
|
|
- /// <summary> 是否修改层级结构 </summary>
|
|
|
- public bool IFChangeLayer = false;
|
|
|
- /// <summary> 是否修改存储文件修改 </summary>
|
|
|
- private bool ifSaveFileChange = false;
|
|
|
-
|
|
|
- public List<CustomItem> editObjs;
|
|
|
-
|
|
|
- public enum CustomPanelBtnkState
|
|
|
- {
|
|
|
- NoOnclick,
|
|
|
- ResourceEdit,
|
|
|
- LayerEdit,
|
|
|
- NameEdit
|
|
|
- }
|
|
|
-
|
|
|
- public CustomPanelBtnkState CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
-
|
|
|
- protected override void ProcessMsg(int eventId, QMsg msg)
|
|
|
- {
|
|
|
- throw new System.NotImplementedException();
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnInit(IUIData uiData = null)
|
|
|
- {
|
|
|
- mData = uiData as CustomPartPanelData ?? new CustomPartPanelData();
|
|
|
- // please add init code here
|
|
|
-
|
|
|
- //数据初始化
|
|
|
- PartName.text = DeviceController.instance.DeviceName;
|
|
|
- SaveEditBtn.gameObject.SetActive(false);
|
|
|
- ExitEditBtn.gameObject.SetActive(false);
|
|
|
-
|
|
|
- AudioSearchPath = $"{Application.streamingAssetsPath}/Config/Audios/内部结构/{DeviceController.instance.DeviceName}";
|
|
|
- SubtitleSearchPath = $"{Application.streamingAssetsPath}/SubTitles/内部结构/{DeviceController.instance.DeviceName}";
|
|
|
- ConfigSerachPath = $"{Application.streamingAssetsPath}/Config/内部结构设备自定义配置/{DeviceController.instance.DeviceName}.xlsx";
|
|
|
-
|
|
|
- CustomAllData = new List<CustomItem>();
|
|
|
- editObjs = new List<CustomItem>();
|
|
|
-
|
|
|
- //如果修改表格不存在就创建表格
|
|
|
- FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
- if (!tmpFileInfo.Exists)
|
|
|
- {
|
|
|
- tmpFileInfo.Create().Dispose();
|
|
|
- ExcelHelper.WriteInfoToExcel(ConfigSerachPath, new CustomPartData());
|
|
|
- }
|
|
|
+ public class CustomPartPanelData : UIPanelData
|
|
|
+ {
|
|
|
+ }
|
|
|
+ public partial class CustomPartPanel : UIPanel
|
|
|
+ {
|
|
|
+ /// <summary> 选中的Item </summary>
|
|
|
+ CustomItem SelectItem;
|
|
|
+ /// <summary> 选中的新父级Item </summary>
|
|
|
+ CustomItem SelectNewParent;
|
|
|
+
|
|
|
+ /// <summary> 音频路径 </summary>
|
|
|
+ private string AudioSearchPath;
|
|
|
+ /// <summary> </summary>
|
|
|
+ private string SubtitleSearchPath;
|
|
|
+ /// <summary> </summary>
|
|
|
+ private string ConfigSerachPath;
|
|
|
+ private string AbsolutePath;
|
|
|
+
|
|
|
+ public List<CustomItem> CustomAllData;
|
|
|
+
|
|
|
+ private int ExcelIndex;
|
|
|
+
|
|
|
+ /// <summary> 是否修改层级结构 </summary>
|
|
|
+ public bool IFChangeLayer = false;
|
|
|
+ /// <summary> 是否修改存储文件修改 </summary>
|
|
|
+ private bool ifSaveFileChange = false;
|
|
|
+
|
|
|
+ public List<CustomItem> editObjs;
|
|
|
+
|
|
|
+ private StringBuilder selectSrt=new StringBuilder();
|
|
|
+
|
|
|
+ public enum CustomPanelBtnkState
|
|
|
+ {
|
|
|
+ NoOnclick,
|
|
|
+ ResourceEdit,
|
|
|
+ LayerEdit,
|
|
|
+ NameEdit
|
|
|
+ }
|
|
|
+
|
|
|
+ public CustomPanelBtnkState CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
+
|
|
|
+ protected override void ProcessMsg(int eventId, QMsg msg)
|
|
|
+ {
|
|
|
+ throw new System.NotImplementedException();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnInit(IUIData uiData = null)
|
|
|
+ {
|
|
|
+ mData = uiData as CustomPartPanelData ?? new CustomPartPanelData();
|
|
|
+ // please add init code here
|
|
|
+
|
|
|
+ //数据初始化
|
|
|
+ PartName.text = DeviceController.instance.DeviceName;
|
|
|
+ SaveEditBtn.gameObject.SetActive(false);
|
|
|
+ ExitEditBtn.gameObject.SetActive(false);
|
|
|
+
|
|
|
+ AudioSearchPath = $"{Application.streamingAssetsPath}/Config/Audios/内部结构/{DeviceController.instance.DeviceName}";
|
|
|
+ SubtitleSearchPath = $"{Application.streamingAssetsPath}/SubTitles/内部结构/{DeviceController.instance.DeviceName}";
|
|
|
+ ConfigSerachPath = $"{Application.streamingAssetsPath}/Config/内部结构设备自定义配置/{DeviceController.instance.DeviceName}.xlsx";
|
|
|
+
|
|
|
+ CustomAllData = new List<CustomItem>();
|
|
|
+ editObjs = new List<CustomItem>();
|
|
|
+
|
|
|
+ //如果修改表格不存在就创建表格
|
|
|
+ FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
+ if (!tmpFileInfo.Exists)
|
|
|
+ {
|
|
|
+ tmpFileInfo.Create().Dispose();
|
|
|
+ ExcelHelper.WriteInfoToExcel(ConfigSerachPath, new CustomPartData());
|
|
|
+ }
|
|
|
#if UNITY_EDITOR
|
|
|
- UnityEditor.AssetDatabase.Refresh();
|
|
|
+ UnityEditor.AssetDatabase.Refresh();
|
|
|
#endif
|
|
|
|
|
|
- //创建Item
|
|
|
- CustomItem customExample = Instantiate(CustomItem.gameObject,Content).GetComponent<CustomItem>();
|
|
|
- customExample.InitData(DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>()),ref CustomAllData);
|
|
|
- customExample.UnExpandChildPartItem();
|
|
|
- customExample.ExpandChildPartItem();
|
|
|
+ //创建Item
|
|
|
+ CustomItem customExample = Instantiate(CustomItem.gameObject, Content).GetComponent<CustomItem>();
|
|
|
+ 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();
|
|
|
- }
|
|
|
+ editObjs.Add(CustomAllData.Find(t => t.partInfo.partName == DAL.Instance.Get<DeviceOfPartDataProxy>().m_CustomInfos[i].partName));
|
|
|
+ }
|
|
|
|
|
|
- private void addBtnOnclick()
|
|
|
+ addBtnOnclick();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addBtnOnclick()
|
|
|
{
|
|
|
- //修改名称按钮
|
|
|
- PartNameBtn.onClick.AddListener(() =>
|
|
|
- {
|
|
|
- if (SelectItem == null)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- initCustomTable();
|
|
|
- SetBtnInteractable(false);
|
|
|
- CustomState = CustomPanelBtnkState.NameEdit;
|
|
|
-
|
|
|
- SaveEditBtn.gameObject.SetActive(true);
|
|
|
- ExitEditBtn.gameObject.SetActive(true);
|
|
|
- PartName.gameObject.SetActive(false);
|
|
|
- PartNameEditInput.gameObject.SetActive(true);
|
|
|
-
|
|
|
- PromptMessage.text = "请点击部件名称进行输入";
|
|
|
-
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- SaveEditBtn.onClick.AddListener(() => SaveNameBtnOnClick());
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- //修改媒体资源按钮
|
|
|
- ResourcesBtn.onClick.AddListener(() =>
|
|
|
- {
|
|
|
- if(SelectItem == null)
|
|
|
+ //修改名称按钮
|
|
|
+ PartNameBtn.onClick.AddListener(() =>
|
|
|
+ {
|
|
|
+ if (SelectItem == null)
|
|
|
{
|
|
|
- return;
|
|
|
+ return;
|
|
|
}
|
|
|
- initCustomTable();
|
|
|
- SetBtnInteractable(false);
|
|
|
- CustomState = CustomPanelBtnkState.ResourceEdit;
|
|
|
+ initCustomTable();
|
|
|
+ SetBtnInteractable(false);
|
|
|
+ CustomState = CustomPanelBtnkState.NameEdit;
|
|
|
|
|
|
- SaveEditBtn.gameObject.SetActive(true);
|
|
|
- ExitEditBtn.gameObject.SetActive(true);
|
|
|
- AudioEditBtn.gameObject.SetActive(true);
|
|
|
- SubtitleEditBtn.gameObject.SetActive(true);
|
|
|
+ SaveEditBtn.gameObject.SetActive(true);
|
|
|
+ ExitEditBtn.gameObject.SetActive(true);
|
|
|
+ PartName.gameObject.SetActive(false);
|
|
|
+ PartNameEditInput.gameObject.SetActive(true);
|
|
|
|
|
|
- PromptMessage.text = "点击上方按钮修改音频及字幕文件。\n请保持音频及字幕文件名称相同。";
|
|
|
+ PromptMessage.text = "请点击部件名称进行输入";
|
|
|
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- SaveEditBtn.onClick.AddListener(() => SaveResourceBtnOnClick());
|
|
|
- });
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ SaveEditBtn.onClick.AddListener(() => SaveNameBtnOnClick());
|
|
|
|
|
|
- HierarchyBtn.onClick.AddListener(() =>
|
|
|
- {
|
|
|
- if (SelectItem == null)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- initCustomTable();
|
|
|
- IFChangeLayer = true;
|
|
|
- SetBtnInteractable(false);
|
|
|
- CustomState = CustomPanelBtnkState.LayerEdit;
|
|
|
+ });
|
|
|
|
|
|
- SaveEditBtn.gameObject.SetActive(true);
|
|
|
- ExitEditBtn.gameObject.SetActive(true);
|
|
|
+ //修改媒体资源按钮
|
|
|
+ ResourcesBtn.onClick.AddListener(() =>
|
|
|
+ {
|
|
|
+ if (SelectItem == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ initCustomTable();
|
|
|
+ SetBtnInteractable(false);
|
|
|
+ CustomState = CustomPanelBtnkState.ResourceEdit;
|
|
|
+
|
|
|
+ SaveEditBtn.gameObject.SetActive(true);
|
|
|
+ ExitEditBtn.gameObject.SetActive(true);
|
|
|
+ AudioEditBtn.gameObject.SetActive(true);
|
|
|
+ SubtitleEditBtn.gameObject.SetActive(true);
|
|
|
+
|
|
|
+ PromptMessage.text = "点击上方按钮修改音频及字幕文件。\n请保持音频及字幕文件名称相同。";
|
|
|
+
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ SaveEditBtn.onClick.AddListener(() => SaveResourceBtnOnClick());
|
|
|
+ });
|
|
|
+
|
|
|
+ HierarchyBtn.onClick.AddListener(() =>
|
|
|
+ {
|
|
|
+ if (SelectItem == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ initCustomTable();
|
|
|
+ IFChangeLayer = true;
|
|
|
+ SetBtnInteractable(false);
|
|
|
+ CustomState = CustomPanelBtnkState.LayerEdit;
|
|
|
|
|
|
- PromptMessage.text = $"当前所选物体: {SelectItem.partInfo.partName} \n当前所选物体原父级: {SelectItem.parentItem.partInfo.partName} \n请选择该部件新的父层级";
|
|
|
+ SaveEditBtn.gameObject.SetActive(true);
|
|
|
+ ExitEditBtn.gameObject.SetActive(true);
|
|
|
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- SaveEditBtn.onClick.AddListener(() => SaveLayerBtnOnClick());
|
|
|
+ PromptMessage.text = $"当前所选物体: {SelectItem.partInfo.partName} \n当前所选物体原父级: {SelectItem.parentItem.partInfo.partName} \n请选择该部件新的父层级";
|
|
|
|
|
|
- });
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ SaveEditBtn.onClick.AddListener(() => SaveLayerBtnOnClick());
|
|
|
|
|
|
- PanelExitBtn.onClick.AddListener(() =>
|
|
|
- {
|
|
|
- UIKit.HidePanel<CustomPartPanel>();
|
|
|
-
|
|
|
- DeviceController.instance.ShowCustomPanel = !DeviceController.instance.ShowCustomPanel;
|
|
|
- });
|
|
|
+ });
|
|
|
|
|
|
- ExitEditBtn.onClick.AddListener(() => ExitBtnOnclick());
|
|
|
+ PanelExitBtn.onClick.AddListener(() =>
|
|
|
+ {
|
|
|
+ UIKit.HidePanel<CustomPartPanel>();
|
|
|
|
|
|
- AudioEditBtn.onClick.AddListener(() => SelectResourceAndCopyFile("选择音频资源", System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\Desktop", "音频文件\0*.MP3\0All Files\0*.*\0\0", AudioSearchPath));
|
|
|
- SubtitleEditBtn.onClick.AddListener(() => SelectResourceAndCopyFile("选择字幕资源", System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\Desktop", "字幕文件\0*.SRT\0All Files\0*.*\0\0", SubtitleSearchPath));
|
|
|
+ DeviceController.instance.ShowCustomPanel = !DeviceController.instance.ShowCustomPanel;
|
|
|
+ });
|
|
|
|
|
|
- DeleteCustomTbaleBtn.onClick.AddListener(() =>
|
|
|
- {
|
|
|
- if (File.Exists(ConfigSerachPath))
|
|
|
+ ExitEditBtn.onClick.AddListener(() => ExitBtnOnclick());
|
|
|
+
|
|
|
+ AudioEditBtn.onClick.AddListener(() => SelectResourceAndCopyFile("选择音频资源", System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\Desktop", "音频文件\0*.MP3\0All Files\0*.*\0\0", AudioSearchPath));
|
|
|
+ SubtitleEditBtn.onClick.AddListener(() => SelectResourceAndCopyFile("选择字幕资源", System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\Desktop", "字幕文件\0*.SRT\0All Files\0*.*\0\0", SubtitleSearchPath));
|
|
|
+
|
|
|
+ DeleteCustomTbaleBtn.onClick.AddListener(() =>
|
|
|
+ {
|
|
|
+ if (File.Exists(ConfigSerachPath))
|
|
|
{
|
|
|
- File.Delete(ConfigSerachPath);
|
|
|
+ File.Delete(ConfigSerachPath);
|
|
|
#if UNITY_EDITOR
|
|
|
- UnityEditor.AssetDatabase.Refresh();
|
|
|
+ UnityEditor.AssetDatabase.Refresh();
|
|
|
#endif
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().returnBackTable();
|
|
|
-
|
|
|
- RefreshPartItemList();
|
|
|
- RefreshCustomItemList();
|
|
|
- DeleteTableBtnText.text = "配置表已删除";
|
|
|
- PromptMessage.text = "重新启动以恢复配置修改。\n配置表将在下次打开编辑页面时自动生成。";
|
|
|
- DeleteCustomTbaleBtn.interactable = false;
|
|
|
- SelectItem = null;
|
|
|
- DeviceController.instance.isDelectCustomTable = true;
|
|
|
- isDelectTable = true;
|
|
|
- }
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().returnBackTable();
|
|
|
+
|
|
|
+ RefreshPartItemList();
|
|
|
+ RefreshCustomItemList();
|
|
|
+ DeleteTableBtnText.text = "配置表已删除";
|
|
|
+ PromptMessage.text = "重新启动以恢复配置修改。\n配置表将在下次打开编辑页面时自动生成。";
|
|
|
+ DeleteCustomTbaleBtn.interactable = false;
|
|
|
+ SelectItem = null;
|
|
|
+ DeviceController.instance.isDelectCustomTable = true;
|
|
|
+ isDelectTable = true;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
- FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
- if (!tmpFileInfo.Exists)
|
|
|
- {
|
|
|
- tmpFileInfo.Create().Dispose();
|
|
|
- ExcelHelper.WriteInfoToExcel(ConfigSerachPath, new CustomPartData());
|
|
|
- }
|
|
|
- DeleteTableBtnText.text = "点击删除修改配置表";
|
|
|
- }
|
|
|
+ FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
+ if (!tmpFileInfo.Exists)
|
|
|
+ {
|
|
|
+ tmpFileInfo.Create().Dispose();
|
|
|
+ ExcelHelper.WriteInfoToExcel(ConfigSerachPath, new CustomPartData());
|
|
|
+ }
|
|
|
+ DeleteTableBtnText.text = "点击删除修改配置表";
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
- private void initCustomTable()
|
|
|
+ private void initCustomTable()
|
|
|
{
|
|
|
- if (SelectItem == null)
|
|
|
- return;
|
|
|
-
|
|
|
- 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);
|
|
|
-
|
|
|
- }
|
|
|
- public string GetAbsolutePath(CustomItem tmpItem)
|
|
|
- {
|
|
|
- string path = tmpItem.partInfo.partMark.PartName;
|
|
|
- CustomItem tmpParent = tmpItem.parentItem;
|
|
|
- while (tmpParent != null)
|
|
|
- {
|
|
|
- path = tmpParent.partInfo.partMark.PartName + "/" + path;
|
|
|
- tmpParent = tmpParent.parentItem;
|
|
|
- }
|
|
|
- return "/" + path;
|
|
|
- }
|
|
|
-
|
|
|
- public void SetBtnInteractable(bool ifOpen)
|
|
|
+ if (SelectItem == null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ }
|
|
|
+ public string GetAbsolutePath(CustomItem tmpItem)
|
|
|
{
|
|
|
- HierarchyBtn.interactable = ifOpen;
|
|
|
- ResourcesBtn.interactable = ifOpen;
|
|
|
- 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)
|
|
|
- return;
|
|
|
-
|
|
|
- if (SelectNewParent != null)
|
|
|
- SelectNewParent.TitleText.color = Color.white;
|
|
|
-
|
|
|
- SelectNewParent = customItem;
|
|
|
- SelectNewParent.TitleText.color = Color.red;
|
|
|
- PromptMessage.text = $"当前所选物体: {PartName.text}\n 当前父层级: {SelectItem.parentItem.partInfo.partName} \n 选中的新父层级 :{SelectNewParent.partInfo.partName}";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (SelectItem != null)
|
|
|
- SelectItem.TitleText.color = Color.white;
|
|
|
- SelectItem = customItem;
|
|
|
- PartName.text = SelectItem.partInfo.partName;
|
|
|
- SelectItem.TitleText.color = Color.grey;
|
|
|
- PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
- AbsolutePath = GetAbsolutePath(SelectItem);
|
|
|
- getSourcePath(SelectItem.TitleText.text);
|
|
|
-
|
|
|
- if (PartNameBtn.gameObject.activeSelf == false)
|
|
|
+ string path = tmpItem.partInfo.partMark.PartName;
|
|
|
+ CustomItem tmpParent = tmpItem.parentItem;
|
|
|
+ while (tmpParent != null)
|
|
|
+ {
|
|
|
+ path = tmpParent.partInfo.partMark.PartName + "/" + path;
|
|
|
+ tmpParent = tmpParent.parentItem;
|
|
|
+ }
|
|
|
+ return "/" + path;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetBtnInteractable(bool ifOpen)
|
|
|
+ {
|
|
|
+ HierarchyBtn.interactable = ifOpen;
|
|
|
+ ResourcesBtn.interactable = ifOpen;
|
|
|
+ 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)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (SelectNewParent != null)
|
|
|
+ SelectNewParent.TitleText.color = Color.white;
|
|
|
+
|
|
|
+ SelectNewParent = customItem;
|
|
|
+ SelectNewParent.TitleText.color = Color.red;
|
|
|
+ PromptMessage.text = $"当前所选物体: {PartName.text}\n 当前父层级: {SelectItem.parentItem.partInfo.partName} \n 选中的新父层级 :{SelectNewParent.partInfo.partName}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (SelectItem != null)
|
|
|
+ SelectItem.TitleText.color = Color.white;
|
|
|
+ SelectItem = customItem;
|
|
|
+ PartName.text = SelectItem.partInfo.partName;
|
|
|
+ SelectItem.TitleText.color = Color.grey;
|
|
|
+ PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
+ AbsolutePath = GetAbsolutePath(SelectItem);
|
|
|
+ getSourcePath(SelectItem.TitleText.text);
|
|
|
+
|
|
|
+ if (PartNameBtn.gameObject.activeSelf == false)
|
|
|
{
|
|
|
- PartNameBtn.gameObject.SetActive(true);
|
|
|
- ResourcesBtn.gameObject.SetActive(true);
|
|
|
- //HierarchyBtn.gameObject.SetActive(true);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ PartNameBtn.gameObject.SetActive(true);
|
|
|
+ ResourcesBtn.gameObject.SetActive(true);
|
|
|
+ //HierarchyBtn.gameObject.SetActive(true);
|
|
|
+ }
|
|
|
|
|
|
- /// <summary> 获取选中部件的音频及字幕路径 </summary>
|
|
|
- /// <param name="partName"></param>
|
|
|
- public void getSourcePath(string partName)
|
|
|
- {
|
|
|
- PartDataInfo partDataInfo;
|
|
|
+ PosName.text = SelectItem.partInfo.partMark.transform.position.ToString("F2");
|
|
|
+ ColiiderName.text = "已开启碰撞检测";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary> 获取选中部件的音频及字幕路径 </summary>
|
|
|
+ /// <param name="partName"></param>
|
|
|
+ public void getSourcePath(string partName)
|
|
|
+ {
|
|
|
+ PartDataInfo partDataInfo;
|
|
|
|
|
|
- CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(partName);
|
|
|
+ CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(partName);
|
|
|
|
|
|
- IEnumerable<string> audioFiles;
|
|
|
- IEnumerable<string> SubtitleFiles;
|
|
|
+ IEnumerable<string> audioFiles;
|
|
|
+ IEnumerable<string> SubtitleFiles;
|
|
|
|
|
|
- if (customPartData == null)
|
|
|
+ if (customPartData == null)
|
|
|
{
|
|
|
- customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByPartName(partName);
|
|
|
+ customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByPartName(partName);
|
|
|
|
|
|
- if (customPartData == null)
|
|
|
+ if (customPartData == null)
|
|
|
{
|
|
|
- partDataInfo = DAL.Instance.Get<DeviceOfPartDataProxy>().GetPartInfoByPartName(partName);
|
|
|
- ExcelIndex = partDataInfo.id.ToInt() + 1;
|
|
|
- audioFiles = Directory.EnumerateFiles(AudioSearchPath, partDataInfo.audioClipName + ".mp3");
|
|
|
- SubtitleFiles = Directory.EnumerateFiles(SubtitleSearchPath, partDataInfo.audioClipName + ".srt");
|
|
|
+ partDataInfo = DAL.Instance.Get<DeviceOfPartDataProxy>().GetPartInfoByPartName(partName);
|
|
|
+ ExcelIndex = partDataInfo.id.ToInt() + 1;
|
|
|
+ audioFiles = Directory.EnumerateFiles(AudioSearchPath, partDataInfo.audioClipName + ".mp3");
|
|
|
+ SubtitleFiles = Directory.EnumerateFiles(SubtitleSearchPath, partDataInfo.audioClipName + ".srt");
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
- ExcelIndex = customPartData.id.ToInt() + 1;
|
|
|
- audioFiles = Directory.EnumerateFiles(AudioSearchPath, customPartData.audioClipName + ".mp3");
|
|
|
- SubtitleFiles = Directory.EnumerateFiles(SubtitleSearchPath, customPartData.audioClipName + ".srt");
|
|
|
+ ExcelIndex = customPartData.id.ToInt() + 1;
|
|
|
+ audioFiles = Directory.EnumerateFiles(AudioSearchPath, customPartData.audioClipName + ".mp3");
|
|
|
+ SubtitleFiles = Directory.EnumerateFiles(SubtitleSearchPath, customPartData.audioClipName + ".srt");
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ExcelIndex = customPartData.id.ToInt() + 1;
|
|
|
- audioFiles = Directory.EnumerateFiles(AudioSearchPath, customPartData.audioClipName + ".mp3");
|
|
|
- SubtitleFiles = Directory.EnumerateFiles(SubtitleSearchPath, customPartData.audioClipName + ".srt");
|
|
|
- }
|
|
|
+ ExcelIndex = customPartData.id.ToInt() + 1;
|
|
|
+ audioFiles = Directory.EnumerateFiles(AudioSearchPath, customPartData.audioClipName + ".mp3");
|
|
|
+ SubtitleFiles = Directory.EnumerateFiles(SubtitleSearchPath, customPartData.audioClipName + ".srt");
|
|
|
+ }
|
|
|
|
|
|
+ string[] textTxt = File.ReadAllLines(SubtitleFiles.First());
|
|
|
+ selectSrt.Clear();
|
|
|
+ foreach (string line in textTxt)
|
|
|
+ {
|
|
|
+ // 跳过序号行(纯数字)
|
|
|
+ if (int.TryParse(line.Trim(), out _))
|
|
|
+ continue;
|
|
|
|
|
|
+ // 跳过时间轴行(包含 -->)
|
|
|
+ if (line.Contains("-->"))
|
|
|
+ continue;
|
|
|
|
|
|
- SubtitleName.text = Path.GetFileName(SubtitleFiles.First());
|
|
|
- AudioName.text = Path.GetFileName(audioFiles.First());
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ // 跳过空行
|
|
|
+ if (string.IsNullOrWhiteSpace(line))
|
|
|
+ continue;
|
|
|
|
|
|
- #region 名称修改
|
|
|
+ // 添加文本行
|
|
|
+ selectSrt.AppendLine(line);
|
|
|
+ }
|
|
|
+ PromptMessage.text = selectSrt.ToString();
|
|
|
+
|
|
|
+ SubtitleName.text = Path.GetFileName(SubtitleFiles.First());
|
|
|
+ AudioName.text = Path.GetFileName(audioFiles.First());
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 名称修改
|
|
|
|
|
|
- public bool isRepetitionName(string tmpStr)
|
|
|
+ public bool isRepetitionName(string tmpStr)
|
|
|
{
|
|
|
- CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(tmpStr);
|
|
|
- if (customPartData != null)
|
|
|
- return true;
|
|
|
+ CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(tmpStr);
|
|
|
+ if (customPartData != null)
|
|
|
+ return true;
|
|
|
|
|
|
- customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByPartName(tmpStr);
|
|
|
- PartDataInfo partDataInfo = DAL.Instance.Get<DeviceOfPartDataProxy>().GetPartInfoByPartName(tmpStr);
|
|
|
+ customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByPartName(tmpStr);
|
|
|
+ PartDataInfo partDataInfo = DAL.Instance.Get<DeviceOfPartDataProxy>().GetPartInfoByPartName(tmpStr);
|
|
|
|
|
|
- if (customPartData != null || partDataInfo != null)
|
|
|
- return true;
|
|
|
+ if (customPartData != null || partDataInfo != null)
|
|
|
+ return true;
|
|
|
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
- private void SaveNameBtnOnClick()
|
|
|
- {
|
|
|
- string tmpStr = PartNameEditInput.textComponent.text;
|
|
|
+ private void SaveNameBtnOnClick()
|
|
|
+ {
|
|
|
+ string tmpStr = PartNameEditInput.textComponent.text;
|
|
|
|
|
|
- if (string.IsNullOrEmpty(tmpStr))
|
|
|
- {
|
|
|
- PromptMessage.text = "输入为空,请检查";
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (string.IsNullOrEmpty(tmpStr))
|
|
|
+ {
|
|
|
+ PromptMessage.text = "输入为空,请检查";
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (isRepetitionName(tmpStr))
|
|
|
{
|
|
|
- PromptMessage.text = "修改名称重复,请检查";
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(ConfigSerachPath)))
|
|
|
- {
|
|
|
- ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];
|
|
|
- worksheet.Cells[ExcelIndex, 4].Value = tmpStr;
|
|
|
- excelPackage.Save();
|
|
|
- }
|
|
|
-
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
-
|
|
|
- PromptMessage.text = "";
|
|
|
- PartNameEditInput.text = "";
|
|
|
- SelectItem.TitleText.text = tmpStr;
|
|
|
- SelectItem.partInfo.partName = tmpStr;
|
|
|
- SelectItem.partInfo.partMark.gameObject.name = tmpStr;
|
|
|
- PartName.text = tmpStr;
|
|
|
-
|
|
|
-
|
|
|
- PartName.gameObject.SetActive(true);
|
|
|
- PartNameEditInput.gameObject.SetActive(false);
|
|
|
- SaveEditBtn.gameObject.SetActive(false);
|
|
|
- ExitEditBtn.gameObject.SetActive(false);
|
|
|
-
|
|
|
- SetBtnInteractable(true);
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
- CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 音频修改
|
|
|
-
|
|
|
- private string audioPath = "", subtitlePath = "";
|
|
|
-
|
|
|
- IEnumerator DelayCoroutine(string tmpFilePath ,string title, string defaultPath, string extension, string targetPath)
|
|
|
- {
|
|
|
- yield return new WaitForSeconds(0.2f);
|
|
|
- string tmpFileName = Path.GetFileName(tmpFilePath);
|
|
|
- if (tmpFileName == null)
|
|
|
- {
|
|
|
- PromptMessage.text = "文件资源获取有误,请检查";
|
|
|
- yield return null;
|
|
|
- }
|
|
|
-
|
|
|
- if (targetPath.Equals(AudioSearchPath))
|
|
|
- {
|
|
|
- audioPath = tmpFilePath;
|
|
|
- AudioName.text = tmpFileName;
|
|
|
- }
|
|
|
-
|
|
|
- if (targetPath.Equals(SubtitleSearchPath))
|
|
|
- {
|
|
|
- subtitlePath = tmpFilePath;
|
|
|
- SubtitleName.text = tmpFileName;
|
|
|
- }
|
|
|
-
|
|
|
- if (AudioName.text.Substring(0, AudioName.text.LastIndexOf('.')).Equals(SubtitleName.text.Substring(0, SubtitleName.text.LastIndexOf('.'))))//如果改一个之后,名字相同
|
|
|
- {
|
|
|
- ifSaveFileChange = true;
|
|
|
- SaveEditBtn.interactable = true;
|
|
|
- PromptMessage.text = "请保持音频及字幕文件名称相同。\n 当前可以保存修改内容";
|
|
|
+ PromptMessage.text = "修改名称重复,请检查";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(ConfigSerachPath)))
|
|
|
+ {
|
|
|
+ ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];
|
|
|
+ worksheet.Cells[ExcelIndex, 4].Value = tmpStr;
|
|
|
+ excelPackage.Save();
|
|
|
+ }
|
|
|
+
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
+
|
|
|
+ PromptMessage.text = "";
|
|
|
+ PartNameEditInput.text = "";
|
|
|
+ SelectItem.TitleText.text = tmpStr;
|
|
|
+ SelectItem.partInfo.partName = tmpStr;
|
|
|
+ SelectItem.partInfo.partMark.gameObject.name = tmpStr;
|
|
|
+ PartName.text = tmpStr;
|
|
|
+
|
|
|
+
|
|
|
+ PartName.gameObject.SetActive(true);
|
|
|
+ PartNameEditInput.gameObject.SetActive(false);
|
|
|
+ SaveEditBtn.gameObject.SetActive(false);
|
|
|
+ ExitEditBtn.gameObject.SetActive(false);
|
|
|
+
|
|
|
+ SetBtnInteractable(true);
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
+ CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 音频修改
|
|
|
+
|
|
|
+ private string audioPath = "", subtitlePath = "";
|
|
|
+
|
|
|
+ IEnumerator DelayCoroutine(string tmpFilePath, string title, string defaultPath, string extension, string targetPath)
|
|
|
+ {
|
|
|
+ yield return new WaitForSeconds(0.2f);
|
|
|
+ string tmpFileName = Path.GetFileName(tmpFilePath);
|
|
|
+ if (tmpFileName == null)
|
|
|
+ {
|
|
|
+ PromptMessage.text = "文件资源获取有误,请检查";
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (targetPath.Equals(AudioSearchPath))
|
|
|
+ {
|
|
|
+ audioPath = tmpFilePath;
|
|
|
+ AudioName.text = tmpFileName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (targetPath.Equals(SubtitleSearchPath))
|
|
|
+ {
|
|
|
+ subtitlePath = tmpFilePath;
|
|
|
+ SubtitleName.text = tmpFileName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (AudioName.text.Substring(0, AudioName.text.LastIndexOf('.')).Equals(SubtitleName.text.Substring(0, SubtitleName.text.LastIndexOf('.'))))//如果改一个之后,名字相同
|
|
|
+ {
|
|
|
+ ifSaveFileChange = true;
|
|
|
+ SaveEditBtn.interactable = true;
|
|
|
+ PromptMessage.text = "请保持音频及字幕文件名称相同。\n 当前可以保存修改内容";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SaveEditBtn.interactable = false;
|
|
|
+ ifSaveFileChange = false;
|
|
|
+ PromptMessage.text = "请保持音频及字幕文件名称相同。\n 请继续修改内容以保持媒体资源名称相同";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 选择外部资源文件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="title">文件对话框标题</param>
|
|
|
+ /// <param name="defaultPath">文件对话框默认路径</param>
|
|
|
+ /// <param name="extension">文件默认格式</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private void SelectResourceAndCopyFile(string title, string defaultPath, string extension, string targetPath)
|
|
|
+ {
|
|
|
+ FileDialogHelper helper = new FileDialogHelper();
|
|
|
+ Action<FileOpMsg> callBack = HandleFileSelection;
|
|
|
+ string tmpFilePath = helper.SelectFile(callBack, extension);
|
|
|
+ //string tmpFilePath = helper.OpenWindowsFileDialog(title, defaultPath, extension);
|
|
|
+ StartCoroutine(DelayCoroutine(tmpFilePath, title, defaultPath, extension, targetPath));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void HandleFileSelection(FileOpMsg result)
|
|
|
+ {
|
|
|
+ if (result.success)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(result.msg))
|
|
|
+ {
|
|
|
+ Debug.Log($"成功选择: {result.msg}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.Log("选择取消");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.LogError($"错误: {result.msg}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SaveResourceBtnOnClick()
|
|
|
+ {
|
|
|
+ if (!ifSaveFileChange)
|
|
|
+ return;
|
|
|
+
|
|
|
+ FileDialogHelper helper = new FileDialogHelper();
|
|
|
+ if (!string.IsNullOrEmpty(audioPath))
|
|
|
+ helper.CopySelectFile(audioPath, AudioSearchPath);
|
|
|
+ if (!string.IsNullOrEmpty(subtitlePath))
|
|
|
+ helper.CopySelectFile(subtitlePath, SubtitleSearchPath);
|
|
|
+
|
|
|
+ string tmpStr = AudioName.text;
|
|
|
+
|
|
|
+ using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(ConfigSerachPath)))
|
|
|
+ {
|
|
|
+ ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];
|
|
|
+ worksheet.Cells[ExcelIndex, 3].Value = tmpStr.Split('.')[0];
|
|
|
+ excelPackage.Save();
|
|
|
+ }
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
+
|
|
|
+ subtitlePath = audioPath = "";
|
|
|
+
|
|
|
+
|
|
|
+ AudioEditBtn.gameObject.SetActive(false);
|
|
|
+ SubtitleEditBtn.gameObject.SetActive(false);
|
|
|
+ SaveEditBtn.gameObject.SetActive(false);
|
|
|
+ ExitEditBtn.gameObject.SetActive(false);
|
|
|
+
|
|
|
+ SetBtnInteractable(true);
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
+ CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #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)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (!ifChangeInChild(SelectItem))
|
|
|
+ return;
|
|
|
+
|
|
|
+ ChangeLayer();
|
|
|
+ IFChangeLayer = false;
|
|
|
+ SelectNewParent.TitleText.color = Color.white;
|
|
|
+ SelectNewParent = null;
|
|
|
+
|
|
|
+ SaveEditBtn.gameObject.SetActive(false);
|
|
|
+ ExitEditBtn.gameObject.SetActive(false);
|
|
|
+
|
|
|
+ SetBtnInteractable(true);
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
+ CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ChangeLayer()
|
|
|
+ {
|
|
|
+
|
|
|
+ int TrIndex = SelectItem.transform.GetSiblingIndex();//获取在编辑器的同级索引
|
|
|
+ int TrParentIndex = SelectNewParent.transform.GetSiblingIndex();//获取新父级在编辑器的同级索引
|
|
|
+ if (TrParentIndex < TrIndex) TrParentIndex++;
|
|
|
+
|
|
|
+ SelectItem.level = SelectNewParent.level + 1;
|
|
|
+ SelectItem.transform.SetSiblingIndex(SelectItem.transform.GetSiblingIndex() + TrParentIndex - TrIndex);
|
|
|
+ SelectItem.Position.GetComponent<RectTransform>().anchoredPosition = new Vector3(10 * (SelectItem.level), 0, 0);
|
|
|
+ ChangeTranform(SelectItem, TrParentIndex - TrIndex);
|
|
|
+
|
|
|
+ int tmpIndex = SelectItem.parentItem.childCustomInfo.IndexOf(SelectItem);//获取在列表中的索引
|
|
|
+ SelectItem.parentItem.childCustomInfo.RemoveAt(tmpIndex);
|
|
|
+
|
|
|
+ tmpIndex = SelectItem.parentItem.partInfo.partMark.m_ChildPartMarks.IndexOf(SelectItem.partInfo.partMark);
|
|
|
+ SelectItem.parentItem.partInfo.partMark.m_ChildPartMarks.RemoveAt(tmpIndex);
|
|
|
+
|
|
|
+ SelectItem.partInfo.partMark.transform.SetParent(SelectNewParent.partInfo.partMark.transform);
|
|
|
+ SelectNewParent.partInfo.partMark.m_ChildPartMarks.Add(SelectItem.partInfo.partMark);
|
|
|
+
|
|
|
+ SelectNewParent.childCustomInfo.Add(SelectItem);
|
|
|
+ SelectItem.parentItem = SelectNewParent;
|
|
|
+
|
|
|
+
|
|
|
+ //判断原父级和现有父级是否显示图标
|
|
|
+ if (SelectNewParent.childCustomInfo.Count > 0)
|
|
|
+ {
|
|
|
+ SelectNewParent.UnExpandBtn.gameObject.SetActive(true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SaveEditBtn.interactable = false;
|
|
|
- ifSaveFileChange = false;
|
|
|
- PromptMessage.text = "请保持音频及字幕文件名称相同。\n 请继续修改内容以保持媒体资源名称相同";
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 选择外部资源文件
|
|
|
- /// </summary>
|
|
|
- /// <param name="title">文件对话框标题</param>
|
|
|
- /// <param name="defaultPath">文件对话框默认路径</param>
|
|
|
- /// <param name="extension">文件默认格式</param>
|
|
|
- /// <returns></returns>
|
|
|
- private void SelectResourceAndCopyFile(string title, string defaultPath, string extension, string targetPath)
|
|
|
- {
|
|
|
- FileDialogHelper helper = new FileDialogHelper();
|
|
|
- Action<FileOpMsg> callBack = HandleFileSelection;
|
|
|
- string tmpFilePath = helper.SelectFile(callBack, extension);
|
|
|
- //string tmpFilePath = helper.OpenWindowsFileDialog(title, defaultPath, extension);
|
|
|
- StartCoroutine(DelayCoroutine(tmpFilePath, title, defaultPath, extension, targetPath));
|
|
|
- }
|
|
|
-
|
|
|
- private void HandleFileSelection(FileOpMsg result)
|
|
|
- {
|
|
|
- if (result.success)
|
|
|
- {
|
|
|
- if (!string.IsNullOrEmpty(result.msg))
|
|
|
- {
|
|
|
- Debug.Log($"成功选择: {result.msg}");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Debug.Log("选择取消");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Debug.LogError($"错误: {result.msg}");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void SaveResourceBtnOnClick()
|
|
|
+ SelectNewParent.ExpandBtn.gameObject.SetActive(false);
|
|
|
+ SelectNewParent.UnExpandBtn.gameObject.SetActive(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ SelectNewParent.ExpandChildPartItem();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ChangeTranform(CustomItem tmpCustomItem, int ChuangNum)
|
|
|
{
|
|
|
- if (!ifSaveFileChange)
|
|
|
- return;
|
|
|
-
|
|
|
- FileDialogHelper helper = new FileDialogHelper();
|
|
|
- if (!string.IsNullOrEmpty(audioPath))
|
|
|
- helper.CopySelectFile(audioPath, AudioSearchPath);
|
|
|
- if (!string.IsNullOrEmpty(subtitlePath))
|
|
|
- helper.CopySelectFile(subtitlePath, SubtitleSearchPath);
|
|
|
-
|
|
|
- string tmpStr = AudioName.text;
|
|
|
-
|
|
|
- using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(ConfigSerachPath)))
|
|
|
- {
|
|
|
- ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];
|
|
|
- worksheet.Cells[ExcelIndex, 3].Value = tmpStr.Split('.')[0];
|
|
|
- excelPackage.Save();
|
|
|
- }
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
-
|
|
|
- subtitlePath = audioPath = "";
|
|
|
-
|
|
|
-
|
|
|
- AudioEditBtn.gameObject.SetActive(false);
|
|
|
- SubtitleEditBtn.gameObject.SetActive(false);
|
|
|
- SaveEditBtn.gameObject.SetActive(false);
|
|
|
- ExitEditBtn.gameObject.SetActive(false);
|
|
|
-
|
|
|
- SetBtnInteractable(true);
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
- CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
-
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #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()
|
|
|
+ for (int i = 0; i < tmpCustomItem.childCustomInfo.Count; i++)
|
|
|
+ {
|
|
|
+ Transform tmpTr = tmpCustomItem.childCustomInfo[i].transform;
|
|
|
+ tmpTr.SetSiblingIndex(tmpTr.GetSiblingIndex() + ChuangNum);
|
|
|
+ tmpCustomItem.childCustomInfo[i].level = tmpCustomItem.level + 1;
|
|
|
+ tmpCustomItem.childCustomInfo[i].Position.GetComponent<RectTransform>().anchoredPosition = new Vector3(10 * (tmpCustomItem.level + 1), 0, 0);
|
|
|
+ ChangeTranform(tmpCustomItem.childCustomInfo[i], ChuangNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 取消及保存编辑
|
|
|
+
|
|
|
+ /// <summary> 取消编辑按钮 </summary>
|
|
|
+ private void ExitBtnOnclick()
|
|
|
{
|
|
|
-
|
|
|
- if (SelectNewParent == null )
|
|
|
- return;
|
|
|
-
|
|
|
- if (! ifChangeInChild(SelectItem))
|
|
|
- return;
|
|
|
-
|
|
|
- ChangeLayer();
|
|
|
- IFChangeLayer = false;
|
|
|
- SelectNewParent.TitleText.color = Color.white;
|
|
|
- SelectNewParent = null;
|
|
|
-
|
|
|
- SaveEditBtn.gameObject.SetActive(false);
|
|
|
- ExitEditBtn.gameObject.SetActive(false);
|
|
|
-
|
|
|
- SetBtnInteractable(true);
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
- CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
- }
|
|
|
-
|
|
|
- public void ChangeLayer()
|
|
|
- {
|
|
|
-
|
|
|
- int TrIndex = SelectItem.transform.GetSiblingIndex();//获取在编辑器的同级索引
|
|
|
- int TrParentIndex = SelectNewParent.transform.GetSiblingIndex();//获取新父级在编辑器的同级索引
|
|
|
- if (TrParentIndex < TrIndex) TrParentIndex++;
|
|
|
-
|
|
|
- SelectItem.level = SelectNewParent.level + 1;
|
|
|
- SelectItem.transform.SetSiblingIndex(SelectItem.transform.GetSiblingIndex() + TrParentIndex - TrIndex);
|
|
|
- SelectItem.Position.GetComponent<RectTransform>().anchoredPosition = new Vector3(10 * (SelectItem.level), 0, 0);
|
|
|
- ChangeTranform(SelectItem, TrParentIndex - TrIndex);
|
|
|
-
|
|
|
- int tmpIndex = SelectItem.parentItem.childCustomInfo.IndexOf(SelectItem);//获取在列表中的索引
|
|
|
- SelectItem.parentItem.childCustomInfo.RemoveAt(tmpIndex);
|
|
|
-
|
|
|
- tmpIndex = SelectItem.parentItem.partInfo.partMark.m_ChildPartMarks.IndexOf(SelectItem.partInfo.partMark);
|
|
|
- SelectItem.parentItem.partInfo.partMark.m_ChildPartMarks.RemoveAt(tmpIndex);
|
|
|
-
|
|
|
- SelectItem.partInfo.partMark.transform.SetParent(SelectNewParent.partInfo.partMark.transform);
|
|
|
- SelectNewParent.partInfo.partMark.m_ChildPartMarks.Add(SelectItem.partInfo.partMark);
|
|
|
-
|
|
|
- SelectNewParent.childCustomInfo.Add(SelectItem);
|
|
|
- SelectItem.parentItem = SelectNewParent;
|
|
|
-
|
|
|
-
|
|
|
- //判断原父级和现有父级是否显示图标
|
|
|
- if (SelectNewParent.childCustomInfo.Count > 0)
|
|
|
- {
|
|
|
- SelectNewParent.UnExpandBtn.gameObject.SetActive(true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SelectNewParent.ExpandBtn.gameObject.SetActive(false);
|
|
|
- SelectNewParent.UnExpandBtn.gameObject.SetActive(false);
|
|
|
- }
|
|
|
-
|
|
|
- SelectNewParent.ExpandChildPartItem();
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void ChangeTranform(CustomItem tmpCustomItem, int ChuangNum)
|
|
|
- {
|
|
|
- for (int i = 0; i < tmpCustomItem.childCustomInfo.Count; i++)
|
|
|
- {
|
|
|
- Transform tmpTr = tmpCustomItem.childCustomInfo[i].transform;
|
|
|
- tmpTr.SetSiblingIndex(tmpTr.GetSiblingIndex() + ChuangNum);
|
|
|
- tmpCustomItem.childCustomInfo[i].level = tmpCustomItem.level + 1;
|
|
|
- tmpCustomItem.childCustomInfo[i].Position.GetComponent<RectTransform>().anchoredPosition = new Vector3(10 * (tmpCustomItem.level + 1), 0, 0);
|
|
|
- ChangeTranform(tmpCustomItem.childCustomInfo[i], ChuangNum);
|
|
|
- }
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 取消及保存编辑
|
|
|
-
|
|
|
- /// <summary> 取消编辑按钮 </summary>
|
|
|
- private void ExitBtnOnclick()
|
|
|
- {
|
|
|
- switch (CustomState)
|
|
|
- {
|
|
|
- case CustomPanelBtnkState.NameEdit:
|
|
|
- PartNameEditInput.text = "";
|
|
|
-
|
|
|
- PartNameBtn.interactable = true;
|
|
|
- PartName.gameObject.SetActive(true);
|
|
|
- PartNameEditInput.gameObject.SetActive(false);
|
|
|
- break;
|
|
|
- case CustomPanelBtnkState.ResourceEdit:
|
|
|
- subtitlePath = audioPath = "";
|
|
|
- ResourcesBtn.interactable = true;
|
|
|
- getSourcePath(SelectItem.TitleText.text);
|
|
|
- AudioEditBtn.gameObject.SetActive(false);
|
|
|
- SubtitleEditBtn.gameObject.SetActive(false);
|
|
|
- break;
|
|
|
- case CustomPanelBtnkState.LayerEdit:
|
|
|
-
|
|
|
- IFChangeLayer = false;
|
|
|
+ switch (CustomState)
|
|
|
+ {
|
|
|
+ case CustomPanelBtnkState.NameEdit:
|
|
|
+ PartNameEditInput.text = "";
|
|
|
+
|
|
|
+ PartNameBtn.interactable = true;
|
|
|
+ PartName.gameObject.SetActive(true);
|
|
|
+ PartNameEditInput.gameObject.SetActive(false);
|
|
|
+ break;
|
|
|
+ case CustomPanelBtnkState.ResourceEdit:
|
|
|
+ subtitlePath = audioPath = "";
|
|
|
+ ResourcesBtn.interactable = true;
|
|
|
+ getSourcePath(SelectItem.TitleText.text);
|
|
|
+ AudioEditBtn.gameObject.SetActive(false);
|
|
|
+ SubtitleEditBtn.gameObject.SetActive(false);
|
|
|
+ break;
|
|
|
+ case CustomPanelBtnkState.LayerEdit:
|
|
|
+
|
|
|
+ IFChangeLayer = false;
|
|
|
|
|
|
if (SelectNewParent != null)
|
|
|
{
|
|
|
- SelectNewParent.TitleText.color = Color.white;
|
|
|
- SelectNewParent = null;
|
|
|
- }
|
|
|
+ SelectNewParent.TitleText.color = Color.white;
|
|
|
+ SelectNewParent = null;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
- break;
|
|
|
- }
|
|
|
+ SaveEditBtn.onClick.RemoveAllListeners();
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- SetBtnInteractable(true);
|
|
|
+ SetBtnInteractable(true);
|
|
|
|
|
|
- PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
-
|
|
|
- CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
- SaveEditBtn.gameObject.SetActive(false);
|
|
|
- ExitEditBtn.gameObject.SetActive(false);
|
|
|
- }
|
|
|
+ PromptMessage.text = $"当前选择物体为 {SelectItem.TitleText.text}";
|
|
|
+
|
|
|
+ CustomState = CustomPanelBtnkState.NoOnclick;
|
|
|
+ SaveEditBtn.gameObject.SetActive(false);
|
|
|
+ ExitEditBtn.gameObject.SetActive(false);
|
|
|
+ }
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 更新列表
|
|
|
|
|
|
- public void RefreshPartItemList()
|
|
|
+ public void RefreshPartItemList()
|
|
|
{
|
|
|
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- UIKit.GetPanel<PartListPanel>().Data.m_PartInfo = DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>());
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ UIKit.GetPanel<PartListPanel>().Data.m_PartInfo = DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>());
|
|
|
|
|
|
- PartItem firstItem = UIKit.GetPanel<PartListPanel>().Content.GetComponentsInChildren<PartItem>(true)[0];
|
|
|
- firstItem.gameObject.SetActive(true);
|
|
|
- int index = 0;
|
|
|
- firstItem.refreshData(UIKit.GetPanel<PartListPanel>().Data.m_PartInfo,ref index);
|
|
|
- firstItem.OnSelectToggleChange(true, true);
|
|
|
- firstItem.UnExpandChildPartItem(firstItem);
|
|
|
- firstItem.ExpandChildPartItem();
|
|
|
+ PartItem firstItem = UIKit.GetPanel<PartListPanel>().Content.GetComponentsInChildren<PartItem>(true)[0];
|
|
|
+ firstItem.gameObject.SetActive(true);
|
|
|
+ int index = 0;
|
|
|
+ firstItem.refreshData(UIKit.GetPanel<PartListPanel>().Data.m_PartInfo, ref index);
|
|
|
+ firstItem.OnSelectToggleChange(true, true);
|
|
|
+ firstItem.UnExpandChildPartItem(firstItem);
|
|
|
+ firstItem.ExpandChildPartItem();
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- public void RefreshCustomItemList()
|
|
|
+ public void RefreshCustomItemList()
|
|
|
{
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
-
|
|
|
- CustomItem customExample = UIKit.GetPanel<CustomPartPanel>().Content.GetComponentsInChildren<CustomItem>(true)[0];
|
|
|
- customExample.gameObject.SetActive(true);
|
|
|
- int index = 0;
|
|
|
- customExample.refreshData(DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>()), ref index);
|
|
|
- customExample.ExpandChildPartItem();
|
|
|
-
|
|
|
- if (SelectItem != null)
|
|
|
- SelectItem.TitleText.color = Color.white;
|
|
|
- PartName.text = DeviceController.instance.DeviceName;
|
|
|
- AudioName.text = "";
|
|
|
- SubtitleName.text = "";
|
|
|
- }
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadStepMsgInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+
|
|
|
+ CustomItem customExample = UIKit.GetPanel<CustomPartPanel>().Content.GetComponentsInChildren<CustomItem>(true)[0];
|
|
|
+ customExample.gameObject.SetActive(true);
|
|
|
+ int index = 0;
|
|
|
+ customExample.refreshData(DeviceController.instance.GetDevicePartInfos(DeviceController.instance.transform.GetComponent<PartMark>()), ref index);
|
|
|
+ customExample.ExpandChildPartItem();
|
|
|
+
|
|
|
+ if (SelectItem != null)
|
|
|
+ SelectItem.TitleText.color = Color.white;
|
|
|
+ PartName.text = DeviceController.instance.DeviceName;
|
|
|
+ AudioName.text = "";
|
|
|
+ SubtitleName.text = "";
|
|
|
+ }
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
|
|
|
- public void InputFieldSelect()
|
|
|
+ public void InputFieldSelect()
|
|
|
{
|
|
|
- PartNameBtn.gameObject.SetActive(true);
|
|
|
+ PartNameBtn.gameObject.SetActive(true);
|
|
|
}
|
|
|
|
|
|
- protected override void OnOpen(IUIData uiData = null)
|
|
|
- {
|
|
|
- DeviceController.instance.ifShowCoustom = false;
|
|
|
+ protected override void OnOpen(IUIData uiData = null)
|
|
|
+ {
|
|
|
+ DeviceController.instance.ifShowCoustom = false;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
- FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
- if (!tmpFileInfo.Exists)
|
|
|
- return;
|
|
|
+ FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
+ if (!tmpFileInfo.Exists)
|
|
|
+ return;
|
|
|
|
|
|
- DeviceController.instance.ifShowCoustom = true;
|
|
|
+ DeviceController.instance.ifShowCoustom = true;
|
|
|
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
- RefreshPartItemList();
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
+ RefreshPartItemList();
|
|
|
|
|
|
- foreach (CustomItem item in editObjs)
|
|
|
- {
|
|
|
+ foreach (CustomItem item in editObjs)
|
|
|
+ {
|
|
|
|
|
|
- CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(item.TitleText.text);
|
|
|
- ExcelIndex = customPartData.id.ToInt() + 1;
|
|
|
+ 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();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ 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;
|
|
|
+ {
|
|
|
+ FileInfo tmpFileInfo = new FileInfo(ConfigSerachPath);
|
|
|
+ if (!tmpFileInfo.Exists)
|
|
|
+ return;
|
|
|
|
|
|
- DeviceController.instance.ifShowCoustom = true;
|
|
|
+ DeviceController.instance.ifShowCoustom = true;
|
|
|
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
- DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
- RefreshPartItemList();
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().ReadCustomInfoFromTable(DeviceController.instance.DeviceName);
|
|
|
+ DAL.Instance.Get<DeviceOfPartDataProxy>().CoverTableInfos();
|
|
|
+ RefreshPartItemList();
|
|
|
|
|
|
- foreach (CustomItem item in editObjs)
|
|
|
+ foreach (CustomItem item in editObjs)
|
|
|
{
|
|
|
|
|
|
- CustomPartData customPartData = DAL.Instance.Get<DeviceOfPartDataProxy>().GetCustomByEditPartName(item.TitleText.text);
|
|
|
- ExcelIndex = customPartData.id.ToInt() + 1;
|
|
|
+ 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();
|
|
|
- }
|
|
|
- }
|
|
|
+ using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(ConfigSerachPath)))
|
|
|
+ {
|
|
|
+ ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];
|
|
|
+ worksheet.Cells[ExcelIndex, 6].Value = GetAbsolutePath(item);
|
|
|
+ excelPackage.Save();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- public class CustomPartData
|
|
|
+ public class CustomPartData
|
|
|
{
|
|
|
- public string id;
|
|
|
- public string partName;
|
|
|
- public string audioClipName;
|
|
|
- public string editName;
|
|
|
- public string AbsolutePath;
|
|
|
- public string EditPath;
|
|
|
-
|
|
|
- public CustomPartData( string partName,string audioClipName,string editName,string AbsolutePath,string EditPath = "")
|
|
|
+ public string id;
|
|
|
+ public string partName;
|
|
|
+ public string audioClipName;
|
|
|
+ public string editName;
|
|
|
+ public string AbsolutePath;
|
|
|
+ public 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;
|
|
|
- this.audioClipName = audioClipName;
|
|
|
- if (string.IsNullOrEmpty(editName))
|
|
|
- this.editName = editName;
|
|
|
- else
|
|
|
- this.editName = partName;
|
|
|
- this.AbsolutePath = AbsolutePath;
|
|
|
- this.EditPath = EditPath;
|
|
|
- }
|
|
|
- public CustomPartData()
|
|
|
+ id = (DAL.Instance.Get<DeviceOfPartDataProxy>().m_CustomInfos.Count + 1).ToString();
|
|
|
+ this.partName = partName;
|
|
|
+ this.audioClipName = audioClipName;
|
|
|
+ if (string.IsNullOrEmpty(editName))
|
|
|
+ this.editName = editName;
|
|
|
+ else
|
|
|
+ this.editName = partName;
|
|
|
+ this.AbsolutePath = AbsolutePath;
|
|
|
+ this.EditPath = EditPath;
|
|
|
+ }
|
|
|
+ public CustomPartData()
|
|
|
{
|
|
|
- id = "id";
|
|
|
- partName = "partName";
|
|
|
- audioClipName = "audioClipName";
|
|
|
- editName = "editName";
|
|
|
- AbsolutePath = "AbsolutePath";
|
|
|
- EditPath = "EditPath";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ id = "id";
|
|
|
+ partName = "partName";
|
|
|
+ audioClipName = "audioClipName";
|
|
|
+ editName = "editName";
|
|
|
+ AbsolutePath = "AbsolutePath";
|
|
|
+ EditPath = "EditPath";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|