12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using UI.RechargeStore;
- using UI.CommonGame;
- using FairyGUI;
- namespace GFGGame
- {
- public class RechargeStoreView : BaseWindow
- {
- private UI_RechargeStoreUI _ui;
- private ValueBarController _valueBarController;
- public override void Dispose()
- {
- _valueBarController.Dispose();
- _valueBarController = null;
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_RechargeStoreUI.PACKAGE_NAME;
- _ui = UI_RechargeStoreUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- _valueBarController = new ValueBarController(_ui.m_valueBar);
- _ui.m_btnBack.onClick.Add(OnClickBtnBack);
- _ui.m_list.itemRenderer = ListItemRenderer;
- _ui.m_comTab.m_c1.onChanged.Add(OnComTabChange);
- _ui.m_c1.onChanged.Add(OnTabChange);
- }
- protected override void OnShown()
- {
- base.OnShown();
- _valueBarController.OnShown();
- _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
- }
- protected override void OnHide()
- {
- base.OnHide();
- _valueBarController.OnHide();
- }
- private void OnClickBtnBack()
- {
- this.Hide();
- }
- private void OnComTabChange()
- {
- _ui.m_c1.selectedIndex = _ui.m_comTab.m_c1.selectedIndex;
- }
- private void OnTabChange()
- {
- }
- private void ListItemRenderer(int index, GObject obj)
- {
- RechargeCfg itemData = RechargeCfgArray.Instance.dataArray[index];
- UI_StoreListItem item = UI_StoreListItem.Proxy(obj);
- item.m_btnBuy.text = itemData.price.ToString();
- if (item.m_btnBuy.data == null)
- {
- item.m_btnBuy.onClick.Add(() =>
- {
- RechargeSProxy.ReqRecharge(itemData.id).Coroutine();
- });
- }
- item.m_btnBuy.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);
- item.m_imgDouble.visible = false;
- item.m_txtDesc.visible = false;
- item.m_icon.url = "ui://RechargeStore/sc_zizhuan_" + itemData.id;
- UI_StoreListItem.ProxyEnd();
- }
- }
- }
|