2025-09-08 14:51:28 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using ZXKFramework;
|
2025-09-24 19:24:19 +08:00
|
|
|
|
namespace DongWuYiXue.DaoNiaoShu
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class DragQuestionPanel : UIBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public override string GroupName => "DragQuestionPanel";
|
|
|
|
|
|
public override string Name => "DragQuestionPanel";
|
|
|
|
|
|
|
|
|
|
|
|
public Action nextAction;
|
2025-09-25 11:30:06 +08:00
|
|
|
|
public Action<bool> subAction;
|
2025-09-08 14:51:28 +08:00
|
|
|
|
DragManager[] drags;
|
|
|
|
|
|
Button nextBtn;
|
|
|
|
|
|
Button subBtn;
|
|
|
|
|
|
Button resetBtn;
|
|
|
|
|
|
int id;
|
2025-09-25 11:30:06 +08:00
|
|
|
|
string stepName;
|
2025-09-08 14:51:28 +08:00
|
|
|
|
public override void Init(IUIManager uictrl)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Init(uictrl);
|
|
|
|
|
|
drags = GetComponentsInChildren<DragManager>(true);
|
|
|
|
|
|
nextBtn = transform.FindFirst<Button>("Next");
|
|
|
|
|
|
nextBtn.onClick.AddListener(Next);
|
|
|
|
|
|
subBtn = transform.FindFirst<Button>("Submit");
|
|
|
|
|
|
subBtn.onClick.AddListener(Submit);
|
|
|
|
|
|
resetBtn = transform.FindFirst<Button>("Reset");
|
|
|
|
|
|
resetBtn.onClick.AddListener(Reset);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Submit()
|
|
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
Game.Instance.sound.StopBGM();
|
2025-09-08 14:51:28 +08:00
|
|
|
|
if (drags[id].CheckAllDrag())
|
|
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
subAction?.Invoke(true);
|
|
|
|
|
|
nextBtn.gameObject.SetActive(true);
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = true });
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
nextBtn.gameObject.SetActive(true);
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = false });
|
|
|
|
|
|
if (MVC.GetModel<Main.GameModel>().modeType == ModeType.ShiXun)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChatUI.Instance.SendAI(stepName + ",<2C>û<EFBFBD><C3BB>Ĵ<EFBFBD><C4B4><EFBFBD>Ϊ" + drags[id].GetYourAnswer() + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ𰸺<C4B4><F0B0B8BA><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>120<32><30><EFBFBD>ڡ<EFBFBD>", null);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
subAction?.Invoke(false);
|
|
|
|
|
|
}
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
drags[id].DisPlayResult();
|
|
|
|
|
|
subBtn.interactable = false;
|
2025-09-25 11:30:06 +08:00
|
|
|
|
resetBtn.interactable = false;
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
private void Next()
|
|
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
ChatUI.Instance.CloseChatTxt();
|
2025-09-08 14:51:28 +08:00
|
|
|
|
SetActive(false);
|
|
|
|
|
|
subBtn.interactable = true;
|
|
|
|
|
|
resetBtn.interactable = true;
|
|
|
|
|
|
nextBtn.gameObject.SetActive(false);
|
|
|
|
|
|
nextAction?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Reset()
|
|
|
|
|
|
{
|
|
|
|
|
|
drags[id].Init();
|
|
|
|
|
|
}
|
2025-09-25 11:30:06 +08:00
|
|
|
|
public void ShowDragQuestion(int id, string stepName)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
SetActive(true);
|
2025-09-25 11:30:06 +08:00
|
|
|
|
this.stepName = stepName;
|
|
|
|
|
|
subBtn.interactable = true;
|
|
|
|
|
|
resetBtn.interactable = true;
|
|
|
|
|
|
nextBtn.gameObject.SetActive(false);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
this.id = id;
|
|
|
|
|
|
for (int i = 0; i < drags.Length; i++)
|
|
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
if (i == id)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
drags[i].gameObject.SetActive(true);
|
|
|
|
|
|
drags[i].Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
drags[i].gameObject.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|