备份CatanBuilding瘦身独立工程
This commit is contained in:
47
Assets/Scripts/HexGrid/HexMapAct.cs
Normal file
47
Assets/Scripts/HexGrid/HexMapAct.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using asap.core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using System.Threading.Tasks;
|
||||
using GameCore;
|
||||
|
||||
namespace HexGrid
|
||||
{
|
||||
public class HexMapAct :AGameAct
|
||||
{
|
||||
//
|
||||
public string mapName = "hex_build_01";
|
||||
// 地图 Prefab
|
||||
private GameObject _obj;
|
||||
public override async Task<bool> StartAsync()
|
||||
{
|
||||
_obj = await Addressables.InstantiateAsync(mapName).Task;
|
||||
Input.multiTouchEnabled = true;
|
||||
GetUI();
|
||||
return await base.StartAsync();
|
||||
}
|
||||
private async void GetUI()
|
||||
{
|
||||
await Task.Delay(400);
|
||||
await UIManager.Instance.ShowUI(new UIType("HexMapPanel"));
|
||||
}
|
||||
public override async Task StopAsync()
|
||||
{
|
||||
if (_obj)
|
||||
{
|
||||
Addressables.Release(_obj);
|
||||
DestroyImmediate(_obj);
|
||||
}
|
||||
Input.multiTouchEnabled = false;
|
||||
UIManager.Instance.DestroyUI("HexMapPanel");
|
||||
await Awaiters.NextFrame;
|
||||
}
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
Debug.Log("HexGridAct Destroyed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user