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;

namespace FastForward
{
  public partial class Mod : IAssemblyPlugin
  {
    public static void GameMain_Update_Postfix(GameTime gameTime, GameMain __instance)
    {
      bool ts = PlayerInput.GetKeyboardState.IsKeyDown(FFToggleKey);
      if (!FFToggleKeyPressed && ts)
      {
        FFState = !FFState;
      }
      FFToggleKeyPressed = ts;

      if (FFState ^ PlayerInput.GetKeyboardState.IsKeyDown(FFPressKey) && !__instance.Paused)
      {
        for (int i = 0; i < FFSpeed - 1; i++)
        {
          Screen.Selected?.Update(Timing.Step);
        }
      }
    }
  }
}