diff --git a/Assets/Art/UIPrefab/UITextQuestion.prefab b/Assets/Art/UIPrefab/UITextQuestion.prefab index 1370ac81..3580c367 100644 --- a/Assets/Art/UIPrefab/UITextQuestion.prefab +++ b/Assets/Art/UIPrefab/UITextQuestion.prefab @@ -853,7 +853,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} m_Name: m_EditorClassIdentifier: - m_AllowSwitchOff: 0 + m_AllowSwitchOff: 1 --- !u!114 &1622034218903515943 MonoBehaviour: m_ObjectHideFlags: 0 @@ -987,7 +987,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MarkType: 0 - CustomComponentName: + CustomComponentName: BtnContent CustomComment: mComponentName: RectTransform --- !u!1 &7473196182865972638 diff --git a/Assets/Scripts/Actions/TextQuestionAction.cs b/Assets/Scripts/Actions/TextQuestionAction.cs index b6548e74..a116d865 100644 --- a/Assets/Scripts/Actions/TextQuestionAction.cs +++ b/Assets/Scripts/Actions/TextQuestionAction.cs @@ -25,6 +25,7 @@ public class TextQuestionAction : IAction string scoreName = string.Empty; string absolutely = string.Empty; string finishedEvent = string.Empty; + string optionType = null; public static TextQuestionAction Allocate(Dictionary datas, System.Action onDelayFinish = null) { var retNode = mPool.Allocate(); @@ -42,6 +43,7 @@ public class TextQuestionAction : IAction retNode.scoreName = datas.ContainsKey("scoreName") ? datas["scoreName"] : string.Empty; retNode.absolutely = datas.ContainsKey("absolutely") ? datas["absolutely"] : string.Empty; retNode.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : string.Empty; + retNode.optionType = datas.ContainsKey("optionType") ? datas["optionType"] : "0"; return retNode; } @@ -84,6 +86,7 @@ public class TextQuestionAction : IAction float.TryParse(errorScore, out data.errorScore); bool.TryParse(absolutely, out data.absolutely); } + int.TryParse(optionType, out data.OptionType); UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } diff --git a/Assets/Scripts/Actions/UIToolsAction.cs b/Assets/Scripts/Actions/UIToolsAction.cs index d94afbe7..b5ef95dc 100644 --- a/Assets/Scripts/Actions/UIToolsAction.cs +++ b/Assets/Scripts/Actions/UIToolsAction.cs @@ -77,7 +77,10 @@ public class UIToolsAction : IAction float.TryParse(wrongScore, out data.wrongScore); data.scoreStepName = scoreStepName; bool.TryParse(setActive, out data.SetActive); - float.TryParse(autoHide, out data.autoHideResult); + if (float.TryParse(autoHide, out data.autoHideResult) == false) + { + data.autoHideResult = -1; + } UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index ef5d8d0a..60208c0a 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -18,7 +18,6 @@ public class DeviceItem : MonoBehaviour var effect = gameObject.GetOrAddComponent(); gameObject.GetOrAddComponent(); effect.outlineColor = Color.green; - Debug.LogError("Regitser : " + gameObject.name); StringEventSystem.Global.Register(Global.HighLightTrigger, OnHighLightTriggerEvent); } if (device.MeshCollider) diff --git a/Assets/Scripts/UI/UIResultTip.cs b/Assets/Scripts/UI/UIResultTip.cs index 2683b674..cc99f611 100644 --- a/Assets/Scripts/UI/UIResultTip.cs +++ b/Assets/Scripts/UI/UIResultTip.cs @@ -59,7 +59,7 @@ namespace QFramework.Example ActionKit.Delay(mData.autoHideTime, () => { SetHide(); - }); + }).Start(this); } } diff --git a/Assets/Scripts/UI/UITextQuestion.cs b/Assets/Scripts/UI/UITextQuestion.cs index ea98985e..32e8715b 100644 --- a/Assets/Scripts/UI/UITextQuestion.cs +++ b/Assets/Scripts/UI/UITextQuestion.cs @@ -24,6 +24,10 @@ namespace QFramework.Example public string format; public string finishedEvent; /// + /// 0:自动判断 1:单选 2:多选 + /// + public int OptionType = 0; + /// /// 绝对的 不计算分项得分 对就得分 错就不得分 /// public bool absolutely = true; @@ -53,6 +57,23 @@ namespace QFramework.Example GameObject obj = GameObject.Instantiate(OptionPrefab.gameObject, OptionContent.transform); obj.transform.Find("Label").GetComponent().text = item; obj.name = (i + 1).ToString(); + bool isGroup = false; + switch (mData.OptionType) + { + case 0: + isGroup = mData.answers.Count == 1; + break; + case 1: + isGroup = true; + break; + case 2: + isGroup = false; + break; + } + if (isGroup) + { + obj.GetComponent().group = OptionContent.GetComponent(); + } } BtnContent.RemoveAllChildren(); diff --git a/Assets/Scripts/UI/UITools.cs b/Assets/Scripts/UI/UITools.cs index 7bc910a6..2cdba748 100644 --- a/Assets/Scripts/UI/UITools.cs +++ b/Assets/Scripts/UI/UITools.cs @@ -96,6 +96,7 @@ namespace QFramework.Example { StringEventSystem.Global.Send(mData.rightEvent); }; + data.autoHideTime = mData.autoHideResult; UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(); } } @@ -110,6 +111,7 @@ namespace QFramework.Example StringEventSystem.Global.Send(mData.wrongEvent); SetSelected(obj, false); }; + data.autoHideTime = mData.autoHideResult; UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().Start(this); } diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 2001a614..bb468c8a 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -517,6 +517,11 @@ namespace XMLTool { act.args.Add("finishedEvent", finishedEvent.Value); } + XAttribute optionType = action.Attribute("optionType"); + if (optionType != null) + { + act.args.Add("optionType", optionType.Value); + } newAction = act; } break; diff --git a/Doc/Xml閰嶇疆鏂囨。.xml b/Doc/Xml閰嶇疆鏂囨。.xml index 0298b50b..524ebaab 100644 --- a/Doc/Xml閰嶇疆鏂囨。.xml +++ b/Doc/Xml閰嶇疆鏂囨。.xml @@ -61,8 +61,9 @@ format="{0:F1}" F1浠h〃淇濈暀1浣嶅皬鏁 F2浠h〃2浣 F0浠h〃涓嶄繚鐣欏皬鏁 娉ㄦ剰锛歳ightScore涓巜rongScore涓嶈兘鍚屾椂瀛樺湪 鍚屾椂瀛樺湪鍒欏彧鐢熸晥rightScore finishedEvent 鐢ㄤ簬鐩戝惉閫夋嫨棰楿I娑堝け + optionType 0 鏍规嵁绛旀鏁伴噺鑷姩鍒ゆ柇鍗曢夎繕鏄閫 1 鍗曢 2澶氶 --> - +