From cd00ac298d5564128c5cb1a95a5b2cd54f5df54d Mon Sep 17 00:00:00 2001 From: wulongxiao <2545507770@qq.com> Date: Wed, 27 Nov 2024 23:22:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=8E=A5=E5=8F=A3=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Scene_main/Scene_main_jiekou.cs | 21 +++++++++++++++---- .../Assets/Scripts/Scene_main/main_shop.cs | 2 +- .../Assets/Scripts/Scene_shop/shopPanel.cs | 19 +++++++++++++++-- .../Scripts/UI_contorl_wlx/ui_huodong.cs | 2 +- .../Assets/prefabs/shopPanel.prefab | 21 +++++++++++++++++++ 5 files changed, 57 insertions(+), 8 deletions(-) diff --git a/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs b/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs index 604c75f..3a7f396 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs @@ -14,9 +14,10 @@ public class Scene_main_jiekou :Base //商城信息 - public MallResponsePro _mallResponsePro;//商城列表结构体 + private MallResponsePro _mallResponsePro;//商城列表结构体 private getMallList21 _getMallList21;//商城列表获取方法 - + //商城info字典 + public Dictionary shopItemDic; // Start is called before the first frame update @@ -25,7 +26,7 @@ public class Scene_main_jiekou :Base instance = this; //testLogo(); - getPlayerInfo(); + //getPlayerInfo(); // getShopInfo(); } @@ -47,14 +48,26 @@ public class Scene_main_jiekou :Base } + public async Task ShopInfo() { + //提前清空 + shopItemDic = null; + _mallResponsePro = null; + _getMallList21 = null; + + + //重写写入 _mallResponsePro = new MallResponsePro(); _getMallList21 = new getMallList21(); - _mallResponsePro = await _getMallList21.getMallList(1, 1, 20); + foreach (ProductPro go in _mallResponsePro.Data.DataList) + { + shopItemDic.Add(go.ProductId,go); + } + } diff --git a/TheStrongestSnail/Assets/Scripts/Scene_main/main_shop.cs b/TheStrongestSnail/Assets/Scripts/Scene_main/main_shop.cs index 9935ad4..869519f 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_main/main_shop.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_main/main_shop.cs @@ -28,7 +28,7 @@ public class main_shop :BaseUIPanel return; } - // await Scene_main_jiekou.instance.ShopInfo(); + //await Scene_main_jiekou.instance.ShopInfo(); //获取商城列表 Debug.Log("获取商城列表"); // 实例化 Panel diff --git a/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs b/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs index 23285d9..c68c2b6 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs @@ -5,7 +5,22 @@ using UnityEngine; using DG.Tweening; public class shopPanel: ui_huodong -{ +{ + public List itemInfos = new List(); + + void initShop() + { + + int index= Scene_main_jiekou.instance._mallResponsePro.Data.TotalCount;//商城的商品数量 + + foreach (itemInfo item in itemInfos) + { + if (index>0) + { + item.gameObject.SetActive(true); + + } + } + } - } diff --git a/TheStrongestSnail/Assets/Scripts/UI_contorl_wlx/ui_huodong.cs b/TheStrongestSnail/Assets/Scripts/UI_contorl_wlx/ui_huodong.cs index 95aae1a..562a32b 100644 --- a/TheStrongestSnail/Assets/Scripts/UI_contorl_wlx/ui_huodong.cs +++ b/TheStrongestSnail/Assets/Scripts/UI_contorl_wlx/ui_huodong.cs @@ -11,7 +11,7 @@ public class ui_huodong :main_BaseShowPanel [Header("面板,请和按钮一一对应")] public List panels=new List(); // Start is called before the first frame update - void Start() + public virtual void Start() { base.showPanel(base._panel); diff --git a/TheStrongestSnail/Assets/prefabs/shopPanel.prefab b/TheStrongestSnail/Assets/prefabs/shopPanel.prefab index a6e6a31..ef4bbc2 100644 --- a/TheStrongestSnail/Assets/prefabs/shopPanel.prefab +++ b/TheStrongestSnail/Assets/prefabs/shopPanel.prefab @@ -9,6 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5363579444209329408} + - component: {fileID: 2302796054771788344} m_Layer: 5 m_Name: shopPanel m_TagString: Untagged @@ -38,6 +39,21 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2302796054771788344 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5363579444209329409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3c192bd726c790488c8fe8895226742, type: 3} + m_Name: + m_EditorClassIdentifier: + _panel: {fileID: 957974660627982085} + btns: [] + panels: [] --- !u!1001 &5363579443773024874 PrefabInstance: m_ObjectHideFlags: 0 @@ -144,6 +160,11 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 5126270615579512174, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3} m_PrefabInstance: {fileID: 5363579443773024874} m_PrefabAsset: {fileID: 0} +--- !u!1 &957974660627982085 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5126270615579512175, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3} + m_PrefabInstance: {fileID: 5363579443773024874} + m_PrefabAsset: {fileID: 0} --- !u!1001 &5363579444857241352 PrefabInstance: m_ObjectHideFlags: 0