Tz2/Assets/GameAssets/UI/ERP_UI/Script/Column.cs

848 lines
43 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections;
using System.Collections.Generic;
using DefaultNamespace;
using DefaultNamespace.ProcessMode;
using Framework.Manager;
using MotionFramework;
using UnityEngine;
using UnityEngine.UI;
public class Column : MonoBehaviour
{
public Image Image_Column;
public Sprite Spr_1, Spr_2;
public GameObject[] ObjList;
[HideInInspector] public bool ifShow = false;
int i;
public void Start()
{
if (GetComponent<Button>() != null)
{
GetComponent<Button>().onClick.AddListener(() =>
{
StartCoroutine(WaitEnable(GetComponent<Button>(), 1.5f));
bool isnext = false;
for (int i = 0; i < ERPCollection.instance.columnsItem.Count; i++)
{
if (transform.name.Contains(ERPCollection.instance.columnsItem[i].Name))
{
if (ERPCollection.instance.columnsItem[i].name == "m转移过账-初始屏幕")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "转储调拨系统出库")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "电力电缆调拨物资出库")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m查询物资采购合同执行状态")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "查询合同执行状态报表")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (ERPCollection.instance.columnsItem[i].IsClickTrue)
// {
// MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
// }
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "基建工程延期供应计划调整")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (ERPCollection.instance.columnsItem[i].IsClickTrue)
// {
// MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
// }
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m参照借料申请单进行借料")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "借用物资系统归还系统操作" ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName == "借用物资入库")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m参照借料申请单进行借料_归还_发料")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("借用物资出库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m打印出库单")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("借用物资出库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m库存物资查询报表_电缆分支箱跨地市物资调配")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "电缆分支箱跨地市物资调配")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m物料凭证清单_物料凭证分析基础知识")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "物料凭证分析基础知识")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m代保管物资仓储单")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "10kV变压器退出退役代保管入库")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m查询物资采购合同执行状态_重点物资排产计划_物资配送履约跟踪表维护_完成出厂验收的系统上报操作")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "完成出厂验收的系统上报操作")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "物资配送履约跟踪表维护")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "重点物资排产计划制定")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "审核合同变更申请")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (ERPCollection.instance.columnsItem[i].IsClickTrue)
// {
// MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
// }
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m显示库存凭证清单")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "月度采购物资入库凭证分析")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m调拨单据签字签章查询")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "电力电缆调拨物资出库")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m在途库存")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "在途库存物资报表的查询与解读" ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName == "库存物资报表的查询与解读"
)
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m库存物资查询报表new")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("领用出库") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName == "XX公司库存组成分析" ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管物资出库") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存状态转换") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资报表的查询与解读") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("分析全市库存500138347物料号的一二次融合成套柱上断路器总库存") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资库存地点批量切换") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("物料凭证分析基础知识"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资库存地点批量切换"))
// return;
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m代保管物资仓储单")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管物资出库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m管理库存收发货")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退料物资入库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
//if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资报废流程")|| MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资报废"))
//{
// ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
// ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
// if (!isnext)
// TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (ERPCollection.instance.columnsItem[i].IsClickTrue)
// {
// MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
// }
// break;
//}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("调拨物资入库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("工程结余物资不可用办理实物退库") || MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("废旧物资入库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管物资入库") || MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退出退役代保管入库"))
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m过账转移new")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "库存物资库存状态转换")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "库存物资库存地点批量切换")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
continue;
}
if (ERPCollection.instance.columnsItem[i].name == "m显示库存凭证清单")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "月度采购物资入库凭证分析")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
}
if (ERPCollection.instance.columnsItem[i].name == "m管理库存收发货new")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "库存物资报废流程")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
}
if (ERPCollection.instance.columnsItem[i].name == "m物料凭证清单")
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "系统退库冲销凭证分析")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (ERPCollection.instance.columnsItem[i].IsClickTrue)
// {
// MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
// }
break;
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "系统入库冲销凭证分析")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
// if (ERPCollection.instance.columnsItem[i].IsClickTrue)
// {
// MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
// }
break;
}
continue;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "ELP应用")
{
if (ERPCollection.instance.columnsItem[i].name == "m查询物资采购合同执行状态_ELP应用")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
break;
}
else
{
ERPCollection.instance.columnsItem[i].gameObject.SetActive(false);
}
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "查询需求计划平衡利库情况")
{
if (ERPCollection.instance.columnsItem[i].name == "m物资需求计划审批情况查询表_查询需求计划审批状态")
{
ERPCollection.instance.columnsItem.ForEach(x => x.gameObject.SetActive(false));
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (!isnext)
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
break;
}
else
{
ERPCollection.instance.columnsItem[i].gameObject.SetActive(false);
}
}
if (!isnext)
{
TutorialGuideManager.Instance.TriggerNextGuide(transform.name);
isnext = true;
}
ERPCollection.instance.columnsItem[i].gameObject.SetActive(true);
if (ERPCollection.instance.columnsItem[i].IsClickTrue)
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "查询需求计划审批状态")
{
return;
}
MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { ERPCollection.instance.columnsItem[i].Name });
}
}
else
{
ERPCollection.instance.columnsItem[i].gameObject.SetActive(false);
}
}
//GetComponent<Button>().enabled = true;
});
}
}
/// <summary>
/// 添加按钮点击完后延迟后才能再点
/// </summary>
/// <param name="bt"></param>
/// <param name="time"></param>
/// <returns></returns>
IEnumerator WaitEnable(Button bt, float time)
{
bt.enabled = false;
yield return new WaitForSeconds(time);
bt.enabled = true;
}
//隐藏/显示
public void ShowDis()
{
ifShow = !ifShow;
bool hasRolledBack = false; // 记录是否执行了回退
if (ifShow) //显示
Image_Column.sprite = Spr_2;
else //隐藏
{
// 在菜单收缩前,检查是否需要回退引导
hasRolledBack = HandleGuideRollbackOnMenuCollapse();
Image_Column.sprite = Spr_1;
for (i = 0; i < ObjList.Length; i++)
{
tempCol = ObjList[i].GetComponent<Column>();
if (tempCol != null)
ObjList[i].GetComponent<Column>().Dis();
}
}
for (i = 0; i < ObjList.Length; i++)
ObjList[i].SetActive(ifShow);
// 只有在菜单展开时,或者菜单收缩但未执行回退时,才触发下一步引导
if (ifShow || !hasRolledBack)
{
InterfaceManager.LoadTriggerNextGuide(transform.name);
}
else
{
Debug.Log($"菜单收缩且已执行回退,跳过触发下一步引导");
}
}
//隐藏
Column tempCol;
/// <summary>
/// 递归检查UI对象是否在Column层级中
/// </summary>
/// <param name="uiObject">要检测的UI对象</param>
/// <param name="currentColumn">当前检查的Column</param>
/// <returns>如果UI对象在Column层级中返回true否则返回false</returns>
private bool FindUIInColumnHierarchy(GameObject uiObject, Column currentColumn)
{
if (uiObject == null || currentColumn == null)
{
return false;
}
// 检查UI对象是否在当前Column的ObjList中
foreach (GameObject obj in currentColumn.ObjList)
{
if (obj == null) continue;
// 检查UI对象是否就是ObjList中的某个对象
if (uiObject == obj)
{
Debug.Log($"检测到UI对象 {uiObject.name} 在Column {currentColumn.transform.name} 的ObjList中");
return true;
}
// 如果子对象也是Column递归检查
Column childColumn = obj.GetComponent<Column>();
if (childColumn != null)
{
if (FindUIInColumnHierarchy(uiObject, childColumn))
{
return true;
}
}
}
return false;
}
/// <summary>
/// 检测UI对象是否在当前Column的层级中包括多层嵌套
/// </summary>
/// <param name="uiObject">要检测的UI对象</param>
/// <returns>如果UI对象在当前Column层级中返回true否则返回false</returns>
private bool IsUIObjectInColumnHierarchy(GameObject uiObject)
{
if (uiObject == null)
{
return false;
}
return FindUIInColumnHierarchy(uiObject, this);
}
/// <summary>
/// 递归计算UI对象在Column层级中的深度
/// </summary>
/// <param name="uiObject">要计算深度的UI对象</param>
/// <param name="currentColumn">当前检查的Column</param>
/// <param name="currentDepth">当前深度</param>
/// <returns>UI对象在Column层级中的深度未找到返回0</returns>
private int CalculateDepthInColumnHierarchy(GameObject uiObject, Column currentColumn, int currentDepth)
{
if (uiObject == null || currentColumn == null)
{
return 0;
}
// 检查UI对象是否在当前Column的ObjList中
foreach (GameObject obj in currentColumn.ObjList)
{
if (obj == null) continue;
// 检查UI对象是否就是ObjList中的某个对象
if (uiObject == obj)
{
Debug.Log($"计算深度UI对象 {uiObject.name} 在Column {currentColumn.transform.name} 的ObjList中深度为 {currentDepth + 1}");
return currentDepth + 1;
}
// 如果子对象也是Column递归计算深度
Column childColumn = obj.GetComponent<Column>();
if (childColumn != null)
{
int childDepth = CalculateDepthInColumnHierarchy(uiObject, childColumn, currentDepth + 1);
if (childDepth > 0)
{
return childDepth;
}
}
}
return 0;
}
/// <summary>
/// 计算需要回退的引导步骤深度
/// </summary>
/// <param name="uiObject">当前引导的UI对象</param>
/// <returns>需要回退的步骤数</returns>
private int CalculateRollbackDepth(GameObject uiObject)
{
if (uiObject == null)
{
return 0;
}
// 递归计算UI对象在Column层级中的深度
int depth = CalculateDepthInColumnHierarchy(uiObject, this, 0);
Debug.Log($"计算回退深度UI对象 {uiObject.name} 在Column {transform.name} 的层级中,深度为 {depth}");
return depth;
}
/// <summary>
/// 处理菜单收缩时的引导回退逻辑
/// </summary>
/// <returns>是否执行了引导回退</returns>
private bool HandleGuideRollbackOnMenuCollapse()
{
// 获取当前引导的UI对象
GameObject currentGuideUI = TutorialGuideManager.Instance.GetCurrentGuideUIObject();
Debug.Log($"开始检测引导回退当前Column {transform.name}当前引导UI {(currentGuideUI != null ? currentGuideUI.name : "null")}");
if (currentGuideUI == null)
{
Debug.Log("当前引导UI为空跳过回退检测");
return false;
}
// 检查当前引导UI是否在当前Column的层级下
if (IsUIObjectInColumnHierarchy(currentGuideUI))
{
// 计算需要回退的深度
int rollbackDepth = CalculateRollbackDepth(currentGuideUI);
Debug.Log($"检测到菜单收缩当前引导UI {currentGuideUI.name} 在收缩的层级下,需要回退 {rollbackDepth} 步");
// 执行回退操作
for (int i = 0; i < rollbackDepth; i++)
{
TutorialGuideManager.Instance.TriggerPrevGuide();
}
return true; // 执行了回退
}
else
{
Debug.Log($"当前引导UI {currentGuideUI.name} 不在Column {transform.name} 的层级下,无需回退");
return false; // 未执行回退
}
}
public void Dis()
{
try
{
ifShow = false;
Debug.Log(Image_Column.transform.parent.name);
Debug.Log(Image_Column.name);
Image_Column.sprite = Spr_1;
for (i = 0; i < ObjList.Length; i++)
{
tempCol = ObjList[i].GetComponent<Column>();
if (tempCol != null)
ObjList[i].GetComponent<Column>().Dis();
}
for (i = 0; i < ObjList.Length; i++)
ObjList[i].SetActive(ifShow);
}
catch (Exception e)
{
Debug.Log("报错了,我也不知道为啥报错,也懒得看了,就直接跳过了,有人发现的话帮忙看下!--->" + e.Message);
}
}
}