From 35e3700b9ca1175496564286d04f7e85e6e93280 Mon Sep 17 00:00:00 2001 From: wulongxiao <2545507770@qq.com> Date: Thu, 28 Nov 2024 05:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=8E=A5=E5=8F=A3=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scripts/Login/Global.cs | 20 +++++------ .../Scripts/MallSystem2/productInfo22.cs | 21 +++-------- .../Scripts/Scene_main/Scene_main_jiekou.cs | 31 +++++++++++++++- .../Scripts/Scene_main/main_BaseShowPanel.cs | 10 +++++- .../Assets/Scripts/Scene_shop/shopPanel.cs | 4 +-- .../Assets/Scripts/Scene_shop/wokePanel.cs | 35 +++++++++++++++++-- .../Assets/prefabs/woniukaPanel.prefab | 7 ++-- 7 files changed, 92 insertions(+), 36 deletions(-) diff --git a/TheStrongestSnail/Assets/Scripts/Login/Global.cs b/TheStrongestSnail/Assets/Scripts/Login/Global.cs index 06ac030..3e3e982 100644 --- a/TheStrongestSnail/Assets/Scripts/Login/Global.cs +++ b/TheStrongestSnail/Assets/Scripts/Login/Global.cs @@ -865,7 +865,7 @@ public class ProductPro public int SellOpen { get; set; } public string CreateTime { get; set; } // CreateTime可能是 null,表示没有时间信息 } -//2.1=================================================== +//2.2=================================================== public class getProdectBody { public int productId { get; set; } @@ -873,19 +873,19 @@ public class getProdectBody [System.Serializable] public class getProductResponse:Response { - public MallProduct Data; + public ProductInfo Data; } [System.Serializable] -public class MallProduct -{ - public int PageNo; - public int PageSize; - public int TotalCount; - public List DataList; -} +//public class MallProduct +//{ +// public int PageNo; +// public int PageSize; +// public int TotalCount; +// public List DataList; +//} -[System.Serializable] +//[System.Serializable] public class ProductInfo { public int ProductId; diff --git a/TheStrongestSnail/Assets/Scripts/MallSystem2/productInfo22.cs b/TheStrongestSnail/Assets/Scripts/MallSystem2/productInfo22.cs index 9ad5ff9..88b41de 100644 --- a/TheStrongestSnail/Assets/Scripts/MallSystem2/productInfo22.cs +++ b/TheStrongestSnail/Assets/Scripts/MallSystem2/productInfo22.cs @@ -18,16 +18,16 @@ public class productInfo22 : MonoBehaviour // getProdectBody getProdectBody = new getProdectBody - { + { productId = productId, }; Debug.Log("========" + JsonConvert.SerializeObject(getProdectBody)); // 첽 - string response22 = await web.SendRequest(web.URL + "/snail/product/page", "POST", JsonConvert.SerializeObject(getProdectBody), head22); + string response22 = await web.SendRequest(web.URL + "/snail/product/info", "POST", JsonConvert.SerializeObject(getProdectBody), head22); // յӦ - Debug.Log("2.1̳б:=============== " + response22); + Debug.Log("2.2Ʒ:=============== " + response22); getProductResponse getProductResponse1 = new getProductResponse(); try { @@ -35,20 +35,9 @@ public class productInfo22 : MonoBehaviour getProductResponse1 = JsonConvert.DeserializeObject(response22); // пգȼ getProductResponse getProductResponse.data ǷΪ null - if (getProductResponse1 != null && getProductResponse1.Data != null && getProductResponse1.Data.DataList != null) + if (getProductResponse1 != null && getProductResponse1.Data != null && getProductResponse1.Data != null) { - Debug.Log($"Total Products: {getProductResponse1.Data.DataList.Count}"); - - // Ʒб - foreach (var product in getProductResponse1.Data.DataList) - { - // ÿƷϢ - Debug.Log($"Product ID: {product.ProductId}"); - Debug.Log($"Product Name: {product.ProductName}"); - Debug.Log($"Product Price: {product.Price}"); - Debug.Log($"Product Pic: {product.ProductPic}"); - Debug.Log($"Product Cover: {product.ProductCover}"); - } + Debug.Log("8=========D"+getProductResponse1.Data.ProductId); } else { diff --git a/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs b/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs index c3586fd..63df69d 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs @@ -21,6 +21,14 @@ public class Scene_main_jiekou :Base public getProductResponse _getProductResponse; + //ҵϸַ绰 + private AdressList83 _adressList83; + private AdressResponse _adressResponse; + + + // + private BuyProduct23 _buyProduct23; + public bool IsBuyGet = false; // Start is called before the first frame update @@ -84,7 +92,28 @@ public class Scene_main_jiekou :Base } - + public async Task ShopOneItem(int id) + { + _adressResponse = new AdressResponse(); + _adressList83 = new AdressList83(); + + _adressResponse = await _adressList83.AdressList(); + + _buyProduct23 = new BuyProduct23(); + + BuyProductResponse buyRes = await _buyProduct23.BuyProduct(id, _adressResponse.data[0].userId, _adressResponse.data[0].receiveName, _adressResponse.data[0].receivePhone, _adressResponse.data[0].area, _adressResponse.data[0].address); + + if (buyRes.code == 200) + { + IsBuyGet = true; + } + else + { + IsBuyGet = false; + } + + + } } diff --git a/TheStrongestSnail/Assets/Scripts/Scene_main/main_BaseShowPanel.cs b/TheStrongestSnail/Assets/Scripts/Scene_main/main_BaseShowPanel.cs index 6761175..dcea307 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_main/main_BaseShowPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_main/main_BaseShowPanel.cs @@ -19,5 +19,13 @@ public class main_BaseShowPanel : MonoBehaviour panel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); panel.transform.DOScale(1f, 0.5f); } - + + public void addEventPopUp(string Details, float time = 5f)//ӵ + { + GameObject prefab = Resources.Load("base/EventPopUp"); + prefab.GetComponent().time = time; + Canvas canvas = GetComponentInParent(); + prefab.GetComponent().text = Details; + Instantiate(prefab, canvas.transform); + } } diff --git a/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs b/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs index 055afbd..f56c927 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs @@ -34,9 +34,9 @@ public class shopPanel: ui_huodong // µǰ itemInfo ʾ itemInfos[index].gameObject.SetActive(true); // ʾǰ itemInfos[index].initShow(go.Value.ProductId, go.Value.ProductName,go.Value.Price.ToString()); - itemInfos[index].GetComponent