12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Collections;
- using System.Collections.Generic;
- using Api;
- using Plugins.CxShine.page;
- using UI;
- using UI.Common;
- using Unity.VisualScripting;
- using UnityEngine;
- public class MarketPageComp : MonoBehaviour
- {
- public Transform ScrollRect;
- public GameObject CockItemPreafab;
- void Start()
- {
- ApiComp.Instance.cockMarket(data =>
- {
- foreach (var marketCock in data.market)
- {
- var itemComp=Instantiate(CockItemPreafab, ScrollRect, false).GetComponent<CockUIItemComp>();
- itemComp.ModeBuy(marketCock);
- itemComp.ClickBuyAction += BuyCock;
- }
- }, null);
-
-
- GetComponent<PageComp>().setOnPageCloseListener((() =>
- {
- HallComp.Instance.BackToHallAndRefreshUI();
- ;
- }));
- }
- private void BuyCock(MarketCock marketCock)
- {
- if (marketCock.diamond > AccountManager.Instance.GetDiamond())
- {
- TipsComp.ShowTips("Not enough diamonds");
- return;
- }
- ApiComp.Instance.BuyCock(marketCock.marketId, data =>
- {
-
-
- TipsComp.ShowTips("Success!");
-
- }, (code, err) =>
- {
- TipsComp.ShowTips(err);
- });
- }
-
- }
|