From eae8f1c465597442596e297f32ef86886e5dbec4 Mon Sep 17 00:00:00 2001 From: liuliang <597380732@qq.com> Date: Mon, 23 Dec 2024 14:02:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=B7=9F=E7=94=A8=E6=88=B7=E6=A8=A1=E5=9D=97bug=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meng_yao/Assets/Scenes/scene_Main.unity | 176 +++++++++++++++--- .../Assets/script/scene_Main/AssetsPanel.cs | 15 +- .../ui/IllustrationsAssetDetails.cs | 81 ++++++++ .../ui/IllustrationsAssetDetails.cs.meta | 11 ++ .../script/scene_Main/ui/ShopAssetDetails.cs | 74 ++++++++ .../scene_Main/ui/ShopAssetDetails.cs.meta | 11 ++ 6 files changed, 334 insertions(+), 34 deletions(-) create mode 100644 meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs create mode 100644 meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs.meta create mode 100644 meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs create mode 100644 meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs.meta diff --git a/meng_yao/Assets/Scenes/scene_Main.unity b/meng_yao/Assets/Scenes/scene_Main.unity index e0359a7fc..964f77275 100644 --- a/meng_yao/Assets/Scenes/scene_Main.unity +++ b/meng_yao/Assets/Scenes/scene_Main.unity @@ -27312,17 +27312,6 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 3011360592396996928, guid: a8cc81ed2c5736a46a14628d8d489ac4, type: 3} m_PrefabInstance: {fileID: 366819986} m_PrefabAsset: {fileID: 0} ---- !u!114 &366820006 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 366820006, guid: a8cc81ed2c5736a46a14628d8d489ac4, type: 3} - m_PrefabInstance: {fileID: 366819986} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9647a809a756a414985b899f5cd9e11b, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &368440243 GameObject: m_ObjectHideFlags: 0 @@ -43653,6 +43642,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 596651419} + - component: {fileID: 596651420} m_Layer: 5 m_Name: GameObject (1) m_TagString: Untagged @@ -43683,6 +43673,26 @@ RectTransform: m_AnchoredPosition: {x: 226.35, y: -0.00078773} m_SizeDelta: {x: 627.3, y: 158.43} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &596651420 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 596651418} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fd438b9208902154986a2653a8ea305c, type: 3} + m_Name: + m_EditorClassIdentifier: + Genbtn: {fileID: 512938724} + WaterBtn: {fileID: 1151648667} + GemText: {fileID: 2085121787} + WaterText: {fileID: 250749855} + mygameObject: {fileID: 1553952863} + UserName: {fileID: 775284123} + UserID: {fileID: 208397685} + UserHead: {fileID: 989427337} --- !u!1 &598288049 GameObject: m_ObjectHideFlags: 0 @@ -46375,10 +46385,38 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 7559150911668425800, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_AnchoredPosition.x + value: 190 + objectReference: {fileID: 0} + - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 6 + objectReference: {fileID: 0} - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 366820006} + objectReference: {fileID: 626587213} + - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: SetActive + objectReference: {fileID: 0} + - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: UnityEngine.GameObject, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 7559150911668425801, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: da36d88841e59564b82d1d3d07b0f5ae, type: 3} --- !u!224 &626587212 stripped @@ -60100,7 +60138,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &836823196 RectTransform: m_ObjectHideFlags: 0 @@ -86612,8 +86650,9 @@ GameObject: m_Component: - component: {fileID: 1218477462} - component: {fileID: 1218477463} + - component: {fileID: 1218477464} m_Layer: 5 - m_Name: GameObject + m_Name: ShopAssetDetails m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -86655,12 +86694,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: -48 - m_Right: -21 + m_Left: 208 + m_Right: 99 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 4 - m_Spacing: -76.36 + m_Spacing: 0 m_ChildForceExpandWidth: 1 m_ChildForceExpandHeight: 1 m_ChildControlWidth: 0 @@ -86668,6 +86707,23 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &1218477464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1218477461} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3bb84cde16137b34fb1c753cfb075476, type: 3} + m_Name: + m_EditorClassIdentifier: + Genbtn: {fileID: 565435912} + OreBtn: {fileID: 1411013104} + GemText: {fileID: 283076767} + OreText: {fileID: 495265248} + mygameObject: {fileID: 1553952863} --- !u!1 &1218639833 GameObject: m_ObjectHideFlags: 0 @@ -86919,7 +86975,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1222036287 RectTransform: m_ObjectHideFlags: 0 @@ -109602,6 +109658,73 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 86df4d3ef823af3479e6419f207e7aa0, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &1553952865 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 6931136036260294092, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} + m_PrefabInstance: {fileID: 1553952861} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1553952863} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1553952866 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1553952863} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1553952865} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1553952863} + m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine + m_MethodName: SetActive + m_Mode: 6 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &1554538063 GameObject: m_ObjectHideFlags: 0 @@ -117869,7 +117992,7 @@ GameObject: m_Component: - component: {fileID: 1663966954} m_Layer: 5 - m_Name: Gem (2) + m_Name: ShopGem m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -117896,7 +118019,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 631.9633, y: -57.5} + m_AnchoredPosition: {x: 628, y: -57.5} m_SizeDelta: {x: 280, y: 86} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1665185078 @@ -118583,7 +118706,7 @@ GameObject: - component: {fileID: 1673086939} - component: {fileID: 1673086938} m_Layer: 5 - m_Name: strenthdi (2) + m_Name: Waterdi m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -133338,7 +133461,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 375.25, y: -57.5} + m_AnchoredPosition: {x: 348, y: -57.5} m_SizeDelta: {x: 280, y: 86} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1889134673 @@ -155529,15 +155652,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f03d12340aff50a429546bc27002ff44, type: 3} m_Name: m_EditorClassIdentifier: - DropArrays: - - {fileID: 1206199082452696326} - - {fileID: 744146547634647184} - - {fileID: 7687579132756152348} - - {fileID: 744146548872551353} - - {fileID: 8115502124296646205} - - {fileID: 744146548398372042} - - {fileID: 4883130753928690580} - - {fileID: 6274686225547590652} --- !u!1 &1477323885272221126 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/script/scene_Main/AssetsPanel.cs b/meng_yao/Assets/script/scene_Main/AssetsPanel.cs index fde646ae2..ae32226ac 100644 --- a/meng_yao/Assets/script/scene_Main/AssetsPanel.cs +++ b/meng_yao/Assets/script/scene_Main/AssetsPanel.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; @@ -29,8 +30,16 @@ public class AssetsPanel : MonoBehaviour private bool isUpdating=false; // Start is called before the first frame update + + private void Awake() + { + + } + void Start() { + UpDateText(); + if (but1 != null) { but1.onClick.AddListener(() => @@ -49,17 +58,17 @@ public class AssetsPanel : MonoBehaviour if (but3 != null) { but3.onClick.AddListener(() => { - mygameObject.GetComponent().ShowPanel(3); + mygameObject.GetComponent().ShowPanel(4); }); } if (but4 != null) { but4.onClick.AddListener(() => { - mygameObject.GetComponent().ShowPanel(4); + mygameObject.GetComponent().ShowPanel(3); }); } - + InvokeRepeating("UpDateText", 1f,1f); } diff --git a/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs new file mode 100644 index 000000000..5f965e644 --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs @@ -0,0 +1,81 @@ +using System.Collections; +using System.Collections.Generic; +using Unity.Android.Gradle; +using UnityEngine; +using UnityEngine.UI; +public class IllustrationsAssetDetails : MonoBehaviour +{ + public Button Genbtn; + public Button WaterBtn; + + public Text GemText; + public Text WaterText; + + [Header("按下按钮显示的panel,目前是同一个")] + public GameObject mygameObject; + + public Text UserName; + public Text UserID; + public Image UserHead; + + private bool isUpdating = false; + void Start() + { + UpDateText(); + + if (Genbtn != null) + { + Genbtn.onClick.AddListener(() => + { + mygameObject.GetComponent().ShowPanel(1); + }); + } + + if (WaterBtn != null) + { + WaterBtn.onClick.AddListener(() => { + mygameObject.GetComponent().ShowPanel(4); + }); + } + } + + private void UpDateText() + { + // 如果正在执行异步操作,直接返回,不进行重复调用 + if (isUpdating) + return; + UpdateTaxt(); + } + + async void UpdateTaxt() + { + isUpdating = true; + + PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); + GemText.text = _PlayerInfoData.gem.ToString(); + WaterText.text = _PlayerInfoData.water.ToString(); + UserName.text = _PlayerInfoData.nickname.ToString(); + UserID.text = _PlayerInfoData.uid.ToString(); + + _PlayerInfoData = null; + // 异步操作完成,标记为未执行 + isUpdating = false; + } + + private void OnEnable() + { + InvokeRepeating("UpDateText", 1f, 1f); + } + + private void OnDisable() + { + CancelInvoke("UpDateText"); + } + + + // Update is called once per frame + void Update() + { + + } +} diff --git a/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs.meta b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs.meta new file mode 100644 index 000000000..cf481a0c8 --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd438b9208902154986a2653a8ea305c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs b/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs new file mode 100644 index 000000000..a9682d1fe --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs @@ -0,0 +1,74 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class ShopAssetDetails : MonoBehaviour +{ + public Button Genbtn; + public Button OreBtn; + + public Text GemText; + public Text OreText; + + [Header("按下按钮显示的panel,目前是同一个")] + public GameObject mygameObject; + + private bool isUpdating = false; + void Start() + { + UpDateText(); + + if (Genbtn != null) + { + Genbtn.onClick.AddListener(() => + { + mygameObject.GetComponent().ShowPanel(1); + }); + } + + if (OreBtn != null) + { + OreBtn.onClick.AddListener(() => { + mygameObject.GetComponent().ShowPanel(4); + }); + } + } + + + private void UpDateText() + { + // 如果正在执行异步操作,直接返回,不进行重复调用 + if (isUpdating) + return; + UpdateTaxt(); + } + + async void UpdateTaxt() + { + isUpdating = true; + + PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); + GemText .text = _PlayerInfoData.gem.ToString(); + OreText.text = _PlayerInfoData.forge.ToString(); + _PlayerInfoData = null; + // 异步操作完成,标记为未执行 + isUpdating = false; + } + + private void OnEnable() + { + InvokeRepeating("UpDateText", 1f, 1f); + } + + private void OnDisable() + { + CancelInvoke("UpDateText"); + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs.meta b/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs.meta new file mode 100644 index 000000000..271bf01dd --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3bb84cde16137b34fb1c753cfb075476 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: