MergeGameMaterialTipView.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using FairyGUI;
  5. using UI.MiniGame;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class MergeGameMaterialTipView : BaseWindow
  10. {
  11. private UI_MergeGameRouteTips _ui;
  12. private int _res;
  13. public override void Dispose()
  14. {
  15. if (_ui != null)
  16. {
  17. _ui.Dispose();
  18. _ui = null;
  19. }
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. packageName = UI_MergeGameRouteTips.PACKAGE_NAME;
  26. _ui = UI_MergeGameRouteTips.Create();
  27. this.viewCom = _ui.target;
  28. isfullScreen = true;
  29. _ui.m_btnBack.onClick.Add(Hide);
  30. _ui.m_AFuList.itemRenderer = RenderAFuList;
  31. _ui.m_DouBaoList.itemRenderer = RenderDouBaoList;
  32. }
  33. protected override void OnShown()
  34. {
  35. base.OnShown();
  36. if (this.viewData != null && (this.viewData as object[]).Length != 2)
  37. {
  38. _res = (int)(this.viewData as object[])[0];
  39. }
  40. else
  41. {
  42. _res = 1;
  43. }
  44. _ui.m_AFuList.numItems = 10;
  45. _ui.m_DouBaoList.numItems = 10;
  46. }
  47. protected override void OnHide()
  48. {
  49. base.OnHide();
  50. }
  51. private void RenderAFuList(int index, GObject obj)
  52. {
  53. UI_MergeGamematerialItem item = UI_MergeGamematerialItem.Proxy(obj);
  54. item.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res,index+11)[0].resName,"MergeGame");
  55. if( (index+1) % 5 == 0)
  56. {
  57. item.m_right.visible = false;
  58. }
  59. if(item.target.data == null)
  60. {
  61. item.target.onClick.Add(OnClickItem);
  62. }
  63. item.target.data = index + 1;
  64. UI_MergeGamematerialItem.ProxyEnd();
  65. }
  66. private void RenderDouBaoList(int index,GObject obj)
  67. {
  68. UI_MergeGamematerialItem item = UI_MergeGamematerialItem.Proxy(obj);
  69. item.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByidAndmaterialId(_res, index+1)[0].resName, "MergeGame");
  70. if ((index + 1) % 5 == 0)
  71. {
  72. item.m_right.visible = false;
  73. }
  74. if (item.target.data == null)
  75. {
  76. item.target.onClick.Add(OnClickItem);
  77. }
  78. item.target.data = index + 1 + 10;
  79. UI_MergeGamematerialItem.ProxyEnd();
  80. }
  81. private void OnClickItem(EventContext context)
  82. {
  83. int index = (int)(context.sender as GObject).data;
  84. _ui.m_name.text = index.ToString();
  85. _ui.m_desc.text = index.ToString();
  86. }
  87. }
  88. }