123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- namespace Fort23.Mono
- {
- public class PlacesItem
- {
- public GameObjectPool gameObjectPool;
- public BigMapConfig bigMapConfig;
- private ReferenceCollector referenceCollector;
- public List<PlacesWidget> PlacesWidgets = new List<PlacesWidget>();
- public async CTask CustomInit(int bigMapId, GameObjectPool gameObjectPool, Action<ItemWidgetBasic> callBack = null)
- {
- this.gameObjectPool = gameObjectPool;
- bigMapConfig = ConfigComponent.Instance.Get<BigMapConfig>(bigMapId);
- referenceCollector = gameObjectPool.own.GetComponent<ReferenceCollector>();
- for (var i = 0; i < bigMapConfig.places.Length; i++)
- {
- GameObject gam = referenceCollector.Get<GameObject>("places_" + bigMapConfig.places[i]);
- PlacesWidget placesWidget = await UIManager.Instance.CreateGComponentForObject<PlacesWidget>(gam, null);
- placesWidget.OnClick = callBack;
- placesWidget.CustomInit(bigMapConfig.places[i]);
- PlacesWidgets.Add(placesWidget);
- }
- }
- public void Dispose()
- {
- UIManager.Instance.DormancyGComponent(gameObjectPool);
- gameObjectPool = null;
- referenceCollector = null;
- PlacesWidgets.Clear();
- }
- }
- }
|