generated from dave/MelonTemplate
Add Melonpreferences
This commit is contained in:
@@ -2,15 +2,25 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Il2CppFunGI.ATTT.Game.Gameplay.FinancialReport;
|
using Il2CppFunGI.ATTT.Game.Gameplay.FinancialReport;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ArmsTradeTycoonTanks {
|
namespace ArmsTradeTycoonTanks {
|
||||||
public static class Global {
|
public static class Global {
|
||||||
public static bool Debug = true;
|
private static MelonPreferences_Category category;
|
||||||
public static float MoneyMultiplier = 1.0f;
|
public static MelonPreferences_Entry<bool> Debug;
|
||||||
|
public static MelonPreferences_Entry<float> MoneyMultiplier;
|
||||||
|
|
||||||
|
public static void InitializePreferences() {
|
||||||
|
category = MelonPreferences.CreateCategory("ArmsTradeTycoonTanks");
|
||||||
|
|
||||||
|
Debug = category.CreateEntry("Debug", true, description: "Enable debug mode");
|
||||||
|
MoneyMultiplier = category.CreateEntry("MoneyMultiplier", 1.0f, description: "Multiplier for money gains");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ArmsTradeTycoonTanksMelonMod : MelonMod {
|
public class ArmsTradeTycoonTanksMelonMod : MelonMod {
|
||||||
public override void OnInitializeMelon() {
|
public override void OnInitializeMelon() {
|
||||||
|
Global.InitializePreferences();
|
||||||
LoggerInstance.Msg("Phat Melon mod loaded");
|
LoggerInstance.Msg("Phat Melon mod loaded");
|
||||||
HarmonyLib.Harmony harmony = HarmonyInstance;
|
HarmonyLib.Harmony harmony = HarmonyInstance;
|
||||||
harmony.PatchAll();
|
harmony.PatchAll();
|
||||||
@@ -28,15 +38,15 @@ namespace ArmsTradeTycoonTanks {
|
|||||||
[HarmonyLib.HarmonyPrefix]
|
[HarmonyLib.HarmonyPrefix]
|
||||||
[HarmonyLib.HarmonyPatch(typeof(FinancialReportSystem), "HandleMoneyUpdated")]
|
[HarmonyLib.HarmonyPatch(typeof(FinancialReportSystem), "HandleMoneyUpdated")]
|
||||||
public static void PrefixMoney(ref long __0) {
|
public static void PrefixMoney(ref long __0) {
|
||||||
if (Global.Debug)
|
if (Global.Debug.Value)
|
||||||
Console.WriteLine($"Money is {__0}");
|
Debug.Log($"Money is {__0}");
|
||||||
if (__0 > 0) {
|
if (__0 > 0) {
|
||||||
__0 = (long)(__0 * Global.MoneyMultiplier);
|
__0 = (long)(__0 * Global.MoneyMultiplier.Value);
|
||||||
if (Global.Debug)
|
if (Global.Debug.Value)
|
||||||
Console.WriteLine($"Money modified to {__0}");
|
Debug.Log($"Money modified to {__0}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// [HarmonyLib.HarmonyPostfix]
|
// [HarmonyLib.HarmonyPostfix]
|
||||||
// [HarmonyLib.HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
|
// [HarmonyLib.HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
|
||||||
// public static void PostfixPeoplePerMinute(ref float __result) {
|
// public static void PostfixPeoplePerMinute(ref float __result) {
|
||||||
|
@@ -3,8 +3,10 @@
|
|||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GAME_DIR>C:/Games/Arms Trade Tycoon Tanks</GAME_DIR>
|
<GAME_DIR>C:/Games/Arms Trade Tycoon Tanks</GAME_DIR>
|
||||||
|
<GAME_USER_LIBS>$(GAME_DIR)/UserLibs</GAME_USER_LIBS>
|
||||||
<GAME_MELON>$(GAME_DIR)/MelonLoader</GAME_MELON>
|
<GAME_MELON>$(GAME_DIR)/MelonLoader</GAME_MELON>
|
||||||
<GAME_MANAGED>$(GAME_MELON)/Il2CppAssemblies</GAME_MANAGED>
|
<GAME_MANAGED>$(GAME_MELON)/Il2CppAssemblies</GAME_MANAGED>
|
||||||
|
<GAME_NET6>$(GAME_MELON)/net6</GAME_NET6>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
||||||
@@ -57,6 +59,21 @@
|
|||||||
<Reference Include="Il2CppFunGI">
|
<Reference Include="Il2CppFunGI">
|
||||||
<HintPath>$(GAME_MANAGED)/Il2CppATTT.Game.dll</HintPath>
|
<HintPath>$(GAME_MANAGED)/Il2CppATTT.Game.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Il2CppSystem">
|
||||||
|
<HintPath>$(GAME_MANAGED)/Il2CppSystem.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Il2Cppmscorlib">
|
||||||
|
<HintPath>$(GAME_MANAGED)/Il2Cppmscorlib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Il2CppInterop.Runtime">
|
||||||
|
<HintPath>$(GAME_NET6)/Il2CppInterop.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Il2CppInterop.Common">
|
||||||
|
<HintPath>$(GAME_NET6)/Il2CppInterop.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UrGUI">
|
||||||
|
<HintPath>$(GAME_USER_LIBS)/UrGUI.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||||
</Project>
|
</Project>
|
||||||
|
Reference in New Issue
Block a user