2024-08-06 15:34:36 +08:00
|
|
|
|
# TsScreenPlayerTextureRenderer
|
|
|
|
|
- MultiViewActor: UE.MultiViewActor;// 用于渲染pvw/pgm画面
|
2024-08-06 14:44:20 +08:00
|
|
|
|
|
2024-08-06 15:34:36 +08:00
|
|
|
|
- ReceiveBeginPlay() =>
|
|
|
|
|
- this.RegisterLocalEventListener(); =>
|
|
|
|
|
- this.ChangeCameraTask(TaskData);
|
|
|
|
|
## RegisterLocalEventListener
|
|
|
|
|
```ts
|
|
|
|
|
private RegisterLocalEventListener(): void {
|
|
|
|
|
this.PVWCameraChangeFunc = (TaskData: UE.CamTaskDataRPC) => {
|
|
|
|
|
if (this.CurTag == DirectorMode.PVWCameraRenderer) {
|
|
|
|
|
this.ChangeCameraTask(TaskData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.PGMCameraChangeFunc = (TaskData: UE.CamTaskDataRPC) => {
|
|
|
|
|
if (this.CurTag == DirectorMode.PGMCameraRenderer) {
|
|
|
|
|
this.ChangeCameraTask(TaskData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.SwitchDirectorNetTagFunc = (oldTag: UE.GameplayTag, newTag: UE.GameplayTag) => {
|
|
|
|
|
this.SwitchDirectorNetTagCallback(oldTag, newTag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.OnPVWTaskRequested, this.PVWCameraChangeFunc);
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.OnPGMTaskRequested, this.PGMCameraChangeFunc);
|
|
|
|
|
DirectorEventSystem.RegisterEventListener(this, DirectorEvent.SwitchDirectorMode, this.SwitchDirectorNetTagFunc)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
## ChangeCameraTask
|
|
|
|
|
```ts
|
|
|
|
|
ChangeCameraTask(TaskData: UE.CamTaskDataRPC) {
|
|
|
|
|
if(!this.bStarted){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.DirectorCamManagerActor == null){
|
|
|
|
|
this.DirectorCamManagerActor = this.GetCameraManagerActor();
|
|
|
|
|
}
|
|
|
|
|
// double check
|
|
|
|
|
if(this.DirectorCamManagerActor == null){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.Task) {
|
|
|
|
|
this.Task.Stop();
|
|
|
|
|
}
|
|
|
|
|
this.Task = DirectorCamUtil.CreateCamTask(this, TaskData, CamTaskType.FullStream, this.DirectorCamManagerActor.droneCamera, null, this.DirectorCamManagerActor.handHeldCamera)
|
|
|
|
|
if (this.Task) {
|
|
|
|
|
this.Task.Start()
|
|
|
|
|
this.BindCamera(this.Task.TryGetBindedMainCamera());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|