130 lines
4.3 KiB
C#
130 lines
4.3 KiB
C#
using System;
|
||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||
using UnityEngine.UI;
|
||
using ZXKFramework;
|
||
namespace YiLiao.XinFeiTingZhen
|
||
{
|
||
public class TxtSelectQuestionPanel : UIBase
|
||
{
|
||
#region 錦맣덜쯤품쭉서 董灌<EFBFBD>뇜
|
||
//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;
|
||
//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);
|
||
// }
|
||
// else
|
||
// {
|
||
// subAction?.Invoke(false);
|
||
// }
|
||
// subBtn.gameObject.SetActive(false);
|
||
// nextBtn.gameObject.SetActive(true);
|
||
//}
|
||
//private void Next()
|
||
//{
|
||
// SetActive(false);
|
||
// subBtn.gameObject.SetActive(true);
|
||
// nextBtn.gameObject.SetActive(false);
|
||
// nextAction?.Invoke();
|
||
//}
|
||
//public void ShowImgQuestion(int id)
|
||
//{
|
||
// SetActive(true);
|
||
// subBtn.gameObject.SetActive(true);
|
||
// this.id = id;
|
||
// 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);
|
||
// }
|
||
// }
|
||
//}
|
||
#endregion
|
||
|
||
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;
|
||
string stepName;
|
||
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())
|
||
{
|
||
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = true });
|
||
subAction?.Invoke(true);
|
||
}
|
||
else
|
||
{
|
||
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = false });
|
||
ChatUI.Instance.SendAI(stepName + "헝썩驕굶痙커", null);
|
||
subAction?.Invoke(false);
|
||
}
|
||
subBtn.gameObject.SetActive(false);
|
||
nextBtn.gameObject.SetActive(true);
|
||
}
|
||
private void Next()
|
||
{
|
||
SetActive(false);
|
||
subBtn.gameObject.SetActive(true);
|
||
nextBtn.gameObject.SetActive(false);
|
||
nextAction?.Invoke();
|
||
}
|
||
public void ShowImgQuestion(int id, string stepName)
|
||
{
|
||
this.stepName = stepName;
|
||
SetActive(true);
|
||
subBtn.gameObject.SetActive(true);
|
||
this.id = id;
|
||
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);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |