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