-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.cs
More file actions
84 lines (73 loc) · 2.51 KB
/
Copy pathPlugin.cs
File metadata and controls
84 lines (73 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using BepInEx;
using HarmonyLib;
using System.Reflection;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace ResolutionFix
{
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
public static bool IsHighRes { get; set; } = true;
private void Awake()
{
// Plugin startup logic
Logger.LogInfo($" Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
SceneManager.sceneLoaded += sceneManager_sceneLoaded;
SceneManager.activeSceneChanged += sceneManager_activeSceneChanged;
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.F9))
{
IsHighRes = !IsHighRes;
}
}
private void sceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
{
Logger.LogInfo($" SCENE LOADED: " + scene.name);
fixScene();
}
private void sceneManager_activeSceneChanged(Scene scene1, Scene scene2)
{
var sceneName = scene2.name;
if (sceneName == "Book" || sceneName == "Title" || sceneName == "Pause")
{
IsHighRes = false;
}
else
{
IsHighRes = true;
}
}
private void fixScene()
{
var scene = SceneManager.GetActiveScene();
foreach (var root in scene.GetRootGameObjects())
{
/*
var monitor = root.GetComponentInChildren<Monitor>();
if (monitor != null)
{
monitor.blurAtEdges = false;
monitor.borderTexture = null;
}
var onebit = root.GetComponentInChildren<OneBit>();
if (onebit != null)
{
onebit.linedSettings.distortFringe = false;
}*/
var meshRenderers = root.GetComponentsInChildren<MeshRenderer>();
foreach (var mesh in meshRenderers)
{
if (mesh.gameObject.name.Contains("blur") || mesh.gameObject.name.Contains("Blur"))
{
mesh.gameObject.SetActive(false);
}
}
}
Settings.outputMode = Settings.OutputMode.Digital0;
}
}
}