CardUpView.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. base.Dispose();
  19. }
  20. protected override void OnInit()
  21. {
  22. base.OnInit();
  23. _ui = UI_CardUpUI.Create();
  24. this.viewCom = _ui.target;
  25. this.viewCom.Center();
  26. this.modal = true;
  27. //MakeFullScreen(_ui);
  28. _ui.m_listProperty.itemRenderer = RenderListPropertyItem;
  29. }
  30. protected override void OnShown()
  31. {
  32. base.OnShown();
  33. _scores = (Dictionary<int, int>)(viewData as object[])[0];
  34. _type = (string)(viewData as object[])[1];
  35. _lastNum = (int)(viewData as object[])[2];
  36. _curNum = (int)(viewData as object[])[3];
  37. _ui.m_listProperty.numItems = _scores.Count;
  38. if (_type == "lv")
  39. {
  40. _ui.m_c1.selectedIndex = 0;
  41. _ui.m_txtLast.text = string.Format("Lv{0}", _lastNum);
  42. _ui.m_txtNow.text = string.Format("Lv{0}", _curNum);
  43. }
  44. else
  45. {
  46. _ui.m_c1.selectedIndex = 1;
  47. _ui.m_txtLast.text = string.Format("{0}星", _lastNum);
  48. _ui.m_txtNow.text = string.Format("{0}星", _curNum);
  49. }
  50. }
  51. private void RenderListPropertyItem(int index, GObject obj)
  52. {
  53. UI_ListPropertyItem listItem = UI_ListPropertyItem.Proxy(obj);
  54. listItem.m_txtProperty.text = _scores[index + 1].ToString();
  55. listItem.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (index + 1));
  56. }
  57. //private void OnClickBtnBack()
  58. //{
  59. // ViewManager.GoBackFrom(ViewName.CARD_UP_VIEW);
  60. //}
  61. protected override void OnHide()
  62. {
  63. base.OnHide();
  64. }
  65. }
  66. }