BigMapItem.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using Excel2Json;
  3. using Fort23.UTool;
  4. using UnityEngine;
  5. namespace Fort23.Mono
  6. {
  7. public class BigMapItem
  8. {
  9. public GameObjectPool gameObjectPool;
  10. public WorldMapConfig worldMapConfig;
  11. private ReferenceCollector referenceCollector;
  12. public async void CustomInit(int worldMapId, GameObjectPool gameObjectPool, Action<ItemWidgetBasic> callBack)
  13. {
  14. this.gameObjectPool = gameObjectPool;
  15. worldMapConfig = ConfigComponent.Instance.Get<WorldMapConfig>(worldMapId);
  16. referenceCollector = gameObjectPool.own.GetComponent<ReferenceCollector>();
  17. for (var i = 0; i < worldMapConfig.bigMapId.Length; i++)
  18. {
  19. GameObject gam = referenceCollector.Get<GameObject>("map_" + worldMapConfig.bigMapId[i]);
  20. BigMapWidget bigMapWidget = await UIManager.Instance.CreateGComponentForObject<BigMapWidget>(gam, null);
  21. bigMapWidget.OnClick = callBack;
  22. bigMapWidget.CustomInit(worldMapConfig.bigMapId[i]);
  23. }
  24. }
  25. public void Dispose()
  26. {
  27. UIManager.Instance.DormancyGComponent(gameObjectPool);
  28. gameObjectPool = null;
  29. referenceCollector = null;
  30. }
  31. }
  32. }