Tz2/Assets/Zion/Scripts/AnswerSheetSystem.cs

115 lines
4.3 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using DefaultNamespace;
using Framework.Manager;
using MotionFramework;
using UnityEngine;
using UnityEngine.UI;
public class AnswerSheetSystem : MonoBehaviour
{
public GameObject yueduruku;
public GameObject yuedutuiku;
public GameObject kucunwuzi;
public GameObject zaitukucunwuzi;
public GameObject chaxunxuqiujihua;
public GameObject dianlanfenzhixiang;
public GameObject yuedu;
public GameObject ansButton;
// 答题卡按钮组件引用
private Button answerSheetButtonComponent;
private void Start()
{
// 获取答题卡按钮的Button组件
if (ansButton != null)
{
answerSheetButtonComponent = ansButton.GetComponent<Button>();
if (answerSheetButtonComponent != null)
{
// 设置FileComponent中的答题卡按钮引用
FileComponent.SetAnswerSheetButton(answerSheetButtonComponent);
// 添加点击事件监听
answerSheetButtonComponent.onClick.AddListener(OnAnswerSheetButtonClick);
Debug.Log("AnswerSheetSystem: 答题卡按钮组件已设置并绑定点击事件");
// 判断是否为特定题目,如果是则直接显示答题卡按钮
string examName = MotionEngine.GetModule<GlobalDataStorage>().ExamName;
if (examName == "系统退库冲销凭证分析" ||
examName == "系统入库冲销凭证分析" ||
examName == "库存物资报表的查询与解读" ||
examName == "在途库存物资报表的查询与解读"||
examName == "查询需求计划平衡利库情况"||
examName == "电缆分支箱跨地市物资调配"||
examName=="月度采购物资入库凭证分析")
{
// 直接显示答题卡按钮
ansButton.SetActive(true);
Debug.Log($"AnswerSheetSystem: 检测到特定题目 '{examName}',直接显示答题卡按钮");
}
}
else
{
Debug.LogError("AnswerSheetSystem: ansButton上没有找到Button组件");
}
}
else
{
Debug.LogError("AnswerSheetSystem: ansButton引用未设置");
}
}
/// <summary>
/// 答题卡按钮点击事件处理方法
/// </summary>
private void OnAnswerSheetButtonClick()
{
Debug.Log("AnswerSheetSystem: 答题卡按钮被点击");
// 调用FileComponent的答题卡按钮点击处理方法
FileComponent.OnAnswerSheetButtonClick();
}
public void Open()
{
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "系统退库冲销凭证分析")
{
yuedutuiku.gameObject.SetActive(true);
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "系统入库冲销凭证分析")
{
yueduruku.gameObject.SetActive(true);
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "库存物资报表的查询与解读")
{
kucunwuzi.gameObject.SetActive(true);
}
// else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "物料凭证分析基础知识")
// {
// kucunwuzi.gameObject.SetActive(true);
// }
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "在途库存物资报表的查询与解读")
{
zaitukucunwuzi.gameObject.SetActive(true);
}else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "查询需求计划平衡利库情况")
{
chaxunxuqiujihua.gameObject.SetActive(true);
}else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "电缆分支箱跨地市物资调配")
{
dianlanfenzhixiang.gameObject.SetActive(true);
}else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "月度采购物资入库凭证分析")
{
yuedu.gameObject.SetActive(true);
}
TutorialGuideManager.Instance.ShowGuide();
}
}