diff --git a/Assets/Art/UIPrefab/UIImageSelectMap.prefab b/Assets/Art/UIPrefab/UIImageSelectMap.prefab index c823ebce..805c76f9 100644 --- a/Assets/Art/UIPrefab/UIImageSelectMap.prefab +++ b/Assets/Art/UIPrefab/UIImageSelectMap.prefab @@ -643,7 +643,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.000007495649} + m_AnchoredPosition: {x: 0, y: 0.00026443074} m_SizeDelta: {x: 0, y: 300} m_Pivot: {x: 0, y: 1} --- !u!114 &1181747651547168674 @@ -1347,7 +1347,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &124795435256669180 RectTransform: m_ObjectHideFlags: 0 @@ -1437,10 +1437,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 3838833872239473580} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 100, y: 100} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3798398430471671831 CanvasRenderer: @@ -1470,7 +1470,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 0} + m_Sprite: {fileID: 21300000, guid: cc9edef0c7d8eb54a84077129a9351a8, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -1890,7 +1890,7 @@ MonoBehaviour: m_HandleRect: {fileID: 6608813160943937009} m_Direction: 2 m_Value: 0 - m_Size: 1 + m_Size: 0.99999845 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: diff --git a/Assets/Art/UITextures/UIImageSelectMap/背景.png b/Assets/Art/UITextures/UIImageSelectMap/背景.png new file mode 100644 index 00000000..6dc8d780 Binary files /dev/null and b/Assets/Art/UITextures/UIImageSelectMap/背景.png differ diff --git a/Assets/Art/UITextures/UIImageSelectMap/背景.png.meta b/Assets/Art/UITextures/UIImageSelectMap/背景.png.meta new file mode 100644 index 00000000..203b6a70 --- /dev/null +++ b/Assets/Art/UITextures/UIImageSelectMap/背景.png.meta @@ -0,0 +1,179 @@ +fileFormatVersion: 2 +guid: cc9edef0c7d8eb54a84077129a9351a8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 2 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/QFramework/Toolkits/_CoreKit/ActionKit/Scripts/Utility/Utility.cs b/Assets/QFramework/Toolkits/_CoreKit/ActionKit/Scripts/Utility/Utility.cs index 359c8d97..97e67a82 100644 --- a/Assets/QFramework/Toolkits/_CoreKit/ActionKit/Scripts/Utility/Utility.cs +++ b/Assets/QFramework/Toolkits/_CoreKit/ActionKit/Scripts/Utility/Utility.cs @@ -423,4 +423,34 @@ public class Utility list[j] = temp; } } + + + // 该方法用于打乱当前脚本所挂载物体的子物体顺序 + public static void ShuffleChildObjects(Transform parent) + { + List children = new List(); + + for (int i = 0; i < parent.childCount; i++) + { + children.Add(parent.GetChild(i)); + } + + // 打乱子物体数组的顺序 + for (int i = 0; i < children.Count; i++) + { + int randomIndex = UnityEngine.Random.Range(i, children.Count); + Transform temp = children[randomIndex]; + children[randomIndex] = children[i]; + children[i] = temp; + } + + // 按照打乱后的顺序重新设置子物体的顺序 + for (int i = 0; i < children.Count; i++) + { + children[i].SetSiblingIndex(i); + } + } + + + } \ No newline at end of file diff --git a/Assets/Scripts/Actions/ImageSelectMapAction.cs b/Assets/Scripts/Actions/ImageSelectMapAction.cs index 1cdd8590..04280fa1 100644 --- a/Assets/Scripts/Actions/ImageSelectMapAction.cs +++ b/Assets/Scripts/Actions/ImageSelectMapAction.cs @@ -61,6 +61,14 @@ namespace QFramework data.rightLabel = datas.ContainsKey("rightLabel") ? datas["rightLabel"] : ""; data.wrongLabel = datas.ContainsKey("wrongLabel") ? datas["wrongLabel"] : ""; data.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : ""; + if (datas.ContainsKey("random")) + { + bool.TryParse(datas["random"], out data.random); + } + else + { + data.random = false; + } foreach (var item in items) { @@ -71,7 +79,7 @@ namespace QFramework }); } - UIKit.OpenPanelAsync(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => + UIKit.OpenPanelAsync(uiData: data).ToAction().StartGlobal(() => { this.Finish(); diff --git a/Assets/Scripts/UI/UIImageSelectMap.cs b/Assets/Scripts/UI/UIImageSelectMap.cs index f320249c..7508b7d9 100644 --- a/Assets/Scripts/UI/UIImageSelectMap.cs +++ b/Assets/Scripts/UI/UIImageSelectMap.cs @@ -22,20 +22,30 @@ namespace QFramework.Example public string rightLabel; public string wrongLabel; public string finishedEvent; + public bool random = false; public List items = new List(); } public partial class UIImageSelectMap : UIPanel { + /// + /// Ҳݽṹ + /// + class RightDataItem + { + public GameObject rightObj; + public bool isRight = false; + } ResLoader loader; GameObject moveObj; GameObject enterRight; GameObject leftDragObj; Dictionary itemDatas = new Dictionary(); - Dictionary leftAndRightMap = new Dictionary(); + Dictionary leftAndRightMap = new Dictionary(); protected override void OnInit(IUIData uiData = null) { mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData(); + TypeEventSystem.Global.Register(OnModuleQuitHandler); // please add init code here loader = ResLoader.Allocate(); } @@ -43,7 +53,6 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData(); - LeftContent.RemoveAllChildren(); RightContent.RemoveAllChildren(); itemDatas.Clear(); @@ -73,7 +82,10 @@ namespace QFramework.Example rightObj.OnPointerExitEvent(RightOnExit); rightObj.OnPointerClickEvent(RightOnClick); } - + if (mData.random) + { + Utility.ShuffleChildObjects(LeftContent); + } loader.LoadAsync(); @@ -81,12 +93,17 @@ namespace QFramework.Example } + private void OnModuleQuitHandler(OnModuleQuit quit) + { + Hide(); + } + private void RightOnClick(PointerEventData data) { Transform trans = data.pointerClick.transform; if (leftAndRightMap.ContainsKey(trans.gameObject)) { - leftAndRightMap[trans.gameObject].SetActive(true); + leftAndRightMap[trans.gameObject].rightObj.SetActive(true); trans.GetComponent().color = Color.white; trans.Find("PicBg/Pic").GetComponent().color = new Color(1, 1, 1, 0); @@ -124,26 +141,51 @@ namespace QFramework.Example if (enterRight && leftAndRightMap.ContainsKey(enterRight) == false) { TextMeshProUGUI nameText = enterRight.transform.Find("Name").GetComponent(); + bool isRight = false; if (enterRight.name == itemDatas[leftDragObj].pic) { nameText.color = Color.green; + isRight = true; + } else { nameText.color = Color.red; + } Image img = enterRight.transform.Find("PicBg/Pic").GetComponent(); img.sprite = moveObj.GetComponent().sprite; img.color = Color.white; nameText.text = itemDatas[leftDragObj].name; - leftAndRightMap.Add(enterRight, leftDragObj); + leftAndRightMap.Add(enterRight, new RightDataItem() { rightObj = leftDragObj, isRight = isRight }); leftDragObj.SetActive(false); + + if (isRight && Check()) + { + if (string.IsNullOrEmpty(mData.finishedEvent) == false) + { + StringEventSystem.Global.Send(mData.finishedEvent); + } + } + } GameObject.Destroy(moveObj); moveObj = null; leftDragObj = null; } + public bool Check() + { + foreach (var item in leftAndRightMap) + { + if (item.Value.isRight == false) + { + return false; + } + } + return leftAndRightMap.Count == mData.items.Count; + } + private void LeftOnDrag(PointerEventData data) { //data.pointerDrag.transform.position = Input.mousePosition; @@ -164,6 +206,7 @@ namespace QFramework.Example protected override void OnClose() { + TypeEventSystem.Global.UnRegister(OnModuleQuitHandler); } } } diff --git a/Assets/Scripts/UI/UIModuleSelect.cs b/Assets/Scripts/UI/UIModuleSelect.cs index f2979dc4..a4f6f688 100644 --- a/Assets/Scripts/UI/UIModuleSelect.cs +++ b/Assets/Scripts/UI/UIModuleSelect.cs @@ -59,7 +59,7 @@ namespace QFramework.Example SceneManager.sceneLoaded += OnLoadFinished; }); }); - if (string.IsNullOrEmpty(item.Icon)==false) + if (string.IsNullOrEmpty(item.Icon) == false) { var icon = obj.transform.Find("Icon").GetComponent(); var localImageUrl = Global.imagePath + item.Icon; @@ -129,7 +129,7 @@ namespace QFramework.Example { var machin = StateMachineController.Instance; } - UIKit.OpenPanelAsync().ToAction().StartGlobal(() => + UIKit.OpenPanelAsync(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => { TypeEventSystem.Global.Send(); diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index a60186f5..914bc032 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -1713,6 +1713,11 @@ namespace XMLTool { act.args.Add("rightBg", rightBg.Value); } + XAttribute random = action.Attribute("random"); + if (random != null) + { + act.args.Add("random", random.Value); + } foreach (var itemData in action.Elements("Item")) { act.items.Add(new ImageSelectMapAction.Item() diff --git a/Data/Image/baoshi/发晶(无色).png b/Data/Image/baoshi/发晶(无色).png index 320e3677..3b902f2d 100644 Binary files a/Data/Image/baoshi/发晶(无色).png and b/Data/Image/baoshi/发晶(无色).png differ diff --git a/Data/Image/baoshi/合成尖晶石.png b/Data/Image/baoshi/合成尖晶石.png index 64c97aef..82bd4216 100644 Binary files a/Data/Image/baoshi/合成尖晶石.png and b/Data/Image/baoshi/合成尖晶石.png differ diff --git a/Data/Image/baoshi/合成祖母绿.png b/Data/Image/baoshi/合成祖母绿.png index 6ec64e95..3f8feaaf 100644 Binary files a/Data/Image/baoshi/合成祖母绿.png and b/Data/Image/baoshi/合成祖母绿.png differ diff --git a/Data/Image/baoshi/合成立方氧化锆.png b/Data/Image/baoshi/合成立方氧化锆.png index a7015188..7c74877a 100644 Binary files a/Data/Image/baoshi/合成立方氧化锆.png and b/Data/Image/baoshi/合成立方氧化锆.png differ diff --git a/Data/Image/baoshi/合成红宝石.png b/Data/Image/baoshi/合成红宝石.png index 122e1875..69a9c362 100644 Binary files a/Data/Image/baoshi/合成红宝石.png and b/Data/Image/baoshi/合成红宝石.png differ diff --git a/Data/Image/baoshi/合成蓝宝石(紫).png b/Data/Image/baoshi/合成蓝宝石(紫).png index 17f71a09..af269c32 100644 Binary files a/Data/Image/baoshi/合成蓝宝石(紫).png and b/Data/Image/baoshi/合成蓝宝石(紫).png differ diff --git a/Data/Image/baoshi/合成蓝宝石.png b/Data/Image/baoshi/合成蓝宝石.png index 4f0a2535..45bfedad 100644 Binary files a/Data/Image/baoshi/合成蓝宝石.png and b/Data/Image/baoshi/合成蓝宝石.png differ diff --git a/Data/Image/baoshi/和田玉(碧玉).png b/Data/Image/baoshi/和田玉(碧玉).png index 3618bcf1..a2571961 100644 Binary files a/Data/Image/baoshi/和田玉(碧玉).png and b/Data/Image/baoshi/和田玉(碧玉).png differ diff --git a/Data/Image/baoshi/托帕石.png b/Data/Image/baoshi/托帕石.png index 95c40d1a..bf4831a6 100644 Binary files a/Data/Image/baoshi/托帕石.png and b/Data/Image/baoshi/托帕石.png differ diff --git a/Data/Image/baoshi/方柱石.png b/Data/Image/baoshi/方柱石.png index f7dc9ea1..b6ffbe72 100644 Binary files a/Data/Image/baoshi/方柱石.png and b/Data/Image/baoshi/方柱石.png differ diff --git a/Data/Image/baoshi/月光石(白).png b/Data/Image/baoshi/月光石(白).png index 696509a5..24636b41 100644 Binary files a/Data/Image/baoshi/月光石(白).png and b/Data/Image/baoshi/月光石(白).png differ diff --git a/Data/Image/baoshi/月光石(黄).png b/Data/Image/baoshi/月光石(黄).png index d962c8ef..90b0b9ec 100644 Binary files a/Data/Image/baoshi/月光石(黄).png and b/Data/Image/baoshi/月光石(黄).png differ diff --git a/Data/Image/baoshi/查罗石.png b/Data/Image/baoshi/查罗石.png index fa486f40..c51b00cb 100644 Binary files a/Data/Image/baoshi/查罗石.png and b/Data/Image/baoshi/查罗石.png differ diff --git a/Data/Image/baoshi/橄榄石.png b/Data/Image/baoshi/橄榄石.png index 70a5b380..41300937 100644 Binary files a/Data/Image/baoshi/橄榄石.png and b/Data/Image/baoshi/橄榄石.png differ diff --git a/Data/Image/baoshi/欧泊(白).png b/Data/Image/baoshi/欧泊(白).png index 0d233cde..04d97028 100644 Binary files a/Data/Image/baoshi/欧泊(白).png and b/Data/Image/baoshi/欧泊(白).png differ diff --git a/Data/Image/baoshi/玉髓(蓝).png b/Data/Image/baoshi/玉髓(蓝).png index 415fea4f..d2a6b49a 100644 Binary files a/Data/Image/baoshi/玉髓(蓝).png and b/Data/Image/baoshi/玉髓(蓝).png differ diff --git a/Data/Image/baoshi/玻璃猫眼(白).png b/Data/Image/baoshi/玻璃猫眼(白).png index 94fe6fc7..9af99f95 100644 Binary files a/Data/Image/baoshi/玻璃猫眼(白).png and b/Data/Image/baoshi/玻璃猫眼(白).png differ diff --git a/Data/Image/baoshi/石英岩玉.png b/Data/Image/baoshi/石英岩玉.png index 9b535718..96f6c1c2 100644 Binary files a/Data/Image/baoshi/石英岩玉.png and b/Data/Image/baoshi/石英岩玉.png differ diff --git a/Data/Image/baoshi/碧玺(红).png b/Data/Image/baoshi/碧玺(红).png index 577ebdb8..c139802e 100644 Binary files a/Data/Image/baoshi/碧玺(红).png and b/Data/Image/baoshi/碧玺(红).png differ diff --git a/Data/Image/baoshi/碧玺(绿).png b/Data/Image/baoshi/碧玺(绿).png index 30473bde..5fba8ea9 100644 Binary files a/Data/Image/baoshi/碧玺(绿).png and b/Data/Image/baoshi/碧玺(绿).png differ diff --git a/Data/Image/baoshi/磷灰石.png b/Data/Image/baoshi/磷灰石.png index 6969e295..b07e85c8 100644 Binary files a/Data/Image/baoshi/磷灰石.png and b/Data/Image/baoshi/磷灰石.png differ diff --git a/Data/Image/baoshi/紫晶.png b/Data/Image/baoshi/紫晶.png index 7c04a051..58adde62 100644 Binary files a/Data/Image/baoshi/紫晶.png and b/Data/Image/baoshi/紫晶.png differ diff --git a/Data/Image/baoshi/红玛瑙.png b/Data/Image/baoshi/红玛瑙.png index 931c273b..65e7a567 100644 Binary files a/Data/Image/baoshi/红玛瑙.png and b/Data/Image/baoshi/红玛瑙.png differ diff --git a/Data/Image/baoshi/菱锰矿.png b/Data/Image/baoshi/菱锰矿.png index d27f1330..f97d213d 100644 Binary files a/Data/Image/baoshi/菱锰矿.png and b/Data/Image/baoshi/菱锰矿.png differ diff --git a/Data/Xml/13BaoShiFenLei.xml b/Data/Xml/13BaoShiFenLei.xml index 788db6a3..487348d9 100644 --- a/Data/Xml/13BaoShiFenLei.xml +++ b/Data/Xml/13BaoShiFenLei.xml @@ -14,13 +14,14 @@ @@ -48,6 +49,13 @@ + + + + + + + diff --git a/Data/Xml/14YuShiFenLei.xml b/Data/Xml/14YuShiFenLei.xml index 45169346..b648db00 100644 --- a/Data/Xml/14YuShiFenLei.xml +++ b/Data/Xml/14YuShiFenLei.xml @@ -7,5 +7,60 @@ All 玉石分类 true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file