修改宝石BUG

This commit is contained in:
马铖荣 2025-06-03 09:19:44 +08:00
parent fecb666b08
commit 9b96fc89c2
2 changed files with 32 additions and 31 deletions

View File

@ -13,22 +13,22 @@ namespace QFramework.Example
public partial class UIInput_AnHuiBaoShi : UIPanel public partial class UIInput_AnHuiBaoShi : UIPanel
{ {
public int CurrentInputIndex;//当前索引次数 public int CurrentInputIndex;//当前索引次数
[Header("所有的图片")] [Header("所有的图片")]
public Image[] images; public Image[] images;
[Header("设置最大目标值")] [Header("设置最大目标值")]
public string[] targetMax; // 设置最大目标值 public string[] targetMax; // 设置最大目标值
[Header("设置最小目标值")] [Header("设置最小目标值")]
public string[] targetMin; // 设置最小目标值 public string[] targetMin; // 设置最小目标值
[Header("最大目标值错误次数")] [Header("最大目标值错误次数")]
public int errowIntMax = 0;//最大目标值错误次数 public int errowIntMax = 0;//最大目标值错误次数
[Header("最小目标值错误次数")] [Header("最小目标值错误次数")]
public int errowIntMin = 0;//最小目标值错误次数 public int errowIntMin = 0;//最小目标值错误次数
[Header("错误弹窗")] [Header("错误弹窗")]
public GameObject errowTip;//错误弹窗 public GameObject errowTip;//错误弹窗
public Button errowTipClickBtn;//错误弹窗,确认按钮 public Button errowTipClickBtn;//错误弹窗,确认按钮
private string tMP_InputField1Value = "1.770"; private string tMP_InputField1Value = "1.770";
@ -43,7 +43,7 @@ namespace QFramework.Example
public GameObject ZheSheInput;//输入三个数值的输入框 public GameObject ZheSheInput;//输入三个数值的输入框
@ -70,8 +70,13 @@ namespace QFramework.Example
mData = uiData as UIInput_AnHuiBaoShiData ?? new UIInput_AnHuiBaoShiData(); mData = uiData as UIInput_AnHuiBaoShiData ?? new UIInput_AnHuiBaoShiData();
OnReSet(); OnReSet();
OnOpen(); OnOpen();
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
} }
public void OnModuleQuit(OnModuleQuit arg)
{
Hide();
}
protected override void OnOpen(IUIData uiData = null) protected override void OnOpen(IUIData uiData = null)
{ {
@ -108,7 +113,7 @@ namespace QFramework.Example
tMP_InputField3.text == tMP_InputField3Value) tMP_InputField3.text == tMP_InputField3Value)
{ {
StringEventSystem.Global.Send("InputUI使用结束"); StringEventSystem.Global.Send("InputUI使用结束");
} }
} }
@ -198,7 +203,7 @@ namespace QFramework.Example
} }
/// <summary> /// <summary>
/// 输入最大值 /// 输入最大值
/// </summary> /// </summary>
/// <param name="userInput"></param> /// <param name="userInput"></param>
private void CheckInputMax(string userInput) private void CheckInputMax(string userInput)
@ -206,7 +211,7 @@ namespace QFramework.Example
var v = targetMax[CurrentInputIndex].ToString(); var v = targetMax[CurrentInputIndex].ToString();
if (v != userInput) if (v != userInput)
{ {
//第3次填入正确答案 //第3次填入正确答案
if (errowIntMax >= 3) if (errowIntMax >= 3)
{ {
@ -227,10 +232,10 @@ namespace QFramework.Example
} }
//正确++ //正确++
else else
{ {
Debug.Log("填写数值正确"); Debug.Log("填写数值正确");
userInput = targetMax.ToString(); userInput = targetMax.ToString();
SetNextInput(); SetNextInput();
@ -238,7 +243,7 @@ namespace QFramework.Example
} }
/// <summary> /// <summary>
/// 输入最小值 /// 输入最小值
/// </summary> /// </summary>
/// <param name="userInput"></param> /// <param name="userInput"></param>
private void CheckInputMin(string userInput) private void CheckInputMin(string userInput)
@ -247,7 +252,7 @@ namespace QFramework.Example
var v = targetMin[CurrentInputIndex].ToString(); var v = targetMin[CurrentInputIndex].ToString();
if (v != userInput) if (v != userInput)
{ {
//第四次,填入正确答案 //第四次,填入正确答案
if (errowIntMin >= 3) if (errowIntMin >= 3)
{ {
@ -269,10 +274,10 @@ namespace QFramework.Example
} }
//正确++ //正确++
else else
{ {
Debug.Log("填写数值正确"); Debug.Log("填写数值正确");
userInput = targetMax.ToString(); userInput = targetMax.ToString();
SetNextInput(); SetNextInput();
@ -284,9 +289,10 @@ namespace QFramework.Example
protected override void OnHide() protected override void OnHide()
{ {
StringEventSystem.Global.Send("InputUI使用结束"); StringEventSystem.Global.Send("InputUI使用结束");
} }
protected override void OnClose() protected override void OnClose()
{ {
} }
@ -297,7 +303,7 @@ namespace QFramework.Example
{ {
//InputFieldmax.ActivateInputField(); //InputFieldmax.ActivateInputField();
//InputFieldmin.ActivateInputField(); //InputFieldmin.ActivateInputField();
//重置 //重置
errowTip.gameObject.SetActive(false); errowTip.gameObject.SetActive(false);
errowIntMax = 0; errowIntMax = 0;
errowIntMin = 0; errowIntMin = 0;
@ -316,7 +322,7 @@ namespace QFramework.Example
if (CurrentInputIndex < images.Length) if (CurrentInputIndex < images.Length)
{ {
// 先递增索引 // 先递增索引
foreach (var item in images) foreach (var item in images)
{ {

View File

@ -98,10 +98,6 @@ namespace QFramework.Example
TypeEventSystem.Global.Send<OnLoadingHide>(new OnLoadingHide()); TypeEventSystem.Global.Send<OnLoadingHide>(new OnLoadingHide());
}); });
} }
} }
@ -131,7 +127,6 @@ namespace QFramework.Example
} }
UIKit.OpenPanelAsync<UIRightTop>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => UIKit.OpenPanelAsync<UIRightTop>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
{ {
TypeEventSystem.Global.Send<OnModuleStart>(); TypeEventSystem.Global.Send<OnModuleStart>();
TypeEventSystem.Global.Send<OnLoadingHide>(); TypeEventSystem.Global.Send<OnLoadingHide>();
Hide(); Hide();