using asap.core; using cfg; using GameCore; using System.Collections; using UnityEngine; public class HomeSupplyDropPanel : MonoBehaviour { PlayerData playerData; Tables _tables; SupplyDropPopupPanel supplyDropPanel; int ShowSupplyDropIndex = -1; int allCount = 0; public void Init() { _tables = GContext.container.Resolve(); playerData = GContext.container.Resolve(); supplyDropPanel = transform.Find("SupplyDropPopupPanel/root").GetComponent(); supplyDropPanel.Init(); allCount = supplyDropPanel.detailsItems.Count; var DataList = _tables.TbEnergyDef.DataList; for (int i = 0; i < DataList.Count; i++) { if (DataList[i].SupplyDrop > 0) { ShowSupplyDropIndex = i; break; } } } public bool Show() { if (ShowSupplyDropIndex == -1) { return false; } StopCoroutine("Hide"); if (playerData.magnification >= ShowSupplyDropIndex && playerData.magnification < ShowSupplyDropIndex + allCount) { gameObject.SetActive(true); supplyDropPanel.Show(playerData.magnification - ShowSupplyDropIndex); StartCoroutine("Hide"); return true; } else { gameObject.SetActive(false); return false; } } IEnumerator Hide() { yield return new WaitForSeconds(2f); gameObject.SetActive(false); } }