2024-10-11 12:33:39 +08:00
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gameplay.Area
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BuffCellNotice
|
|
|
|
|
|
{
|
|
|
|
|
|
public int cellIndex;
|
|
|
|
|
|
public string loadPath;
|
2024-10-12 13:48:01 +08:00
|
|
|
|
private GameObject _noticeObj;
|
2024-10-11 12:33:39 +08:00
|
|
|
|
|
|
|
|
|
|
public async void CreateView(Transform parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
var sampleObj = await AssetManager.Instance.LoadAssetAsync<GameObject>(loadPath);
|
|
|
|
|
|
if (sampleObj == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-10-12 13:48:01 +08:00
|
|
|
|
_noticeObj = Object.Instantiate(sampleObj, parent);
|
2024-10-11 12:33:39 +08:00
|
|
|
|
var worldPos = AreaManager.instance.GetCellPosByIndex(cellIndex);
|
2024-10-12 13:48:01 +08:00
|
|
|
|
_noticeObj.transform.position = worldPos;
|
|
|
|
|
|
SetActive(false);
|
2024-10-11 12:33:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-12 13:48:01 +08:00
|
|
|
|
public void SetActive(bool setValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_noticeObj == null) return;
|
|
|
|
|
|
_noticeObj.SetActive(setValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-11 12:33:39 +08:00
|
|
|
|
public void Dispose()
|
|
|
|
|
|
{
|
2024-10-12 13:48:01 +08:00
|
|
|
|
Object.Destroy(_noticeObj);
|
|
|
|
|
|
_noticeObj = null;
|
2024-10-11 12:33:39 +08:00
|
|
|
|
AssetManager.Instance.Unload(loadPath);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|