12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using Excel2Json;
- using Fort23.UTool;
- using UnityEngine;
- namespace Fort23.Mono
- {
- public class PlacesItem
- {
- public GameObjectPool gameObjectPool;
- public BigMapConfig bigMapConfig;
- private ReferenceCollector referenceCollector;
- public async void 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]);
- }
- }
- public void Dispose()
- {
- UIManager.Instance.DormancyGComponent(gameObjectPool);
- gameObjectPool = null;
- referenceCollector = null;
- }
- }
- }
|