12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Threading.Tasks;
- using ET;
- using FairyGUI;
- using UI.DailyWelfare;
- namespace GFGGame
- {
- public class GiftDetailView : BaseWindow
- {
- private UI_GiftDetailUI _ui;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_GiftDetailUI.PACKAGE_NAME;
- _ui = UI_GiftDetailUI.Create();
- this.viewCom = _ui.target;
- this.viewCom.Center();
- this.modal = true;
- viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
- _ui.m_listGiftBag.itemRenderer = ListRewardItemRender;
- _ui.m_btnCheck.onClick.Add(OnBtnCheckClick);
- }
- protected override void OnShown()
- {
- base.OnShown();
- int[][] gifts = (int[][])viewData;
- _ui.m_listGiftBag.data = gifts;
- _ui.m_listGiftBag.numItems = gifts.Length;
- _ui.m_listGiftBag.scrollPane.ScrollTop();
- }
- private void ListRewardItemRender(int index, GObject obj)
- {
- int[][] rewards = (int[][])obj.parent.data;
- if (obj.data == null)
- {
- obj.data = new ItemView(obj as GComponent);
- }
- ItemData itemData = ItemUtil.createItemData(rewards[index]);
- (obj.data as ItemView).SetData(itemData);
- (obj.data as ItemView).ChangeTxtCountStyle();
- }
- private void OnBtnCheckClick(EventContext context)
- {
- ViewManager.Hide<GiftDetailView>();
- }
- }
- }
|