2025-09-08 14:51:28 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using ZXKFramework;
|
2025-09-08 17:37:12 +08:00
|
|
|
|
namespace DongWuYiXue.DaoNiaoShu
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class TxtSelectQuestionPanel : UIBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public override string GroupName => "TxtSelectQuestionPanel";
|
|
|
|
|
|
public override string Name => "TxtSelectQuestionPanel";
|
|
|
|
|
|
|
|
|
|
|
|
public Action nextAction;
|
|
|
|
|
|
public Action<bool> subAction;
|
|
|
|
|
|
TxtSelectManager[] txtSelectManagers;
|
|
|
|
|
|
Button nextBtn;
|
|
|
|
|
|
Button subBtn;
|
|
|
|
|
|
int id;
|
2025-09-25 17:30:19 +08:00
|
|
|
|
string stepName;
|
2025-09-08 14:51:28 +08:00
|
|
|
|
public override void Init(IUIManager uictrl)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Init(uictrl);
|
|
|
|
|
|
txtSelectManagers = GetComponentsInChildren<TxtSelectManager>(true);
|
|
|
|
|
|
nextBtn = transform.FindFirst<Button>("Next");
|
|
|
|
|
|
nextBtn.onClick.AddListener(Next);
|
|
|
|
|
|
subBtn = transform.FindFirst<Button>("Submit");
|
|
|
|
|
|
subBtn.onClick.AddListener(Submit);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Submit()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (txtSelectManagers[id].Check())
|
|
|
|
|
|
{
|
|
|
|
|
|
subAction?.Invoke(true);
|
2025-09-25 17:30:19 +08:00
|
|
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = true });
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-09-25 17:30:19 +08:00
|
|
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = false });
|
|
|
|
|
|
if (MVC.GetModel<Main.GameModel>().modeType == ModeType.ShiXun)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChatUI.Instance.SendAI("<22>û<EFBFBD>λ<EFBFBD>ڣ<EFBFBD>" + stepName + "<22><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>" + txtSelectManagers[id].GetYourAnswer() + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>𰸺<EFBFBD><F0B0B8BA><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>100<30><30><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>", null);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
subAction?.Invoke(false);
|
|
|
|
|
|
}
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
subBtn.gameObject.SetActive(false);
|
|
|
|
|
|
nextBtn.gameObject.SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Next()
|
|
|
|
|
|
{
|
2025-09-25 17:30:19 +08:00
|
|
|
|
ChatUI.Instance.CloseChatTxt();
|
2025-09-08 14:51:28 +08:00
|
|
|
|
SetActive(false);
|
|
|
|
|
|
subBtn.gameObject.SetActive(true);
|
|
|
|
|
|
nextBtn.gameObject.SetActive(false);
|
|
|
|
|
|
nextAction?.Invoke();
|
|
|
|
|
|
}
|
2025-09-25 17:30:19 +08:00
|
|
|
|
public void ShowImgQuestion(int id, string stepName)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
SetActive(true);
|
|
|
|
|
|
this.id = id;
|
2025-09-25 17:30:19 +08:00
|
|
|
|
this.stepName = stepName;
|
2025-09-08 14:51:28 +08:00
|
|
|
|
for (int i = 0; i < txtSelectManagers.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (i == id)
|
|
|
|
|
|
{
|
|
|
|
|
|
txtSelectManagers[i].gameObject.SetActive(true);
|
|
|
|
|
|
txtSelectManagers[i].Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
txtSelectManagers[i].gameObject.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|