| | |
| | | using LitJson; |
| | | using System; |
| | | using System.Linq; |
| | | using Cysharp.Threading.Tasks; |
| | | using ProjSG.Resource; |
| | | |
| | | public class BattleManager : GameSystemManager<BattleManager> |
| | | { |
| | |
| | | int MapID = (int)vNetData.MapID; |
| | | int FuncLineID = (int)vNetData.FuncLineID; |
| | | |
| | | // US4 T043: Trigger BattleScene preload before creating battle field |
| | | if (!ResourcePreloader.Instance.IsConfigLoaded("BattleScene")) |
| | | { |
| | | PreloadBattleResourcesAsync().Forget(); |
| | | } |
| | | |
| | | bool isCreate = true; |
| | | if (battleFields.TryGetValue(guid, out battleField)) |
| | | { |
| | |
| | | return battleField; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// US4 T043: 异步预加载战斗资源。 |
| | | /// </summary> |
| | | public async UniTask PreloadBattleResourcesAsync(IProgress<float> progress = null) |
| | | { |
| | | if (ResourcePreloader.Instance.IsConfigLoaded("BattleScene")) return; |
| | | await ResourcePreloader.Instance.PreloadAsync("BattleScene", progress); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// US4 T043: 卸载战斗预加载资源(所有战斗结束时调用)。 |
| | | /// </summary> |
| | | public void UnloadBattleResources() |
| | | { |
| | | ResourcePreloader.Instance.UnloadConfig("BattleScene"); |
| | | } |
| | | |
| | | public void DestroyBattleField(BattleField battleField) |
| | | { |
| | | if (battleField == null) |