zip压缩加载测试
This commit is contained in:
59
Assets/Main/Script/Runtime/HotUpdate/ZoneSystem.cs
Normal file
59
Assets/Main/Script/Runtime/HotUpdate/ZoneSystem.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Stary.Evo;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace Main
|
||||
{
|
||||
public interface IZoneSystem : ISystem
|
||||
{
|
||||
void CreatZone(Transform parent);
|
||||
void OpenCurrentZone(ZoneController CurrentController);
|
||||
}
|
||||
|
||||
public class ZoneSystem : AbstractSystem, IZoneSystem
|
||||
{
|
||||
private ZoneController[] zoneControllers;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建zone碰撞盒
|
||||
/// </summary>
|
||||
public async void CreatZone(Transform parent)
|
||||
{
|
||||
var package = YooAssets.TryGetPackage("Main");
|
||||
var pointHandle = package.LoadAssetAsync<GameObject>(R.Res.Main.prefabs.guideball_zone_prefab);
|
||||
await pointHandle.Task;
|
||||
var zoneDatas = this.GetData<IZoneData>().GetZoneDataAll();
|
||||
zoneControllers = new ZoneController[zoneDatas.Length];
|
||||
for (int i = 0; i < zoneDatas.Length; i++)
|
||||
{
|
||||
var zoneGo = pointHandle.InstantiateSync(parent);
|
||||
ZoneController pointController = zoneGo.GetOrAddComponent<ZoneController>();
|
||||
zoneControllers[i] = pointController;
|
||||
pointController.Init(zoneDatas[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenCurrentZone(ZoneController CurrentController)
|
||||
{
|
||||
foreach (var controller in zoneControllers)
|
||||
{
|
||||
if (controller != CurrentController)
|
||||
{
|
||||
controller.ColsePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user