SpecificProfessionEquipmentPanel.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System.Collections.Generic;
  2. using Fort23.UTool;
  3. using GameLogic.Bag;
  4. using UnityEngine;
  5. namespace Fort23.Mono
  6. {
  7. [UIBinding(prefab = "SpecificProfessionEquipmentPanel" )]
  8. public partial class SpecificProfessionEquipmentPanel : UIPanel
  9. {
  10. private void Init()
  11. {
  12. }
  13. protected override void AddEvent()
  14. {
  15. }
  16. protected override void DelEvent()
  17. {
  18. }
  19. public override void AddButtonEvent()
  20. {
  21. btnBack.onClick.AddListener(OnclickClose);
  22. }
  23. private void OnclickClose()
  24. {
  25. UIManager.Instance.HideUIUIPanel(this);
  26. }
  27. public void InitPanel(int zy)
  28. {
  29. SetEqs(zy);
  30. }
  31. private async void SetEqs(int zy)
  32. {
  33. foreach (GameObject eqGo in eqs)
  34. {
  35. WidgetItem eqItem = await UIManager.Instance.
  36. CreateGComponentForObject<WidgetItem>(eqGo,
  37. null, root:eqGo.GetComponent<RectTransform>());
  38. LogTool.Log(eqGo + "设置");
  39. eqItem.SetEmpty();
  40. }
  41. if (BagController.Instance.EqDic.ContainsKey(zy))
  42. {
  43. List<ItemInfo> eqList = BagController.Instance.EqDic[zy];
  44. foreach (ItemInfo eqInfo in eqList)
  45. {
  46. if (eqInfo.eqInfo.isEquip)
  47. {
  48. // if(eqInfo.eqInfo.basicEquipConfig.Type)
  49. GameObject eqGo = eqs[eqInfo.eqInfo.basicEquipConfig.Type - 1] as GameObject;
  50. WidgetItem eqItem = await UIManager.Instance.
  51. CreateGComponentForObject<WidgetItem>(eqGo, null, root:eqGo.GetComponent<RectTransform>());
  52. eqItem.InitWidget(eqInfo);
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }