12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using UI.Store;
- using UI.CommonGame;
- using FairyGUI;
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class ChargeStoreView : BaseWindow
- {
- private UI_ChargeUI _ui;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_ChargeUI.PACKAGE_NAME;
- _ui = UI_ChargeUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- this.clickBlankToClose = false;
- _ui.m_list.itemRenderer = ListItemRenderer;
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void ListItemRenderer(int index, GObject obj)
- {
- RechargeCfg itemData = RechargeCfgArray.Instance.dataArray[index];
- UI_StoreListItem item = UI_StoreListItem.Proxy(obj);
- item.m_txtExchangeCount.visible = false;
- item.m_btnBuy.m_c1.selectedIndex = 1;
- item.m_btnBuy.m_txtTitle.text = itemData.price.ToString();
- if (item.target.data == null)
- {
- item.target.onClick.Add(() =>
- {
- if (!AntiAddictionController.CheckAntiAddictionRecharge(itemData.price))
- {
- RechargeSProxy.ReqRecharge(itemData.id).Coroutine();
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
- }
- });
- }
- item.target.data = index;
- item.m_txtName.text = string.Format("{0}{1}", itemData.itemNum, itemData.name);
- item.m_txtDesc.text = string.Format("首充赠送+{0}{1}", itemData.itemNum, itemData.name);
- bool isDouble = StoreDataManager.Instance.GetRechargeBuyNumById(itemData.id) < itemData.doubleTimes;
- item.m_imgDouble.visible = isDouble;
- item.m_txtDesc.visible = isDouble;
- item.m_icon.url = "ui://Store/sc_zizhuan_" + itemData.id;
- UI_StoreListItem.ProxyEnd();
- }
- }
- }
|