1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 22:13:30 +08:00

Add HideTips

This commit is contained in:
2022-08-27 20:10:40 +08:00
parent d692342fb7
commit f871d5ccd5
5 changed files with 101 additions and 3 deletions

63
HideTips/HideTips.cs Normal file
View File

@@ -0,0 +1,63 @@
using System;
using BepInEx;
using HarmonyLib;
namespace HideTips;
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class HideTips : BaseUnityPlugin
{
private new static readonly BepInEx.Logging.ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
private bool _cfgEnabled = true;
private static bool _noRandomReminderTips = true;
private static bool _noTutorialTips = true;
private static bool _noAchievementCardPopups = false;
private static bool _noMilestoneCardPopups = true;
private void Awake()
{
_cfgEnabled = Config.Bind("General", "Enabled", _cfgEnabled, "enable/disable this plugin").Value;
_noRandomReminderTips = Config.Bind("General", "NoRandomReminderTips", _noRandomReminderTips, "Disable Random Reminder Tips").Value;
_noTutorialTips = Config.Bind("General", "NoTutorialTips", _noTutorialTips, "Disable Tutorial Tips").Value;
_noAchievementCardPopups = Config.Bind("General", "NoAchievementCardPopups", _noAchievementCardPopups, "Disable Achievement Card Popups").Value;
_noMilestoneCardPopups = Config.Bind("General", "NoMilestoneCardPopups", _noMilestoneCardPopups, "Disable Milestone Card Popups").Value;
if (!_cfgEnabled) return;
Harmony.CreateAndPatchAll(typeof(HideTips));
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UIBuildMenu), "_OnCreate")]
private static void ClearRandReminderTips(UIBuildMenu __instance)
{
if (!_noRandomReminderTips) return;
foreach (var randTip in __instance.randRemindTips)
{
if (randTip != null)
{
randTip._Free();
}
}
__instance.randRemindTips = Array.Empty<UIRandomTip>();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UITutorialTip), "PopupTutorialTip")]
private static bool SkipTutorialTips()
{
return !_noTutorialTips;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIVariousPopupGroup), "CreateAchievementPopupCard")]
private static bool SkipAchievementCardPopups()
{
return !_noAchievementCardPopups;
}
[HarmonyPrefix] [HarmonyPatch(typeof(UIVariousPopupGroup), "CreateMilestonePopupCard")]
private static bool SkipMilestoneCardPopups()
{
return !_noMilestoneCardPopups;
}
}

24
HideTips/HideTips.csproj Normal file
View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>HideTips</AssemblyName>
<BepInExPluginGuid>org.soardev.hidetips</BepInExPluginGuid>
<Description>DSP MOD - HideTips</Description>
<Version>1.0.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.9.26.13026-r.0" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>
</Project>