diff --git a/Assets/Art/UIPrefab/UITextQuestion.prefab b/Assets/Art/UIPrefab/UITextQuestion.prefab index 2345b8ea..1d3e039b 100644 --- a/Assets/Art/UIPrefab/UITextQuestion.prefab +++ b/Assets/Art/UIPrefab/UITextQuestion.prefab @@ -122,6 +122,157 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: [] +--- !u!1 &1421359348001069859 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8258785922237481627} + - component: {fileID: 5541531973927547524} + - component: {fileID: 5421419062846475919} + - component: {fileID: 2812006979516291810} + m_Layer: 5 + m_Name: Des + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8258785922237481627 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1421359348001069859} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2509629627698566919} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5541531973927547524 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1421359348001069859} + m_CullTransparentMesh: 1 +--- !u!114 &5421419062846475919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1421359348001069859} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 1 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: e7da174c677019b49aa681250aa4ded8, type: 2} + m_sharedMaterial: {fileID: -7878122246201655599, guid: e7da174c677019b49aa681250aa4ded8, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &2812006979516291810 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1421359348001069859} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: + CustomComment: + mComponentName: TMPro.TextMeshProUGUI --- !u!1 &1564041369283421511 GameObject: m_ObjectHideFlags: 0 @@ -403,6 +554,7 @@ RectTransform: m_Children: - {fileID: 6739641498610695016} - {fileID: 8818801742622154618} + - {fileID: 8258785922237481627} - {fileID: 561093864464523440} m_Father: {fileID: 5056252797064041554} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -691,6 +843,7 @@ MonoBehaviour: m_EditorClassIdentifier: Title: {fileID: 5287111216189064539} OptionContent: {fileID: 3206335665978531065} + Des: {fileID: 5421419062846475919} BtnContent: {fileID: 561093864464523440} BtnPrefab: {fileID: 3495757393179336855} OptionPrefab: {fileID: 4836612527177548046} diff --git a/Assets/Scripts/Actions/TextQuestionAction.cs b/Assets/Scripts/Actions/TextQuestionAction.cs index a116d865..da2893b0 100644 --- a/Assets/Scripts/Actions/TextQuestionAction.cs +++ b/Assets/Scripts/Actions/TextQuestionAction.cs @@ -26,6 +26,8 @@ public class TextQuestionAction : IAction string absolutely = string.Empty; string finishedEvent = string.Empty; string optionType = null; + string des; + string cellSize; public static TextQuestionAction Allocate(Dictionary datas, System.Action onDelayFinish = null) { var retNode = mPool.Allocate(); @@ -44,6 +46,8 @@ public class TextQuestionAction : IAction 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"; + retNode.des = datas.ContainsKey("des") ? datas["des"] : string.Empty; + retNode.cellSize = datas.ContainsKey("cellSize") ? datas["cellSize"] : string.Empty; return retNode; } @@ -87,6 +91,8 @@ public class TextQuestionAction : IAction bool.TryParse(absolutely, out data.absolutely); } int.TryParse(optionType, out data.OptionType); + data.des = des; + data.cellSize = cellSize; UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish()); } diff --git a/Assets/Scripts/UI/UITextQuestion.Designer.cs b/Assets/Scripts/UI/UITextQuestion.Designer.cs index 320d6c25..005827da 100644 --- a/Assets/Scripts/UI/UITextQuestion.Designer.cs +++ b/Assets/Scripts/UI/UITextQuestion.Designer.cs @@ -5,7 +5,7 @@ using QFramework; namespace QFramework.Example { - // Generate Id:32288864-cf64-4f8d-82e1-661c04d7b98d + // Generate Id:d5266ca7-b00f-4538-9dbd-ab80bcacd960 public partial class UITextQuestion { public const string Name = "UITextQuestion"; @@ -15,6 +15,8 @@ namespace QFramework.Example [SerializeField] public UnityEngine.UI.ToggleGroup OptionContent; [SerializeField] + public TMPro.TextMeshProUGUI Des; + [SerializeField] public RectTransform BtnContent; [SerializeField] public UnityEngine.UI.Button BtnPrefab; @@ -27,6 +29,7 @@ namespace QFramework.Example { Title = null; OptionContent = null; + Des = null; BtnContent = null; BtnPrefab = null; OptionPrefab = null; diff --git a/Assets/Scripts/UI/UITextQuestion.cs b/Assets/Scripts/UI/UITextQuestion.cs index 32e8715b..56c226dc 100644 --- a/Assets/Scripts/UI/UITextQuestion.cs +++ b/Assets/Scripts/UI/UITextQuestion.cs @@ -4,8 +4,6 @@ using QFramework; using System.Collections.Generic; using TMPro; using System; -using Microsoft.SqlServer.Server; -using XMLTool; using static OperationController; namespace QFramework.Example @@ -23,6 +21,8 @@ namespace QFramework.Example public string scoreName = string.Empty; public string format; public string finishedEvent; + public string des; + public string cellSize; /// /// 0:自动判断 1:单选 2:多选 /// @@ -49,8 +49,13 @@ namespace QFramework.Example { TypeEventSystem.Global.Register(OnStepChanged).UnRegisterWhenDisabled(gameObject); mData = uiData as UITextQuestionData ?? new UITextQuestionData(); + Des.text = string.Empty; Title.text = mData.title; OptionContent.transform.RemoveAllChildren(); + if (string.IsNullOrEmpty(mData.cellSize) == false) + { + OptionContent.GetComponent().cellSize = Utility.GetVector2FromStrArray(mData.cellSize); + } for (int i = 0; i < mData.options.Count; i++) { var item = mData.options[i]; @@ -85,6 +90,11 @@ namespace QFramework.Example label.text = item; obj.GetComponent