ClothingPropertyShowView.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using cfg.GfgCfg;
  6. using FairyGUI;
  7. using UI.ClothingFoster;
  8. using UnityEngine;
  9. namespace GFGGame
  10. {
  11. public class ClothingPropertyShowView : BaseWindow
  12. {
  13. private UI_ClothingropertyShowUI _ui;
  14. // private Dictionary<string, int> _data = new Dictionary<string, int>();
  15. // List<int> _dataList = new List<int>(); StudentDictionary.Values.ToList();
  16. List<KeyValuePair<int, string>> _dataList;// = new List<KeyValuePair<string, int>>();
  17. public override void Dispose()
  18. {
  19. if (_ui != null)
  20. {
  21. _ui.Dispose();
  22. _ui = null;
  23. }
  24. base.Dispose();
  25. }
  26. protected override void OnInit()
  27. {
  28. base.OnInit();
  29. packageName = UI_ClothingropertyShowUI.PACKAGE_NAME;
  30. _ui = UI_ClothingropertyShowUI.Create();
  31. this.viewCom = _ui.target;
  32. this.viewCom.Center();
  33. this.modal = true;
  34. _ui.m_listPropertyShow.itemRenderer = ListPropertyShowItemRender;
  35. }
  36. protected override void OnShown()
  37. {
  38. base.OnShown();
  39. int suitId = (int)(this.viewData as object[])[0];
  40. int index = (int)(this.viewData as object[])[1];
  41. // _dataList = SuitFosterDataManager.Instance.GetPropertyPercentData(suitId, index);
  42. // _ui.m_listPropertyShow.numItems = _dataList.Count;
  43. }
  44. private void ListPropertyShowItemRender(int index, GObject obj)
  45. {
  46. UI_ListPropertyShowItem item = UI_ListPropertyShowItem.Proxy(obj);
  47. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(_dataList[index].Key);
  48. string type = CommonDataManager.Tables.TblItemCfg.GetOrDefault(itemCfg.SubType).Name;
  49. item.m_txtShow.text = string.Format("{0} {1}%", type, StringUtil.GetColorText(_dataList[index].Value.ToString(), "#B66352"));
  50. UI_ListPropertyShowItem.ProxyEnd();
  51. }
  52. protected override void OnHide()
  53. {
  54. base.OnHide();
  55. // _dataList.Clear();
  56. }
  57. }
  58. }