NLDClient-yudde/ProjectNLD/Assets/Editor/Scene/ObjectPostProcessorManager.cs

66 lines
1.9 KiB
C#
Raw Normal View History

2024-01-15 19:26:08 +08:00
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject;
using Gameplay;
using PhxhSDK;
using SRF;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ObjectPostProcessorManager : Singlenton<ObjectPostProcessorManager>
{
2024-01-15 20:25:49 +08:00
private ScenePostProcessor _scenePostProcessor;
2024-01-15 19:26:08 +08:00
2024-01-15 20:25:49 +08:00
private PrefabPostProcessor _prefabPostProcessor;
2024-01-15 19:26:08 +08:00
2024-01-15 20:25:49 +08:00
private ScenePostProcessor scenePostProcessor
2024-01-15 19:26:08 +08:00
{
get
{
2024-01-15 20:25:49 +08:00
_scenePostProcessor = _scenePostProcessor ?? new();
return _scenePostProcessor;
2024-01-15 19:26:08 +08:00
}
}
2024-01-15 20:25:49 +08:00
private PrefabPostProcessor prefabPostProcessor
2024-01-15 19:26:08 +08:00
{
get
{
2024-01-15 20:25:49 +08:00
_prefabPostProcessor = _prefabPostProcessor ?? new();
return _prefabPostProcessor;
2024-01-15 19:26:08 +08:00
}
}
2024-10-22 16:10:43 +08:00
public void PostProcess(Scene scene, bool destroyAfterPostProcess = false, bool defaultCameraParam = true)
2024-01-15 19:26:08 +08:00
{
2024-01-15 20:25:49 +08:00
var instructor = PostProcessor.FindInstructorInScene(scene);
if (instructor == null)
2024-01-15 19:26:08 +08:00
{
2024-01-15 20:25:49 +08:00
Debug.LogError($"cant find PostProcessInstructor in scene,scene name:{scene}");
2024-01-15 19:26:08 +08:00
return;
}
2024-10-22 16:10:43 +08:00
PostProcess(instructor, destroyAfterPostProcess, defaultCameraParam);
2024-01-15 19:26:08 +08:00
}
2024-10-22 16:10:43 +08:00
public void PostProcess(PostProcessInstructor instructor, bool destroyAfterPostProcess = false, bool defaultCameraParam = true)
2024-01-15 19:26:08 +08:00
{
2024-01-15 20:25:49 +08:00
if (instructor.processPrefab)
2024-01-15 19:26:08 +08:00
{
2024-01-16 14:23:05 +08:00
prefabPostProcessor.PostProcess(instructor, destroyAfterPostProcess);
2024-01-15 19:26:08 +08:00
}
2024-01-15 20:25:49 +08:00
else
2024-01-15 19:26:08 +08:00
{
2024-10-22 16:10:43 +08:00
scenePostProcessor.PostProcess(instructor, destroyAfterPostProcess, defaultCameraParam);
2024-01-15 19:26:08 +08:00
}
}
2025-06-16 17:25:12 +08:00
public void PostProcessMore(PostProcessInstructor[] instructors, bool destroyAfterPostProcess = false)
{
scenePostProcessor.PostProcessMore(instructors, destroyAfterPostProcess);
}
2024-01-15 19:26:08 +08:00
}