SHA256
Simplify Singleton in RendererUIManager
This commit is contained in:
2 files changed
+3
-18
No files matched your search
@@ -131,7 +131,7 @@ public static class scnGamePatch
|
|||||||
var isLooping = __instance.levelData.miscSettings.GetBool("loopVideo");
|
var isLooping = __instance.levelData.miscSettings.GetBool("loopVideo");
|
||||||
|
|
||||||
// Initialize player. If targetTexture is null (CameraFarPlane mode), it will build a quad in front of targetCamera.
|
// Initialize player. If targetTexture is null (CameraFarPlane mode), it will build a quad in front of targetCamera.
|
||||||
player.Init(videoPath, __instance.videoBG?.targetTexture, isLooping, targetCamera, __instance.videoBG.gameObject);
|
player.Init(videoPath, __instance.videoBG.targetTexture, isLooping, targetCamera, __instance.videoBG.gameObject);
|
||||||
|
|
||||||
return false; // Skip original UpdateVideo
|
return false; // Skip original UpdateVideo
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-17
@@ -50,20 +50,7 @@ internal sealed class RendererFontProvider : IFontProvider
|
|||||||
|
|
||||||
internal class RendererUIManager : MonoBehaviour
|
internal class RendererUIManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
private static RendererUIManager? _instance;
|
public static RendererUIManager Instance = null!;
|
||||||
public static RendererUIManager Instance
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_instance != null) return _instance;
|
|
||||||
|
|
||||||
var go = new GameObject("RendererUIManager");
|
|
||||||
DontDestroyOnLoad(go);
|
|
||||||
|
|
||||||
_instance = go.AddComponent<RendererUIManager>();
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static O5Context Context => Instance._context;
|
public static O5Context Context => Instance._context;
|
||||||
public O5WindowManager WindowManager => _windowManager;
|
public O5WindowManager WindowManager => _windowManager;
|
||||||
@@ -72,7 +59,7 @@ internal class RendererUIManager : MonoBehaviour
|
|||||||
private O5WindowManager _windowManager = null!;
|
private O5WindowManager _windowManager = null!;
|
||||||
|
|
||||||
private void Awake() {
|
private void Awake() {
|
||||||
_instance = this;
|
Instance = this;
|
||||||
|
|
||||||
_context = new O5Context(
|
_context = new O5Context(
|
||||||
config: new O5Config {
|
config: new O5Config {
|
||||||
@@ -118,7 +105,5 @@ internal class RendererUIManager : MonoBehaviour
|
|||||||
private void OnDestroy() {
|
private void OnDestroy() {
|
||||||
_windowManager.Dispose();
|
_windowManager.Dispose();
|
||||||
_context.Dispose();
|
_context.Dispose();
|
||||||
|
|
||||||
if (_instance == this) _instance = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user