CardUpView.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using FairyGUI;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UI.Card;
  5. using UI.CommonGame;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class CardUpView : BaseWindow
  10. {
  11. private UI_CardUpUI _ui;
  12. private Dictionary<int, int> _scores;
  13. private string _type;
  14. private int _lastNum;
  15. private int _curNum;
  16. public override void Dispose()
  17. {
  18. if (_ui != null)
  19. {
  20. _ui.Dispose();
  21. _ui = null;
  22. }
  23. base.Dispose();
  24. }
  25. protected override void OnInit()
  26. {
  27. base.OnInit();
  28. _ui = UI_CardUpUI.Create();
  29. this.viewCom = _ui.target;
  30. this.viewCom.Center();
  31. this.modal = true;
  32. //MakeFullScreen(_ui);
  33. _ui.m_listProperty.itemRenderer = RenderListPropertyItem;
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _scores = (Dictionary<int, int>)(viewData as object[])[0];
  39. _type = (string)(viewData as object[])[1];
  40. _lastNum = (int)(viewData as object[])[2];
  41. _curNum = (int)(viewData as object[])[3];
  42. _ui.m_listProperty.numItems = _scores.Count;
  43. if (_type == "lv")
  44. {
  45. _ui.m_c1.selectedIndex = 0;
  46. _ui.m_txtLast.text = string.Format("Lv{0}", _lastNum);
  47. _ui.m_txtNow.text = string.Format("Lv{0}", _curNum);
  48. }
  49. else
  50. {
  51. _ui.m_c1.selectedIndex = 1;
  52. _ui.m_txtLast.text = string.Format("{0}星", _lastNum);
  53. _ui.m_txtNow.text = string.Format("{0}星", _curNum);
  54. }
  55. }
  56. private void RenderListPropertyItem(int index, GObject obj)
  57. {
  58. UI_ListPropertyItem listItem = UI_ListPropertyItem.Proxy(obj);
  59. listItem.m_txtProperty.text = _scores[index + 1].ToString();
  60. listItem.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (index + 1));
  61. UI_ListPropertyItem.ProxyEnd();
  62. }
  63. //private void OnClickBtnBack()
  64. //{
  65. // ViewManager.GoBackFrom(ViewName.CARD_UP_VIEW);
  66. //}
  67. protected override void OnHide()
  68. {
  69. base.OnHide();
  70. }
  71. }
  72. }