SyntheticRoutetipView.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 SyntheticRoutetipView : BaseWindow
  10. {
  11. private UI_SyntheticRouteTipUI _ui;
  12. private int target;
  13. private int srcID;
  14. private Dictionary<int, GLoader> iconDic = new Dictionary<int, GLoader>();
  15. public override void Dispose()
  16. {
  17. if (_ui != null)
  18. {
  19. _ui.Dispose();
  20. _ui = null;
  21. }
  22. base.Dispose();
  23. }
  24. protected override void OnInit()
  25. {
  26. base.OnInit();
  27. packageName = UI_SyntheticRouteTipUI.PACKAGE_NAME;
  28. _ui = UI_SyntheticRouteTipUI.Create();
  29. this.viewCom = _ui.target;
  30. isfullScreen = true;
  31. _ui.m_bg.onClick.Add(Hide);
  32. iconDic.Add(2, _ui.m_icon2);
  33. iconDic.Add(4, _ui.m_icon4);
  34. iconDic.Add(8, _ui.m_icon8);
  35. iconDic.Add(16, _ui.m_icon16);
  36. iconDic.Add(32, _ui.m_icon32);
  37. iconDic.Add(64, _ui.m_icon64);
  38. iconDic.Add(128, _ui.m_icon128);
  39. iconDic.Add(256, _ui.m_icon256);
  40. iconDic.Add(512, _ui.m_icon512);
  41. }
  42. protected override void OnShown()
  43. {
  44. base.OnShown();
  45. target = (int)(this.viewData as object[])[0];
  46. srcID = (int)(this.viewData as object[])[1];
  47. switch (target)
  48. {
  49. case 128:
  50. _ui.m_icon256.visible = false;
  51. _ui.m_icon512.visible = false;
  52. _ui.m_dic256.visible = false;
  53. _ui.m_dic512.visible = false;
  54. break;
  55. case 256:
  56. _ui.m_icon512.visible = false;
  57. _ui.m_dic512.visible = false;
  58. break;
  59. default:
  60. break;
  61. }
  62. for(int i = target; i>=2 ; i= i/2 )
  63. {
  64. iconDic[i].url = ResPathUtil.GetMiniGamePicPath(Merge2048CfgArray.Instance.GetCfgsByidAndnum(srcID,i)[0].resName);
  65. }
  66. }
  67. protected override void OnHide()
  68. {
  69. base.OnHide();
  70. }
  71. }
  72. }