Skip to content

Commit

Permalink
添加 DisableBackgroud(关闭背景) SkipFade(跳过过场动画) 功能
Browse files Browse the repository at this point in the history
  • Loading branch information
WYH2004-MC committed Oct 6, 2024
1 parent dcd2c4c commit 057798b
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 3 deletions.
4 changes: 2 additions & 2 deletions BuildInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace SinmaiAssist {
public static partial class BuildInfo {
public const string CommitHash = "6fba1e6";
public const string BuildDate = "2024-10-04T12:49:39.1283596+08:00";
public const string CommitHash = "dcd2c4c";
public const string BuildDate = "2024-10-07T03:09:30.3189038+08:00";
}
}
42 changes: 42 additions & 0 deletions Common/DisableBackgroud.cs
Original file line number Diff line number Diff line change
@@ -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.config.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
}
}
}
22 changes: 22 additions & 0 deletions Common/SkipFade.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using HarmonyLib;

namespace SinmaiAssist.Common;

public class SkipFade
{
[HarmonyPrefix]
[HarmonyPatch(typeof(FadeProcess), "OnStart")]
public static bool OnStart(FadeProcess __instance)
{
__instance.ProcessingProcess();
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(FadeProcess), "StartFadeIn")]
public static bool StartFadeIn(FadeProcess __instance)
{
__instance.ProcessingProcess();
return false;
}
}
2 changes: 2 additions & 0 deletions ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ public class CommonConfig
{
public bool InfinityTimer { get; set; }
public bool DisableMask { get; set; }
public bool DisableBackground { get; set; }
public bool ShowFPS { get; set; }
public bool ForwardATouchRegionToButton { get; set; }
public bool SkipFade { get; set; }
public bool SkipWarningScreen { get; set; }
public bool QuickBoot { get; set; }
public bool BlockCoin { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ public override void OnInitializeMelon()

// Common
if (config.Common.InfinityTimer) Patch(typeof(InfinityTimer));
if (config.Common.DisableBackground) Patch(typeof(DisableBackground));
if (config.Common.DisableMask) Patch(typeof(DisableMask));
if (config.Common.SinglePlayer.Enable) Patch(typeof(SinglePlayer));
if (config.Common.ForwardATouchRegionToButton) Patch(typeof(ForwardATouchRegionToButton));
if (config.Common.QuickBoot) Patch(typeof(QuickBoot));
if (config.Common.BlockCoin) Patch(typeof(BlockCoin));
if (config.Common.SkipWarningScreen) Patch(typeof(SkipWarningScreen));
if (config.Common.SkipFade) Patch(typeof(SkipFade));
if (config.Common.NetworkLogger.Enable) Patch(typeof(NetworkLogger));
if (config.Common.CustomVersionText.Enable) Patch(typeof(CustomVersionText));
if (config.Common.IgnoreAnyGameInformation) Patch(typeof(IgnoreAnyGameInformation));
Expand Down
4 changes: 3 additions & 1 deletion Sinmai-Assist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ProjectGuid>{788BC472-59F7-46F6-B760-65C18BA74389}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sinmai-SlimMod</RootNamespace>
<RootNamespace>SinmaiAssist</RootNamespace>
<AssemblyName>Sinmai-Assist</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -476,6 +476,8 @@
<Compile Include="Common\ChangeDefaultOption.cs" />
<Compile Include="Common\ChangeFadeStyle.cs" />
<Compile Include="Common\CustomVersionText.cs" />
<Compile Include="Common\DisableBackgroud.cs" />
<Compile Include="Common\SkipFade.cs" />
<Compile Include="Common\DisableMask.cs" />
<Compile Include="Common\DummyAimeLogin.cs" />
<Compile Include="Common\DummyChimeLogin.cs" />
Expand Down
2 changes: 2 additions & 0 deletions config - zh_CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
common:
infinityTimer: false #无限计时器
disableMask: false #禁用遮罩
disableBackground: false #禁用背景
showFPS: false #显示FPS
singlePlayer: #单人模式
enable: false # 是否启用
hideSubMonitor: false # 隐藏副屏
forwardATouchRegionToButton: false #将触摸区域的操作转发到按钮
skipFade: false #跳过过场动画
skipWarningScreen: false #跳过警告界面
quickBoot: false #快速启动
blockCoin: false #禁用点数消耗
Expand Down
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
common:
infinityTimer: false
disableMask: false
disableBackground: false
showFPS: false
singlePlayer:
enable: false
hideSubMonitor: false
forwardATouchRegionToButton: false
skipFade: false
skipWarningScreen: false
quickBoot: false
blockCoin: false
Expand Down

0 comments on commit 057798b

Please sign in to comment.