diff --git a/Assets/Art/UIPrefab/UIImageSelectMap.prefab b/Assets/Art/UIPrefab/UIImageSelectMap.prefab index 805c76f9..615bb0c4 100644 --- a/Assets/Art/UIPrefab/UIImageSelectMap.prefab +++ b/Assets/Art/UIPrefab/UIImageSelectMap.prefab @@ -1,5 +1,80 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &420915011696631178 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8326800272042336731} + - component: {fileID: 6107971669464005120} + - component: {fileID: 4530685853539565497} + m_Layer: 0 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &8326800272042336731 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420915011696631178} + 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: 3838833872239473580} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6107971669464005120 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420915011696631178} + m_CullTransparentMesh: 1 +--- !u!114 &4530685853539565497 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420915011696631178} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.49019608} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 3a00983ef5623fc408efcbb92a4907c3, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &1679127656931134385 GameObject: m_ObjectHideFlags: 0 @@ -201,6 +276,7 @@ RectTransform: m_Children: - {fileID: 5065642014798611877} - {fileID: 5789014425176515348} + - {fileID: 2384854260534447799} m_Father: {fileID: 3838833872239473580} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -609,6 +685,87 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4297888628195360501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2384854260534447799} + - component: {fileID: 6878953297277512979} + - component: {fileID: 4923610157131028843} + m_Layer: 0 + m_Name: RightRowItem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2384854260534447799 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4297888628195360501} + 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: + - {fileID: 3699429185161834239} + - {fileID: 4622332512113673803} + m_Father: {fileID: 8333043509333940129} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 682.5, y: -258.005} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6878953297277512979 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4297888628195360501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 7 + m_Right: 0 + m_Top: 11 + m_Bottom: 0 + m_ChildAlignment: 3 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &4923610157131028843 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4297888628195360501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3} + m_Name: + m_EditorClassIdentifier: + MarkType: 0 + CustomComponentName: + CustomComment: + mComponentName: RectTransform --- !u!1 &4335887278641882288 GameObject: m_ObjectHideFlags: 0 @@ -643,7 +800,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.00026443074} + m_AnchoredPosition: {x: 0, y: 0.00008012653} m_SizeDelta: {x: 0, y: 300} m_Pivot: {x: 0, y: 1} --- !u!114 &1181747651547168674 @@ -930,10 +1087,10 @@ RectTransform: - {fileID: 2525946039026654729} m_Father: {fileID: 5456883306320455666} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 54.5, y: -43.227} - m_SizeDelta: {x: -109, y: 825.55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -41} + m_SizeDelta: {x: 0, y: -82} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8240270928057047746 CanvasRenderer: @@ -1405,6 +1562,140 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7083257630504421323 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3699429185161834239} + - component: {fileID: 5893562227153965747} + - component: {fileID: 5217902973505947583} + m_Layer: 0 + m_Name: Type + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3699429185161834239 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7083257630504421323} + 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: 2384854260534447799} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 57.345, y: -55.5} + m_SizeDelta: {x: 100.69, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5893562227153965747 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7083257630504421323} + m_CullTransparentMesh: 1 +--- !u!114 &5217902973505947583 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7083257630504421323} + 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: "\u7EA2\u8272\n(\u7C89\u7EA2)" + 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: 20 + m_fontSizeBase: 20 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + 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!1 &7280130670105602612 GameObject: m_ObjectHideFlags: 0 @@ -1702,7 +1993,7 @@ GameObject: m_Component: - component: {fileID: 6690386520824484871} - component: {fileID: 3568317990091449983} - - component: {fileID: 4721484481571440914} + - component: {fileID: 6675129178853890596} m_Layer: 0 m_Name: RightContent m_TagString: Untagged @@ -1726,7 +2017,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.0008044916} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 300} m_Pivot: {x: 0, y: 1} --- !u!114 &3568317990091449983 @@ -1745,7 +2036,7 @@ MonoBehaviour: CustomComponentName: RightContent CustomComment: mComponentName: RectTransform ---- !u!114 &4721484481571440914 +--- !u!114 &6675129178853890596 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1754,21 +2045,23 @@ MonoBehaviour: m_GameObject: {fileID: 7814570042150248306} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 0 m_Right: 0 - m_Top: 6 + m_Top: 0 m_Bottom: 0 m_ChildAlignment: 0 - m_StartCorner: 0 - m_StartAxis: 0 - m_CellSize: {x: 259, y: 101} - m_Spacing: {x: 15, y: 33} - m_Constraint: 0 - m_ConstraintCount: 2 + m_Spacing: 37.34 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &8228266746100192071 GameObject: m_ObjectHideFlags: 0 @@ -1890,7 +2183,7 @@ MonoBehaviour: m_HandleRect: {fileID: 6608813160943937009} m_Direction: 2 m_Value: 0 - m_Size: 0.99999845 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -2080,6 +2373,7 @@ RectTransform: - {fileID: 4103523224226093892} - {fileID: 5456883306320455666} - {fileID: 8333043509333940129} + - {fileID: 8326800272042336731} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -2100,9 +2394,70 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: LeftContent: {fileID: 6336473892143704609} + RightContent: {fileID: 6690386520824484871} LeftItem: {fileID: 5092658527967839279} RightItem: {fileID: 6234933970462649390} - RightContent: {fileID: 6690386520824484871} + RightRowItem: {fileID: 2384854260534447799} +--- !u!1 &8826357253905085134 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4622332512113673803} + - component: {fileID: 6872678762459959806} + m_Layer: 0 + m_Name: Items + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4622332512113673803 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8826357253905085134} + 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: 2384854260534447799} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 107.69006, y: -5.499988} + m_SizeDelta: {x: 1082.7339, y: 100} + m_Pivot: {x: 0.000000053085387, y: 1.0000001} +--- !u!114 &6872678762459959806 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8826357253905085134} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 6 + m_Bottom: 0 + m_ChildAlignment: 0 + m_StartCorner: 0 + m_StartAxis: 0 + m_CellSize: {x: 259, y: 101} + m_Spacing: {x: 15, y: 33} + m_Constraint: 0 + m_ConstraintCount: 2 --- !u!1 &8929218626034367534 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Actions/ActionBase.cs b/Assets/Scripts/Actions/ActionBase.cs index 4d182f14..5547fcfb 100644 --- a/Assets/Scripts/Actions/ActionBase.cs +++ b/Assets/Scripts/Actions/ActionBase.cs @@ -25,6 +25,12 @@ namespace XMLTool public class ImageSelectMapAction : Action { + public class Row + { + public string name = ""; + public List items = new List(); + + } public class Item { public string pic; @@ -32,7 +38,7 @@ namespace XMLTool } public Dictionary args = new Dictionary(); - public List items = new List(); + public List rows = new List(); } diff --git a/Assets/Scripts/Actions/ActionHelper.cs b/Assets/Scripts/Actions/ActionHelper.cs index 3ee97089..11e81a58 100644 --- a/Assets/Scripts/Actions/ActionHelper.cs +++ b/Assets/Scripts/Actions/ActionHelper.cs @@ -286,7 +286,7 @@ public class ActionHelper case "ImageSelectMap": { var dictAction = (XMLTool.ImageSelectMapAction)act; - return QFramework.ImageSelectMapAction.Allocate(dictAction.args,dictAction.items); + return QFramework.ImageSelectMapAction.Allocate(dictAction.args,dictAction.rows); } default: Debug.LogError($"没有找到此Action的类型{act.Type}"); diff --git a/Assets/Scripts/Actions/ImageSelectMapAction.cs b/Assets/Scripts/Actions/ImageSelectMapAction.cs index 04280fa1..281d0934 100644 --- a/Assets/Scripts/Actions/ImageSelectMapAction.cs +++ b/Assets/Scripts/Actions/ImageSelectMapAction.cs @@ -21,14 +21,14 @@ namespace QFramework private static readonly SimpleObjectPool mPool = new SimpleObjectPool(() => new ImageSelectMapAction(), null, 10); Dictionary datas; - List items; - public static ImageSelectMapAction Allocate(Dictionary datas, List items, System.Action OnFinished = null) + List rows; + public static ImageSelectMapAction Allocate(Dictionary datas, List rows, System.Action OnFinished = null) { var retNode = mPool.Allocate(); retNode.ActionID = ActionKit.ID_GENERATOR++; retNode.Deinited = false; retNode.datas = datas; - retNode.items = items; + retNode.rows = rows; retNode.Reset(); retNode.OnFinished = OnFinished; return retNode; @@ -70,13 +70,19 @@ namespace QFramework data.random = false; } - foreach (var item in items) + foreach (var rowItem in rows) { - data.items.Add(new UIImageSelectMapData.OptionItem() + var row = new UIImageSelectMapData.Row(); + row.name = rowItem.name; + data.rows.Add(row); + foreach (var item in rowItem.items) { - pic = item.pic, - name = item.name - }); + row.items.Add(new UIImageSelectMapData.OptionItem() + { + pic = item.pic, + name = item.name + }); + } } UIKit.OpenPanelAsync(uiData: data).ToAction().StartGlobal(() => diff --git a/Assets/Scripts/UI/UIImageSelectMap.Designer.cs b/Assets/Scripts/UI/UIImageSelectMap.Designer.cs index 1775c1de..a9d9ebf0 100644 --- a/Assets/Scripts/UI/UIImageSelectMap.Designer.cs +++ b/Assets/Scripts/UI/UIImageSelectMap.Designer.cs @@ -5,7 +5,7 @@ using QFramework; namespace QFramework.Example { - // Generate Id:b499f0f9-a71b-40ff-a499-a5e4defad39f + // Generate Id:ee191ed8-359d-4628-aa2b-d1711157540d public partial class UIImageSelectMap { public const string Name = "UIImageSelectMap"; @@ -13,20 +13,23 @@ namespace QFramework.Example [SerializeField] public RectTransform LeftContent; [SerializeField] + public RectTransform RightContent; + [SerializeField] public UnityEngine.UI.Image LeftItem; [SerializeField] public UnityEngine.UI.Image RightItem; [SerializeField] - public RectTransform RightContent; + public RectTransform RightRowItem; private UIImageSelectMapData mPrivateData = null; protected override void ClearUIComponents() { LeftContent = null; + RightContent = null; LeftItem = null; RightItem = null; - RightContent = null; + RightRowItem = null; mData = null; } diff --git a/Assets/Scripts/UI/UIImageSelectMap.cs b/Assets/Scripts/UI/UIImageSelectMap.cs index 7508b7d9..2bddaf07 100644 --- a/Assets/Scripts/UI/UIImageSelectMap.cs +++ b/Assets/Scripts/UI/UIImageSelectMap.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using UnityEngine.EventSystems; using System; using TMPro; +using System.Xml; namespace QFramework.Example { @@ -15,6 +16,11 @@ namespace QFramework.Example public string pic; public string name; } + public class Row + { + public string name; + public List items = new List(); + } public string scoreName; public float totalScore; public float rightScore; @@ -23,7 +29,7 @@ namespace QFramework.Example public string wrongLabel; public string finishedEvent; public bool random = false; - public List items = new List(); + public List rows = new List(); } public partial class UIImageSelectMap : UIPanel @@ -57,31 +63,39 @@ namespace QFramework.Example RightContent.RemoveAllChildren(); itemDatas.Clear(); leftAndRightMap.Clear(); - foreach (var item in mData.items) + + foreach (var row in mData.rows) { - var leftObj = GameObject.Instantiate(LeftItem, LeftContent); - leftObj.name = item.pic; - var path = Global.imagePath + item.pic; - loader.Add2Load(path.ToNetImageResName(), (success, res) => + GameObject rowObj = GameObject.Instantiate(RightRowItem.gameObject, RightContent); + rowObj.transform.Find("Type").GetComponent().text = row.name.Replace("\\n", "\n"); + Transform itemContent = rowObj.transform.Find("Items"); + foreach (var item in row.items) { - if (success) + var rightObj = GameObject.Instantiate(RightItem, itemContent); + rightObj.name = item.pic; + rightObj.transform.Find("PicBg/Pic").GetComponent().color = new Color(1, 1, 1, 0); + rightObj.OnPointerEnterEvent(RightOnEnter); + rightObj.OnPointerExitEvent(RightOnExit); + rightObj.OnPointerClickEvent(RightOnClick); + + var leftObj = GameObject.Instantiate(LeftItem, LeftContent); + leftObj.name = item.pic; + var path = Global.imagePath + item.pic; + loader.Add2Load(path.ToNetImageResName(), (success, res) => { - leftObj.GetComponent().sprite = Utility.GetSprite(res.Asset as Texture2D); - } - }); + if (success) + { + leftObj.GetComponent().sprite = Utility.GetSprite(res.Asset as Texture2D); + } + }); - leftObj.OnBeginDragEvent(LeftOnBeginDrag); - leftObj.OnDragEvent(LeftOnDrag); - leftObj.OnEndDragEvent(LeftOnEndDrag); - itemDatas.Add(leftObj.gameObject, item); - - var rightObj = GameObject.Instantiate(RightItem, RightContent); - rightObj.name = item.pic; - rightObj.transform.Find("PicBg/Pic").GetComponent().color = new Color(1, 1, 1, 0); - rightObj.OnPointerEnterEvent(RightOnEnter); - rightObj.OnPointerExitEvent(RightOnExit); - rightObj.OnPointerClickEvent(RightOnClick); + leftObj.OnBeginDragEvent(LeftOnBeginDrag); + leftObj.OnDragEvent(LeftOnDrag); + leftObj.OnEndDragEvent(LeftOnEndDrag); + itemDatas.Add(leftObj.gameObject, item); + } } + if (mData.random) { Utility.ShuffleChildObjects(LeftContent); @@ -183,7 +197,7 @@ namespace QFramework.Example return false; } } - return leftAndRightMap.Count == mData.items.Count; + return leftAndRightMap.Count == itemDatas.Count; } private void LeftOnDrag(PointerEventData data) diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 914bc032..3c818702 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -1718,13 +1718,20 @@ namespace XMLTool { act.args.Add("random", random.Value); } - foreach (var itemData in action.Elements("Item")) + + foreach (var rowData in action.Elements("Row")) { - act.items.Add(new ImageSelectMapAction.Item() + var row = new ImageSelectMapAction.Row(); + row.name = rowData.Attribute("name")?.Value; + act.rows.Add(row); + foreach (var itemData in rowData.Elements("Item")) { - pic = itemData.Attribute("pic")?.Value, - name = itemData.Attribute("name")?.Value - }); + row.items.Add(new ImageSelectMapAction.Item() + { + pic = itemData.Attribute("pic")?.Value, + name = itemData.Attribute("name")?.Value + }); + } } newAction = act; } diff --git a/Data/Image/yushi/涔岄浮绉嶇俊缈.png b/Data/Image/yushi/涔岄浮绉嶇俊缈.png new file mode 100644 index 00000000..4a2bfbf7 Binary files /dev/null and b/Data/Image/yushi/涔岄浮绉嶇俊缈.png differ diff --git a/Data/Image/yushi/淇勬枡鐧界帀.png b/Data/Image/yushi/淇勬枡鐧界帀.png new file mode 100644 index 00000000..fade13e4 Binary files /dev/null and b/Data/Image/yushi/淇勬枡鐧界帀.png differ diff --git a/Data/Image/yushi/鍐扮鐧界俊.png b/Data/Image/yushi/鍐扮鐧界俊.png new file mode 100644 index 00000000..ef9770a1 Binary files /dev/null and b/Data/Image/yushi/鍐扮鐧界俊.png differ diff --git a/Data/Image/yushi/鍜岀敯鐜(鐑熺传鐜).png b/Data/Image/yushi/鍜岀敯鐜(鐑熺传鐜).png new file mode 100644 index 00000000..b8ddc924 Binary files /dev/null and b/Data/Image/yushi/鍜岀敯鐜(鐑熺传鐜).png differ diff --git a/Data/Image/yushi/鍜岀敯鐜(榛勫彛鏂).png b/Data/Image/yushi/鍜岀敯鐜(榛勫彛鏂).png new file mode 100644 index 00000000..e5e213ca Binary files /dev/null and b/Data/Image/yushi/鍜岀敯鐜(榛勫彛鏂).png differ diff --git a/Data/Image/yushi/澧ㄧ帀(閫忓厜闈).png b/Data/Image/yushi/澧ㄧ帀(閫忓厜闈).png new file mode 100644 index 00000000..a46f726f Binary files /dev/null and b/Data/Image/yushi/澧ㄧ帀(閫忓厜闈).png differ diff --git a/Data/Image/yushi/澧ㄧ繝(閫忓厜缁).png b/Data/Image/yushi/澧ㄧ繝(閫忓厜缁).png new file mode 100644 index 00000000..357ea618 Binary files /dev/null and b/Data/Image/yushi/澧ㄧ繝(閫忓厜缁).png differ diff --git a/Data/Image/yushi/澶╃劧绾㈢俊.png b/Data/Image/yushi/澶╃劧绾㈢俊.png new file mode 100644 index 00000000..47eef6a6 Binary files /dev/null and b/Data/Image/yushi/澶╃劧绾㈢俊.png differ diff --git a/Data/Image/yushi/甯濈帇缁.png b/Data/Image/yushi/甯濈帇缁.png new file mode 100644 index 00000000..da7a7bec Binary files /dev/null and b/Data/Image/yushi/甯濈帇缁.png differ diff --git a/Data/Image/yushi/鏄ュ甫褰╃俊缈.png b/Data/Image/yushi/鏄ュ甫褰╃俊缈.png new file mode 100644 index 00000000..64654bef Binary files /dev/null and b/Data/Image/yushi/鏄ュ甫褰╃俊缈.png differ diff --git a/Data/Image/yushi/鏌ョ綏鐭(绱緳鏅).png b/Data/Image/yushi/鏌ョ綏鐭(绱緳鏅).png new file mode 100644 index 00000000..eec4ee0a Binary files /dev/null and b/Data/Image/yushi/鏌ョ綏鐭(绱緳鏅).png differ diff --git a/Data/Image/yushi/鐑х孩缈$繝.png b/Data/Image/yushi/鐑х孩缈$繝.png new file mode 100644 index 00000000..f6be9b93 Binary files /dev/null and b/Data/Image/yushi/鐑х孩缈$繝.png differ diff --git a/Data/Image/yushi/纰х帀.png b/Data/Image/yushi/纰х帀.png new file mode 100644 index 00000000..3b54cc46 Binary files /dev/null and b/Data/Image/yushi/纰х帀.png differ diff --git a/Data/Image/yushi/绯栫帀.png b/Data/Image/yushi/绯栫帀.png new file mode 100644 index 00000000..9b327c1e Binary files /dev/null and b/Data/Image/yushi/绯栫帀.png differ diff --git a/Data/Image/yushi/绯鐧界俊.png b/Data/Image/yushi/绯鐧界俊.png new file mode 100644 index 00000000..2a94099a Binary files /dev/null and b/Data/Image/yushi/绯鐧界俊.png differ diff --git a/Data/Image/yushi/绱繝.png b/Data/Image/yushi/绱繝.png new file mode 100644 index 00000000..e7653584 Binary files /dev/null and b/Data/Image/yushi/绱繝.png differ diff --git a/Data/Image/yushi/绾㈡瞾绫芥枡.png b/Data/Image/yushi/绾㈡瞾绫芥枡.png new file mode 100644 index 00000000..57507b2c Binary files /dev/null and b/Data/Image/yushi/绾㈡瞾绫芥枡.png differ diff --git a/Data/Image/yushi/绾㈢硸鐜.png b/Data/Image/yushi/绾㈢硸鐜.png new file mode 100644 index 00000000..a8fba197 Binary files /dev/null and b/Data/Image/yushi/绾㈢硸鐜.png differ diff --git a/Data/Image/yushi/缇婅剛鐧界帀.png b/Data/Image/yushi/缇婅剛鐧界帀.png new file mode 100644 index 00000000..0c211f4b Binary files /dev/null and b/Data/Image/yushi/缇婅剛鐧界帀.png differ diff --git a/Data/Image/yushi/缈$繝(榛勫姞缁).png b/Data/Image/yushi/缈$繝(榛勫姞缁).png new file mode 100644 index 00000000..f6efbedf Binary files /dev/null and b/Data/Image/yushi/缈$繝(榛勫姞缁).png differ diff --git a/Data/Image/yushi/闃崇豢.png b/Data/Image/yushi/闃崇豢.png new file mode 100644 index 00000000..bb4eb2b6 Binary files /dev/null and b/Data/Image/yushi/闃崇豢.png differ diff --git a/Data/Image/yushi/闈掔帀.png b/Data/Image/yushi/闈掔帀.png new file mode 100644 index 00000000..b7daa43f Binary files /dev/null and b/Data/Image/yushi/闈掔帀.png differ diff --git a/Data/Image/yushi/榛勭俊.png b/Data/Image/yushi/榛勭俊.png new file mode 100644 index 00000000..b96fe270 Binary files /dev/null and b/Data/Image/yushi/榛勭俊.png differ diff --git a/Data/Image/yushi/榛戦潚鐜.png b/Data/Image/yushi/榛戦潚鐜.png new file mode 100644 index 00000000..4cc315d6 Binary files /dev/null and b/Data/Image/yushi/榛戦潚鐜.png differ diff --git a/Data/Xml/13BaoShiFenLei.xml b/Data/Xml/13BaoShiFenLei.xml index 487348d9..ca06322c 100644 --- a/Data/Xml/13BaoShiFenLei.xml +++ b/Data/Xml/13BaoShiFenLei.xml @@ -2,11 +2,11 @@ - 1鎶樺皠浠.png - ZheSheYiScene - All - 瀹濈煶鍒嗙被 - true + 1鎶樺皠浠.png + ZheSheYiScene + All + 瀹濈煶鍒嗙被 + true @@ -21,41 +21,55 @@ wrongScore="" rightLabel="" wrongLabel="" - finishedEvent="鍏ㄩ儴瀹屾垚" - rightBg="baoshi/鑳屾櫙鍥.png"> - - - - - - - - - - - - - - - - - - - - - - - - + finishedEvent="鍏ㄩ儴瀹屾垚"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + @@ -67,7 +81,7 @@ - - - + + + \ No newline at end of file diff --git a/Data/Xml/14YuShiFenLei.xml b/Data/Xml/14YuShiFenLei.xml index b648db00..2771ab9d 100644 --- a/Data/Xml/14YuShiFenLei.xml +++ b/Data/Xml/14YuShiFenLei.xml @@ -7,48 +7,64 @@ All 鐜夌煶鍒嗙被 true + - - - - - - - - - - - - - - - - - - - - - - - - + finishedEvent="鍏ㄩ儴瀹屾垚"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -63,4 +79,6 @@ + + \ No newline at end of file