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..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..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..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..95844c54 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 @@ -23,39 +23,54 @@ wrongLabel="" finishedEvent="鍏ㄩ儴瀹屾垚" rightBg="baoshi/鑳屾櫙鍥.png"> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + @@ -67,7 +82,7 @@ - - - + + + \ No newline at end of file