ClothingPropertyShowView.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using FairyGUI;
  6. using UI.ClothingFoster;
  7. using UnityEngine;
  8. namespace GFGGame
  9. {
  10. public class ClothingPropertyShowView : BaseWindow
  11. {
  12. private UI_ClothingropertyShowUI _ui;
  13. // private Dictionary<string, int> _data = new Dictionary<string, int>();
  14. // List<int> _dataList = new List<int>(); StudentDictionary.Values.ToList();
  15. List<KeyValuePair<int, string>> _dataList;// = new List<KeyValuePair<string, int>>();
  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. packageName = UI_ClothingropertyShowUI.PACKAGE_NAME;
  29. _ui = UI_ClothingropertyShowUI.Create();
  30. this.viewCom = _ui.target;
  31. this.viewCom.Center();
  32. this.modal = true;
  33. _ui.m_listPropertyShow.itemRenderer = ListPropertyShowItemRender;
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. int suitId = (int)(this.viewData as object[])[0];
  39. int index = (int)(this.viewData as object[])[1];
  40. // _dataList = SuitFosterDataManager.Instance.GetPropertyPercentData(suitId, index);
  41. // _ui.m_listPropertyShow.numItems = _dataList.Count;
  42. }
  43. private void ListPropertyShowItemRender(int index, GObject obj)
  44. {
  45. UI_ListPropertyShowItem item = UI_ListPropertyShowItem.Proxy(obj);
  46. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_dataList[index].Key);
  47. string type = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).name;
  48. item.m_txtShow.text = string.Format("{0} {1}%", type, StringUtil.GetColorText(_dataList[index].Value.ToString(), "#B66352"));
  49. UI_ListPropertyShowItem.ProxyEnd();
  50. }
  51. protected override void OnHide()
  52. {
  53. base.OnHide();
  54. // _dataList.Clear();
  55. }
  56. }
  57. }