57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
using System;
|
|
using System.Reflection;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.Linq;
|
|
|
|
using Barotrauma;
|
|
using HarmonyLib;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Input;
|
|
using System.IO;
|
|
|
|
namespace FastForward
|
|
{
|
|
public partial class Mod : IAssemblyPlugin
|
|
{
|
|
public Harmony harmony;
|
|
|
|
public static Keys FFPressKey = Keys.Q;
|
|
public static Keys FFToggleKey = Keys.None;
|
|
public static bool FFToggleKeyPressed = false;
|
|
public static bool FFState = false;
|
|
public static int FFSpeed = 3;
|
|
|
|
public void Initialize()
|
|
{
|
|
harmony = new Harmony("fastforward");
|
|
|
|
createFolders();
|
|
loadSettings();
|
|
saveSettings();
|
|
|
|
addCommands();
|
|
|
|
harmony.Patch(
|
|
original: typeof(GameMain).GetMethod("Update", AccessTools.all),
|
|
postfix: new HarmonyMethod(typeof(Mod).GetMethod("GameMain_Update_Postfix"))
|
|
);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
harmony.UnpatchAll(harmony.Id);
|
|
harmony = null;
|
|
removeCommands();
|
|
}
|
|
public void OnLoadCompleted() { }
|
|
public void PreInitPatching() { }
|
|
|
|
public static void log(object msg, Color? cl = null, string line = "")
|
|
{
|
|
if (cl == null) cl = Color.Cyan;
|
|
LuaCsLogger.LogMessage($"{line}{msg ?? "null"}", cl, cl);
|
|
}
|
|
}
|
|
} |