GiftBagStoreView.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using UI.Store;
  2. using UI.CommonGame;
  3. using FairyGUI;
  4. using System.Collections.Generic;
  5. using ET;
  6. namespace GFGGame
  7. {
  8. public class GiftBagStoreView : BaseWindow
  9. {
  10. private UI_GiftBagStoreUI _ui;
  11. private List<ShopCfg> _shopCfgs;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. }
  18. _ui = null;
  19. base.Dispose();
  20. }
  21. protected override void OnInit()
  22. {
  23. base.OnInit();
  24. packageName = UI_GiftBagStoreUI.PACKAGE_NAME;
  25. _ui = UI_GiftBagStoreUI.Create();
  26. this.viewCom = _ui.target;
  27. isfullScreen = true;
  28. this.clickBlankToClose = false;
  29. _ui.m_list.itemRenderer = ListItemRenderer;
  30. }
  31. protected override void AddEventListener()
  32. {
  33. base.AddEventListener();
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE);
  39. _ui.m_list.numItems = _shopCfgs.Count;
  40. }
  41. protected override void OnHide()
  42. {
  43. base.OnHide();
  44. }
  45. protected override void RemoveEventListener()
  46. {
  47. base.RemoveEventListener();
  48. }
  49. private void ListItemRenderer(int index, GObject obj)
  50. {
  51. // UI_ListShopItem item = UI_ListShopItem.Proxy(obj);
  52. // ShopCfg cfg = _giftCfgs[index];
  53. // item.m_txtName.text = cfg.name;
  54. // item.m_icon.url = ResPathUtil.GetIconPath(cfg.res, "png"); // string.Format("ui://RechargeStore/{0}", cfg.res);
  55. // item.m_txtDesc.SetVar("count", cfg.desc).FlushVars(); ;
  56. // item.m_grpDiscount.visible = cfg.desc != "";
  57. // item.m_txtEndTime.text = StoreDataManager.Instance.GetEndTime(cfg.id);
  58. // item.m_grpEndTime.visible = cfg.endTime != "";
  59. // item.m_c2.selectedIndex = StoreDataManager.Instance.GetGiftStateById(cfg.id) ? 0 : 1;
  60. // if (cfg.lockType == LockType.STORY_LV)
  61. // {
  62. // StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(cfg.storyLevelId);
  63. // item.m_txtLock.text = string.Format("通关{0}-{1}解锁", StoryUtil.GetChapterOrder(storyLevelCfg.chapterId), storyLevelCfg.order);
  64. // }
  65. // else if (cfg.lockType == LockType.ROLE_LV)
  66. // {
  67. // item.m_txtLock.text = string.Format("角色达到{0}级解锁", cfg.lv);
  68. // }
  69. // int buyNum = StoreDataManager.Instance.GetGiftBuyNumById(cfg.id);
  70. // item.m_txtLimit.text = string.Format("{0}({1}/{2})", StoreDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
  71. // item.m_txtLimit.visible = cfg.maxBuyNum > 0;
  72. // item.m_c1.selectedIndex = cfg.maxBuyNum == 0 || buyNum < cfg.maxBuyNum ? 0 : 1;
  73. // if (item.m_c1.selectedIndex == 0)
  74. // {
  75. // item.m_btnBuy.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(cfg.originalPrice);// cfg.originalPrice.ToString();
  76. // if (cfg.price > 0 && cfg.costType != CostType.FREE)
  77. // {
  78. // item.m_btnBuy.m_grpOriginalPrice.visible = cfg.originalPrice > 0;
  79. // item.m_btnBuy.m_grpIcon.visible = true;
  80. // item.m_btnBuy.m_txtPrice.text = NumberUtil.ChangeNumberUnit(cfg.price);// cfg.price.ToString();
  81. // if (cfg.costType == CostType.RMB)
  82. // {
  83. // item.m_btnBuy.m_loaIcon.visible = false;
  84. // item.m_btnBuy.m_txtIcon.visible = true;
  85. // item.m_btnBuy.m_txtIcon.text = "¥";
  86. // }
  87. // else
  88. // {
  89. // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
  90. // item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
  91. // item.m_btnBuy.m_loaIcon.visible = true;
  92. // item.m_btnBuy.m_txtIcon.visible = false;
  93. // }
  94. // }
  95. // else
  96. // {
  97. // item.m_btnBuy.m_grpIcon.visible = false;
  98. // item.m_btnBuy.m_grpOriginalPrice.visible = false;
  99. // item.m_btnBuy.m_txtPrice.text = "免费";
  100. // }
  101. // }
  102. // if (item.target.data == null)
  103. // {
  104. // item.target.onClick.Add(OnBtnBuyClick);
  105. // }
  106. // item.target.data = cfg.id;
  107. // bool isRed = item.m_c1.selectedIndex == 0 && item.m_c2.selectedIndex == 0 && cfg.price == 0;
  108. // RedDotController.Instance.SetComRedDot(item.target, isRed, "", -6, 100);
  109. // UI_ListShopItem.ProxyEnd();
  110. }
  111. }
  112. }