47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
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!");
|
|
}
|
|
}
|
|
} |