SHA256
forked from ADOFAIEditorForum/ADOFAIRenderer
Add Auto UI Initialization
This commit is contained in:
3 files changed
+34
-14
No files matched your search
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using ADOFAIRenderer.API;
|
||||
using ADOFAIRenderer.Data;
|
||||
using ADOFAIRenderer.UI;
|
||||
using ADOFAIRenderer.UI.Window;
|
||||
using ADOFAIRenderer.Util;
|
||||
using ADOFAIRenderer.Util.Audio;
|
||||
using ADOFAIRenderer.Util.FFmpeg;
|
||||
@@ -336,7 +337,8 @@ internal class RenderManager : MonoBehaviour
|
||||
(Func<bool>)Delegate.CreateDelegate(typeof(Func<bool>), scnEditor.instance, targetMethod);
|
||||
|
||||
Application.wantsToQuit -= quitDelegate;
|
||||
ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "Assets/Scenes/RenderSettingsScene.unity");
|
||||
RenderConfigWindow.CreateWindow();
|
||||
// ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "Assets/Scenes/RenderSettingsScene.unity");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -19,8 +19,6 @@ internal class RenderMod : MelonMod
|
||||
{
|
||||
public static AssetBundle FontBundle = null!;
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public static AssetBundle SceneBundle = null!;
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public static AssetBundle ShaderBundle = null!;
|
||||
public static ComputeShader ColorConversionShader = null!;
|
||||
public static bool IsFeatureDisabled = false;
|
||||
@@ -33,19 +31,20 @@ internal class RenderMod : MelonMod
|
||||
|
||||
var renderManagerObj = new GameObject("Render Manager");
|
||||
var updateHookerObj = new GameObject("Update Hooker");
|
||||
var uiManagerObj = new GameObject("Renderer UI Manager");
|
||||
Object.DontDestroyOnLoad(renderManagerObj);
|
||||
Object.DontDestroyOnLoad(updateHookerObj);
|
||||
Object.DontDestroyOnLoad(uiManagerObj);
|
||||
|
||||
renderManagerObj.AddComponent<RenderManager>();
|
||||
updateHookerObj.AddComponent<FirstUpdateHook>();
|
||||
uiManagerObj.AddComponent<UI.RendererUIManager>();
|
||||
LoadBundles();
|
||||
}
|
||||
|
||||
private static void LoadBundles()
|
||||
{
|
||||
FontBundle = BundleLoader.GetBundle("fonts");
|
||||
SceneBundle = BundleLoader.GetBundle("scenes");
|
||||
SceneBundle.GetAllScenePaths();
|
||||
try
|
||||
{
|
||||
ShaderBundle = BundleLoader.GetBundle("shaders");
|
||||
|
||||
+28
-9
@@ -1,4 +1,4 @@
|
||||
using O5Kit.Core;
|
||||
using O5Kit.Core;
|
||||
|
||||
namespace ADOFAIRenderer.UI;
|
||||
|
||||
@@ -6,15 +6,32 @@ using UnityEngine;
|
||||
|
||||
public class RendererUIManager : MonoBehaviour
|
||||
{
|
||||
public static RendererUIManager Instance { get; private set; } = null!;
|
||||
private static RendererUIManager? _instance;
|
||||
public static RendererUIManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
var go = new GameObject("RendererUIManager");
|
||||
DontDestroyOnLoad(go);
|
||||
_instance = go.AddComponent<RendererUIManager>();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public static O5Context Context = null!;
|
||||
public O5WindowManager WindowManager = null!;
|
||||
public static O5Context Context => Instance._context;
|
||||
public O5WindowManager WindowManager => _windowManager;
|
||||
|
||||
private O5Context _context = null!;
|
||||
private O5WindowManager _windowManager = null!;
|
||||
|
||||
private void Awake() {
|
||||
Instance = this;
|
||||
_instance = this;
|
||||
|
||||
Context = new O5Context(
|
||||
_context = new O5Context(
|
||||
config: new O5Config {
|
||||
UIScale = 1.0f,
|
||||
MiddleClickToDefault = true,
|
||||
@@ -23,7 +40,7 @@ public class RendererUIManager : MonoBehaviour
|
||||
theme: O5Theme.Dark
|
||||
);
|
||||
|
||||
WindowManager = O5WindowManager.Create(Context, transform, "RendererMod_Canvas");
|
||||
_windowManager = O5WindowManager.Create(_context, transform, "RendererMod_Canvas");
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
@@ -33,7 +50,9 @@ public class RendererUIManager : MonoBehaviour
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
WindowManager.Dispose();
|
||||
Context.Dispose();
|
||||
_windowManager.Dispose();
|
||||
_context.Dispose();
|
||||
|
||||
if (_instance == this) _instance = null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user