2025-04-29 16:50:50 +08:00
|
|
|
using PhxhSDK;
|
2024-10-15 13:53:47 +08:00
|
|
|
using UnityEngine;
|
2025-04-28 20:04:57 +08:00
|
|
|
using GameWrapper.Team;
|
2025-04-29 16:50:50 +08:00
|
|
|
using Cysharp.Threading.Tasks;
|
2024-10-15 13:53:47 +08:00
|
|
|
using Constants = Framework.Constants;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
2024-10-08 18:55:13 +08:00
|
|
|
public class TeamPreviewNode : MonoBehaviour
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
|
|
|
|
public Transform[] characterPos;
|
2024-10-11 15:22:03 +08:00
|
|
|
public Transform[] vehiclesPos;
|
2023-10-19 15:00:19 +08:00
|
|
|
public Transform cRoot;
|
|
|
|
|
public Transform vRoot;
|
2025-06-23 19:42:04 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 相机节点
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Transform cameraRoot;
|
|
|
|
|
public CameraStand cameraStand;
|
2025-04-29 16:50:50 +08:00
|
|
|
|
|
|
|
|
public RenderTexture RTexture => TeamServiceHandle.TeamPreviewService.RTexture;
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
public static async UniTask<TeamPreviewNode> LoadNode()
|
|
|
|
|
{
|
2025-04-29 16:50:50 +08:00
|
|
|
var prefab = await AssetManager.Instance.LoadAssetAsync<GameObject>(Constants.TEAM_EDIT_PREFAB_PATH);
|
2023-10-19 15:00:19 +08:00
|
|
|
var go = Instantiate(prefab, Vector3.up, Quaternion.identity);
|
|
|
|
|
var component = go.GetComponent<TeamPreviewNode>();
|
2024-10-08 18:55:13 +08:00
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
return component;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-23 19:42:04 +08:00
|
|
|
public void ReleaseNode(TeamPreviewNode node)
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
2025-04-29 16:50:50 +08:00
|
|
|
TeamServiceHandle.TeamPreviewService.ReleaseNode(node);
|
2023-10-19 15:00:19 +08:00
|
|
|
}
|
|
|
|
|
|
2025-06-23 19:42:04 +08:00
|
|
|
public static void RestoreCamera()
|
|
|
|
|
{
|
|
|
|
|
TeamServiceHandle.TeamPreviewService.RestoreCamera();
|
|
|
|
|
}
|
2025-09-03 16:37:35 +08:00
|
|
|
|
|
|
|
|
public static void ResetCamera()
|
|
|
|
|
{
|
|
|
|
|
TeamServiceHandle.TeamPreviewService.ResetCamera();
|
|
|
|
|
}
|
2025-06-23 19:42:04 +08:00
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
private void Awake()
|
|
|
|
|
{
|
2025-06-23 19:42:04 +08:00
|
|
|
TeamServiceHandle.TeamPreviewService.Init(characterPos, vehiclesPos, cRoot, vRoot, cameraRoot, cameraStand);
|
2024-10-11 15:22:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
{
|
2025-04-29 16:50:50 +08:00
|
|
|
TeamServiceHandle.TeamPreviewService.Release();
|
2024-10-17 13:37:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async UniTask Refresh()
|
2023-10-19 15:00:19 +08:00
|
|
|
{
|
2025-04-29 16:50:50 +08:00
|
|
|
await TeamServiceHandle.TeamPreviewService.Refresh();
|
2023-10-19 15:00:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-01-08 14:39:54 +08:00
|
|
|
public void SetData(int teamIdx, uint[] charIDs, uint[] vehicleIDs, long[] batterys)
|
2024-10-17 13:37:53 +08:00
|
|
|
{
|
2026-01-08 14:39:54 +08:00
|
|
|
TeamServiceHandle.TeamPreviewService.SetData(teamIdx, charIDs, vehicleIDs, batterys);
|
2024-10-17 13:37:53 +08:00
|
|
|
}
|
|
|
|
|
|
2023-11-13 16:23:12 +08:00
|
|
|
public void CreateRt()
|
|
|
|
|
{
|
2025-04-29 16:50:50 +08:00
|
|
|
TeamServiceHandle.TeamPreviewService.CreateRt();
|
2025-04-28 20:04:57 +08:00
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
}
|