1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System.Collections;
- using System.Collections.Generic;
- using Api;
- using Mono.Cecil.Cil;
- 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);
- });
- }
-
- }
|