Update 1.1.0

The mod will now be disabled during the checkout tutorials, allowing them to be completed.
This commit is contained in:
pan.codes 2024-05-06 21:06:48 +02:00
parent a01828a080
commit f4a52f207a
2 changed files with 24 additions and 5 deletions

View file

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>CardOnly</AssemblyName> <AssemblyName>CardOnly</AssemblyName>
<Description>My first plugin</Description> <Description>My first plugin</Description>
<Version>1.0.0</Version> <Version>1.1.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>

View file

@ -1,18 +1,37 @@
using BepInEx; using BepInEx;
using HarmonyLib; using HarmonyLib;
using MyBox;
using System;
using UnityEngine; using UnityEngine;
namespace CardOnly namespace CardOnly
{ {
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInIncompatibility("CashOnly")]
public class Plugin : BaseUnityPlugin public class Plugin : BaseUnityPlugin
{ {
bool patched = false;
Harmony harmony;
private void Awake() private void Awake()
{ {
// Plugin startup logic Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded! Applying patch..."); harmony = new Harmony("com.orpticon.CardOnly");
Harmony harmony = new Harmony("com.orpticon.CardOnly"); }
harmony.PatchAll(); private void Update()
{
if (Singleton<OnboardingManager>.Instance != null && Singleton<OnboardingManager>.Instance.Completed && !patched)
{
patched = true;
Logger.LogInfo("Patching...");
// Plugin startup logic
harmony.PatchAll();
}
if (Singleton<OnboardingManager>.Instance != null && !Singleton<OnboardingManager>.Instance.Completed && patched)
{
patched = false;
Logger.LogInfo("Unpatching...");
harmony.UnpatchSelf();
}
} }
} }
public static class PaymentFixerPatch public static class PaymentFixerPatch