上传文件至 Common
This commit is contained in:
42
Common/DisableBackground.cs
Normal file
42
Common/DisableBackground.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using Monitor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SinmaiAssist.Common;
|
||||
|
||||
public class DisableBackground
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MonitorBackgroundTownController), "SetMainDisp")]
|
||||
public static bool SetMainDisp(MonitorBackgroundTownController __instance, ref bool dispflag)
|
||||
{
|
||||
dispflag = false;
|
||||
DisableSubBackground();
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void DisableSubBackground()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SinmaiAssist.MainConfig.Common.SinglePlayer.HideSubMonitor) return;
|
||||
GameObject leftSubMonitor = GameObject.Find("LeftMonitor")
|
||||
.transform.Find("CommonProcess(Clone)")
|
||||
.transform.Find("RearCanvas")
|
||||
.transform.Find("Sub")
|
||||
.Find("UI_SubBackground").gameObject;
|
||||
leftSubMonitor.SetActive(false);
|
||||
GameObject rightSubMonitor = GameObject.Find("RightMonitor")
|
||||
.transform.Find("CommonProcess(Clone)")
|
||||
.transform.Find("RearCanvas")
|
||||
.transform.Find("Sub")
|
||||
.Find("UI_SubBackground").gameObject;
|
||||
rightSubMonitor.SetActive(false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user