using System.Collections.Generic; using System.Threading.Tasks; using asap.core; using game; using Game; using GameCore; using UnityEngine; namespace EventBossFight { /// /// Boss 战场景 Act:进入时从 切换过来,关闭主界面时 切回钓鱼。 /// 需在 Addressables 中注册与 同名的预制体(可仅挂本组件的空物体)。 /// public class EventBossFightAct : AGameAct { public const string ActAddress = nameof(EventBossFightAct); public override async Task StartAsync() { var manager = GContext.container.Resolve(); var data = manager?.Data; if (data?.InitConfig == null) { Debug.LogError("[EventBossFightAct] InitConfig 为空,无法打开 Boss 战,切回 FishingAct。"); GContext.Publish(new UnloadActToNextAct("FishingAct")); GContext.Publish(new EndTransition()); return await base.StartAsync(); } var bossKey = EventBossFightBossBundleKeys.GetAddressableKey(data.InitConfig, data.StageCountFrom1); if (!string.IsNullOrEmpty(bossKey)) { var loadResourceService = GContext.container.Resolve(); var queueKey = EventBossFightBossBundleKeys.GetBossResourceLoadQueueKey(bossKey); await loadResourceService.CheckResourceLoadQueue(queueKey, new List { bossKey }); } UITypes.EventBossFightPanel.SetType(data.InitConfig.UIPanel); await UIManager.Instance.ShowUILoad(UITypes.EventBossFightPanel); GContext.Publish(new EndTransition()); return await base.StartAsync(); } public override async Task StopAsync() { UIManager.Instance.DestroyUI(UITypes.EventBossFightPanel); UIManager.Instance.DestroyUI(UITypes.EventBossFightInfoPanel); UIManager.Instance.DestroyUI(UITypes.EventBossFightFestPackPanel); UIManager.Instance.DestroyUI(UITypes.EventBossFightReviewPopupPanel); UIManager.Instance.DestroyUI(UITypes.EventBossFightEndingPopupPanel); UIManager.Instance.DestroyUI(UITypes.EventBossFightRewardPopupPanel); await base.StopAsync(); } protected override void OnDestroy() { } } }