diff --git a/Assets/Scripts/UI/UIInput_AnHuiBaoShi.cs b/Assets/Scripts/UI/UIInput_AnHuiBaoShi.cs index 95142e6f..23b5529a 100644 --- a/Assets/Scripts/UI/UIInput_AnHuiBaoShi.cs +++ b/Assets/Scripts/UI/UIInput_AnHuiBaoShi.cs @@ -6,11 +6,11 @@ using System.Linq; namespace QFramework.Example { - - public class UIInput_AnHuiBaoShiData : UIPanelData - { - } - public partial class UIInput_AnHuiBaoShi : UIPanel + + public class UIInput_AnHuiBaoShiData : UIPanelData + { + } + public partial class UIInput_AnHuiBaoShi : UIPanel { public int CurrentInputIndex;//当前索引次数 @@ -23,7 +23,7 @@ namespace QFramework.Example public string[] targetMin; // 设置最小目标值 [Header("最大目标值错误次数")] - public int errowIntMax = 0;//最大目标值错误次数 + public int errowIntMax = 0;//最大目标值错误次数 [Header("最小目标值错误次数")] public int errowIntMin = 0;//最小目标值错误次数 [Header("错误弹窗")] @@ -31,9 +31,9 @@ namespace QFramework.Example public Button errowTipClickBtn;//错误弹窗,确认按钮 - private string tMP_InputField1Value= "1.770"; - - private string tMP_InputField2Value= "1.762"; + private string tMP_InputField1Value = "1.770"; + + private string tMP_InputField2Value = "1.762"; private string tMP_InputField3Value = "0.008"; @@ -45,14 +45,34 @@ namespace QFramework.Example public GameObject ZheSheInput;//输入三个数值的输入框 - + + + public void OnReSet() + { + + InputFieldmax.gameObject.SetActive(true); + InputFieldmin.gameObject.SetActive(true); + images[0].gameObject.SetActive(true); + images[1].gameObject.SetActive(false); + images[2].gameObject.SetActive(false); + images[3].gameObject.SetActive(false); + images[4].gameObject.SetActive(false); + tMP_InputField1.gameObject.SetActive(false); + tMP_InputField2.gameObject.SetActive(false); + tMP_InputField3.gameObject.SetActive(false); + errowTip.gameObject.SetActive(false); + CurrentInputIndex = 0; + errowIntMax = 0; + errowIntMin = 0; + } protected override void OnInit(IUIData uiData = null) - { - mData = uiData as UIInput_AnHuiBaoShiData ?? new UIInput_AnHuiBaoShiData(); - - } - - protected override void OnOpen(IUIData uiData = null) + { + mData = uiData as UIInput_AnHuiBaoShiData ?? new UIInput_AnHuiBaoShiData(); + OnReSet(); + OnOpen(); + } + + protected override void OnOpen(IUIData uiData = null) { transform.SetAsLastSibling(); @@ -62,11 +82,11 @@ namespace QFramework.Example CurrentInputIndex = 0; errowIntMax = 0; errowIntMin = 0; - + InputFieldmax.onEndEdit.RemoveAllListeners(); InputFieldmin.onEndEdit.RemoveAllListeners(); - + InputFieldmax.onEndEdit.AddListener(CheckInputMax); InputFieldmin.onEndEdit.AddListener(CheckInputMin); @@ -81,10 +101,10 @@ namespace QFramework.Example public void CheackAllInputField() { - if (tMP_InputField1.text== tMP_InputField1Value && tMP_InputField2.text == tMP_InputField2Value&& - tMP_InputField3.text == tMP_InputField3Value ) + if (tMP_InputField1.text == tMP_InputField1Value && tMP_InputField2.text == tMP_InputField2Value && + tMP_InputField3.text == tMP_InputField3Value) { - + StringEventSystem.Global.Send("InputUI使用结束"); } @@ -92,7 +112,7 @@ namespace QFramework.Example private void CheacktMP_InputField1String(string userInput) { - if (userInput==tMP_InputField1Value) + if (userInput == tMP_InputField1Value) { tMP_InputField1.text = tMP_InputField1Value; tMP_InputField1.DeactivateInputField(); @@ -102,7 +122,7 @@ namespace QFramework.Example else { tMP_InputField1ErrowIndex++; - if (tMP_InputField1ErrowIndex>=3) + if (tMP_InputField1ErrowIndex >= 3) { tMP_InputField1.text = tMP_InputField1Value; tMP_InputField1.DeactivateInputField(); @@ -112,7 +132,7 @@ namespace QFramework.Example } else { - + errowTip.gameObject.SetActive(true); tMP_InputField1.text = string.Empty; } @@ -179,10 +199,10 @@ namespace QFramework.Example /// /// private void CheckInputMax(string userInput) - { - var v = targetMax[CurrentInputIndex].ToString(); + { + var v = targetMax[CurrentInputIndex].ToString(); if (v != userInput) - { + { //第3次,填入正确答案 if (errowIntMax >= 3) { @@ -196,8 +216,8 @@ namespace QFramework.Example errowIntMax++; errowTip.gameObject.SetActive(true); InputFieldmax.text = string.Empty; - - + + @@ -208,7 +228,7 @@ namespace QFramework.Example else { Debug.Log("填写数值正确"); - userInput= targetMax.ToString(); + userInput = targetMax.ToString(); SetNextInput(); } @@ -220,7 +240,7 @@ namespace QFramework.Example /// private void CheckInputMin(string userInput) { - + var v = targetMin[CurrentInputIndex].ToString(); if (v != userInput) { @@ -231,8 +251,8 @@ namespace QFramework.Example InputFieldmin.text = targetMin[CurrentInputIndex].ToString(); InputFieldmin.DeactivateInputField(); InputFieldmin.readOnly = true; - - Invoke("SetNextInput",2f); + + Invoke("SetNextInput", 2f); return; } errowIntMin++; @@ -256,21 +276,21 @@ namespace QFramework.Example } } protected override void OnShow() - { - } - - protected override void OnHide() - { - StringEventSystem.Global.Send("InputUI使用结束"); - } - - protected override void OnClose() - { - } + { + } + + protected override void OnHide() + { + StringEventSystem.Global.Send("InputUI使用结束"); + } + + protected override void OnClose() + { + } private void SetNextInput() { - if (InputFieldmax.text == targetMax[CurrentInputIndex].ToString()&& InputFieldmin.text ==targetMin[CurrentInputIndex].ToString()) + if (InputFieldmax.text == targetMax[CurrentInputIndex].ToString() && InputFieldmin.text == targetMin[CurrentInputIndex].ToString()) { //InputFieldmax.ActivateInputField(); //InputFieldmin.ActivateInputField(); @@ -282,7 +302,7 @@ namespace QFramework.Example InputFieldmax.readOnly = false; InputFieldmin.readOnly = false; - + InputFieldmax.text = string.Empty; InputFieldmin.text = string.Empty; @@ -292,9 +312,9 @@ namespace QFramework.Example CurrentInputIndex++; if (CurrentInputIndex < images.Length) { - + // 先递增索引 - + foreach (var item in images) { item.gameObject.SetActive(false); @@ -309,9 +329,9 @@ namespace QFramework.Example } ZheSheInput.gameObject.SetActive(true); } - - - + + + diff --git a/Data/Xml/ZheSheYi.xml b/Data/Xml/ZheSheYi.xml index e8716674..cde4b960 100644 --- a/Data/Xml/ZheSheYi.xml +++ b/Data/Xml/ZheSheYi.xml @@ -30,7 +30,7 @@ - 鎶樺皠浠張绉版姌鍏変华锛岀敤鏉ユ祴瀹氭姌灏勭巼銆佸弻鎶樼巼銆佸厜鎬э紝鎶樺皠鐜囨槸鐗╄川鐨勯噸瑕佺墿鐞嗗父鏁颁箣涓銆傛姌灏勪华涓昏鐢遍珮鎶樺皠鐜囨1闀滐紙閾呯幓鐠冩垨绔嬫柟姘у寲閿嗭級銆佹1闀滃弽灏勯暅銆侀忛暅銆佹爣灏猴紙鍐呮爣灏烘垨澶栨爣灏猴級鍜岀洰闀滅瓑缁勬垚銆傚彲鐢ㄤ簬锛1锛庨壌瀹氬疂鐭筹紝鍙祴瀹歊I1.35-1.81涔嬮棿瀹濈煶鐨勬姌灏勭巼鍊硷紱2锛庡彲娴嬪畾瀹濈煶鐨勫弻鎶樺皠鐜囷紙DR锛夛紱3锛庣‘瀹氬疂鐭崇殑杞存э紝濡備竴杞存櫠銆佷簩杞存櫠鍜屽悇鍚戝悓鎬э紙绛夎酱鏅剁郴銆侀潪鏅惰川锛夛紱4锛庣‘瀹氬疂鐭崇殑鍏夋х鍙凤紝濡傚悇鍚戝紓鎬у疂鐭崇殑姝e厜鎬у拰璐熷厜鎬с + 鎶樺皠浠張绉版姌鍏変华锛岀敤鏉ユ祴瀹氭姌灏勭巼銆佸弻鎶樼巼銆佸厜鎬с佽酱鎬э紝鎶樺皠鐜囨槸鐗╄川鐨勯噸瑕佺墿鐞嗗父鏁颁箣涓銆傛姌灏勪华涓昏鐢遍珮鎶樺皠鐜囨1闀滐紙閾呯幓鐠冩垨绔嬫柟姘у寲閿嗭級銆佹1闀滃弽灏勯暅銆侀忛暅銆佹爣灏猴紙鍐呮爣灏烘垨澶栨爣灏猴級鍜岀洰闀滅瓑缁勬垚銆傚彲鐢ㄤ簬锛1锛庨壌瀹氬疂鐭筹紝鍙祴瀹歊I1.35-1.81涔嬮棿瀹濈煶鐨勬姌灏勭巼鍊硷紱2锛庡彲娴嬪畾瀹濈煶鐨勫弻鎶樺皠鐜囷紙DR锛夛紱3锛庣‘瀹氬疂鐭崇殑杞存э紝濡備竴杞存櫠銆佷簩杞存櫠鍜屽悇鍚戝悓鎬э紙绛夎酱鏅剁郴銆侀潪鏅惰川锛夛紱4锛庣‘瀹氬疂鐭崇殑鍏夋х鍙凤紝濡傚悇鍚戝紓鎬у疂鐭崇殑姝e厜鎬у拰璐熷厜鎬с