_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Scene_main/Scene_main_jiekou.cs

124 lines
3.2 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Scene_main_jiekou :Base
{
public static Scene_main_jiekou instance;
public mainBTN _mainBTN;
2024-11-27 22:22:41 +08:00
//<2F>û<EFBFBD><C3BB><EFBFBD>Ϣ
private RealPlayerInfo _realPlayerInfo;//<2F>û<EFBFBD><C3BB><EFBFBD>Ϣ<EFBFBD><EFBFBD><E1B9B9>
private queryPlayerInfo _queryPlayerInfo;//<2F>û<EFBFBD><C3BB><EFBFBD>Ϣ
//<2F>̳<EFBFBD><CCB3><EFBFBD>Ϣ
2024-11-27 23:22:34 +08:00
private MallResponsePro _mallResponsePro;//<2F>̳<EFBFBD><CCB3>б<EFBFBD><D0B1><EFBFBD><E1B9B9>
2024-11-27 22:22:41 +08:00
private getMallList21 _getMallList21;//<2F>̳<EFBFBD><CCB3>б<EFBFBD><D0B1><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
2024-11-27 23:22:34 +08:00
//<2F>̳<EFBFBD>info<66>ֵ<EFBFBD>
2024-11-27 23:39:41 +08:00
public Dictionary<int, ProductPro> shopItemDic = new Dictionary<int, ProductPro>();
2024-11-28 04:26:44 +08:00
public getProductResponse _getProductResponse;
2024-11-28 05:52:04 +08:00
//<2F><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ϸ<EFBFBD><CFB8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><E7BBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private AdressList83 _adressList83;
private AdressResponse _adressResponse;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private BuyProduct23 _buyProduct23;
2024-11-28 06:16:58 +08:00
[HideInInspector]
2024-11-28 05:52:04 +08:00
public bool IsBuyGet = false;
2024-11-28 04:26:44 +08:00
// Start is called before the first frame update
private void Awake()
{
instance = this;
Global.global.scene_Main_Jiekou = this;
2024-11-27 22:29:31 +08:00
//testLogo();
2024-11-28 00:39:35 +08:00
getPlayerInfo();
2024-11-27 22:22:41 +08:00
// getShopInfo();
}
public async void getPlayerInfo()
{
2024-11-27 22:22:41 +08:00
await PlayerInfoAsync();
/*Debug.Log(_realPlayerInfo.data.nickName);
Debug.Log(_realPlayerInfo.data.voluteCoin);
2024-11-27 22:22:41 +08:00
Debug.Log(_realPlayerInfo.data.beansCoin);*/
_mainBTN.UpDatePlayer(_realPlayerInfo.data.nickName, _realPlayerInfo.data.voluteCoin.ToString("f1") + "M", _realPlayerInfo.data.beansCoin.ToString("f1") + "M");
}
2024-11-27 22:22:41 +08:00
async Task PlayerInfoAsync()
{
2024-11-27 22:22:41 +08:00
_realPlayerInfo = new RealPlayerInfo();
_queryPlayerInfo = new queryPlayerInfo();
_realPlayerInfo = await _queryPlayerInfo.QueryPlayerInfoPro();
2024-11-28 04:26:44 +08:00
}
2024-11-27 22:22:41 +08:00
public async Task ShopInfo()
{
2024-11-27 23:39:41 +08:00
// ÿ<>ε<EFBFBD><CEB5><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ֵ䣬ȷ<E4A3AC><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
shopItemDic.Clear();
// <20><><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD>
2024-11-27 23:22:34 +08:00
_mallResponsePro = null;
_getMallList21 = null;
2024-11-27 23:39:41 +08:00
// <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><CCB3><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>
2024-11-27 22:22:41 +08:00
_mallResponsePro = new MallResponsePro();
_getMallList21 = new getMallList21();
2024-11-27 23:39:41 +08:00
// <20><EFBFBD><ECB2BD>ȡ<EFBFBD>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD>
2024-11-27 22:22:41 +08:00
_mallResponsePro = await _getMallList21.getMallList(1, 1, 20);
2024-11-27 23:39:41 +08:00
// <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>
2024-11-27 23:22:34 +08:00
foreach (ProductPro go in _mallResponsePro.Data.DataList)
{
2024-11-27 23:39:41 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>е<EFBFBD><D0B5><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ
shopItemDic[go.ProductId] = go;
}
2024-11-27 23:22:34 +08:00
2024-11-27 22:22:41 +08:00
}
2024-11-28 04:26:44 +08:00
public async Task ShopItemDetail(int id)
{
_getProductResponse = null;
productInfo22 _productInfo22 = new productInfo22();
_getProductResponse = await _productInfo22.productInfo(id);
}
2024-11-28 05:52:04 +08:00
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;
}
}
2024-11-27 22:22:41 +08:00
2024-11-28 04:26:44 +08:00
}