using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BaboonAPI.Hooks.Initializer;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TootTallyCore;
using TootTallyCore.Graphics;
using TootTallyCore.Utils.TootTallyGlobals;
using TootTallyCore.Utils.TootTallyModules;
using TootTallySettings;
using TrombLoader.Data;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TootTallyAutoToot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("AutoToot module for TootTallyCore")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+ff678aae98e05703d0e19430de1a1de6b3391d65")]
[assembly: AssemblyProduct("TootTallyAutoToot")]
[assembly: AssemblyTitle("TootTallyAutoToot")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace TootTallyAutoToot
{
public class AutoTootController : MonoBehaviour
{
private GameController _gameController;
private GameObject _pointer;
private TMP_Text _autoTootText;
private RectTransform _pointerRect;
private float _lastTimeSample;
private float _trackTime;
private float _lastTrackTime;
private float _estimatedTrackTime;
private float _lastNoteStartTime;
private float _lastNoteEndTime;
private float _currentNoteStartTime;
private float _currentNoteEndTime;
private float _lastNoteStartY;
private float _lastNoteEndY;
private float _currentNoteStartY;
private float _currentNoteEndY;
private bool _isSlider;
private int _noteIndex;
private float _earlyTimingAdjustValue;
private float _lateTimingAdjustValue;
private bool _releasedBetweenNotes;
private bool _shouldBreath;
private bool _isNoteActive;
public bool isEnabled;
public bool isTooting;
public Vector2 pointerPosition;
private static Func<float, float> _currentEasing;
public void Init(GameController gameController)
{
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
_gameController = gameController;
_pointer = _gameController.pointer;
_pointerRect = _gameController.pointerrect;
isEnabled = false;
isTooting = false;
_isSlider = false;
_shouldBreath = false;
_isNoteActive = false;
_releasedBetweenNotes = true;
_noteIndex = -1;
if (_gameController.leveldata.Count > 0)
{
_currentNoteStartTime = B2s(_gameController.leveldata[0][0], _gameController.tempo);
_currentNoteEndTime = _currentNoteStartTime + B2s(_gameController.leveldata[0][1], _gameController.tempo);
_currentNoteStartY = _gameController.leveldata[0][2];
_currentNoteEndY = _gameController.leveldata[0][4];
}
_lastNoteStartY = 0f;
_lastNoteEndY = 0f;
_lastNoteEndTime = -999f;
_lastNoteStartTime = -999f;
_lastTrackTime = (_trackTime = 0f);
_lastTimeSample = 0f;
pointerPosition = _pointerRect.anchoredPosition;
_currentEasing = EasingHelper.GetCurrentEasing(Plugin.Instance.EasingType.Value);
_earlyTimingAdjustValue = Plugin.Instance.EarlyTimingAdjust.Value / 1000f * TootTallyGlobalVariables.gameSpeedMultiplier;
_lateTimingAdjustValue = Plugin.Instance.LateTimingAdjust.Value / 1000f * TootTallyGlobalVariables.gameSpeedMultiplier;
_autoTootText = GameObjectFactory.CreateSingleText(((Component)_gameController.ui_score_shadow).transform.parent.parent, "AutoTootText", "AutoToot Enabled", (TextFont)1);
_autoTootText.rectTransform.anchoredPosition = new Vector2(0f, Plugin.Instance.DistanceFromBottom.Value);
RectTransform rectTransform = _autoTootText.rectTransform;
RectTransform rectTransform2 = _autoTootText.rectTransform;
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0.5f, 0f);
rectTransform2.anchorMin = val;
rectTransform.anchorMax = val;
_autoTootText.rectTransform.pivot = new Vector2(0.5f, 1f);
_autoTootText.rectTransform.sizeDelta = new Vector2(200f, 14f);
_autoTootText.fontSize = Plugin.Instance.TextSize.Value;
_autoTootText.fontStyle = (FontStyles)18;
((Component)_autoTootText).gameObject.SetActive(false);
}
public void Update()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
if (_gameController.freeplay)
{
return;
}
if (Input.GetKeyDown(Plugin.Instance.ToggleKey.Value))
{
ToggleEnable();
}
if (!_gameController.paused && !_gameController.quitting && _gameController.musictrack.isPlaying)
{
UpdateTrackData();
}
if (isEnabled)
{
TootTallyGlobalVariables.usedAutotoot = true;
if (Plugin.Instance.PerfectPlay.Value)
{
_gameController.breathcounter = 0f;
}
else if (!_shouldBreath && ((_gameController.breathcounter >= 0.95f && _isNoteActive) || (!_isNoteActive && _gameController.breathcounter >= 0.5f)))
{
_shouldBreath = true;
}
else if (_shouldBreath && ((_gameController.breathcounter <= 0.65f && _isNoteActive) || (!_isNoteActive && _gameController.breathcounter <= 0f)))
{
_shouldBreath = false;
}
isTooting = ShouldToot();
if (!isTooting)
{
_releasedBetweenNotes = true;
}
pointerPosition.y = GetPositionY();
_pointerRect.anchoredPosition = pointerPosition;
}
}
private void UpdateTrackData()
{
float deltaTime = Time.deltaTime;
_trackTime += deltaTime * TootTallyGlobalVariables.gameSpeedMultiplier;
if (_lastTimeSample != (float)_gameController.musictrack.timeSamples)
{
_lastTrackTime = _gameController.musictrack.time - _gameController.noteoffset - _gameController.latency_offset;
_lastTimeSample = _gameController.musictrack.timeSamples;
}
_trackTime += (_lastTrackTime - _trackTime) / 60f;
if (_trackTime >= _currentNoteEndTime)
{
_noteIndex++;
if (_noteIndex + 1 < _gameController.leveldata.Count)
{
_lastNoteStartTime = _currentNoteStartTime;
_lastNoteEndTime = _currentNoteEndTime + _lateTimingAdjustValue;
_lastNoteStartY = _currentNoteStartY;
_lastNoteEndY = _currentNoteEndY;
_isSlider = Mathf.Abs(_gameController.leveldata[_noteIndex + 1][0] - (_gameController.leveldata[_noteIndex][0] + _gameController.leveldata[_noteIndex][1])) < 0.05f;
_currentNoteStartTime = B2s(_gameController.leveldata[_noteIndex + 1][0], _gameController.tempo);
_currentNoteEndTime = _currentNoteStartTime + B2s(_gameController.leveldata[_noteIndex + 1][1], _gameController.tempo);
_currentNoteStartY = _gameController.leveldata[_noteIndex + 1][2];
_currentNoteEndY = _gameController.leveldata[_noteIndex + 1][4];
_lastNoteEndTime = Mathf.Min(_lastNoteEndTime, _currentNoteStartTime - 0.01f);
_releasedBetweenNotes = !isTooting;
}
else
{
_currentNoteStartTime = float.MaxValue;
_isSlider = false;
}
}
_isNoteActive = _trackTime >= _currentNoteStartTime - deltaTime * 5f && _trackTime < _currentNoteEndTime + deltaTime * 5f;
}
public void ToggleEnable()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
isEnabled = !isEnabled;
_gameController.controllermode = isEnabled;
_lastNoteEndTime = _trackTime - 0.01f;
_lastNoteEndY = _pointerRect.anchoredPosition.y;
Plugin.LogInfo("AutoToot " + (isEnabled ? "Enabled" : "Disabled") + ".");
((Component)_autoTootText).gameObject.SetActive(isEnabled);
}
private bool ShouldToot()
{
return ((_trackTime >= Mathf.Max(_currentNoteStartTime - (Plugin.Instance.SyncTootWithSong.Value ? _gameController.latency_offset : _earlyTimingAdjustValue), _lastNoteEndTime) && _releasedBetweenNotes) || _trackTime <= _lastNoteEndTime || _isSlider) && !_shouldBreath && _trackTime > 0.01f;
}
private float GetPositionY()
{
float arg;
if (!(_trackTime >= _currentNoteStartTime - _earlyTimingAdjustValue) || !(_trackTime <= _currentNoteEndTime + _lateTimingAdjustValue))
{
float num = _currentNoteStartTime - _earlyTimingAdjustValue;
arg = Mathf.Clamp(1f - (num - _trackTime) / (num - _lastNoteEndTime), 0f, 1f);
return Mathf.Lerp(_lastNoteEndY, _currentNoteStartY, _currentEasing(arg));
}
arg = ((_currentNoteStartY == _currentNoteEndY) ? Mathf.Clamp(1f - (_currentNoteEndTime - _trackTime) / (_currentNoteEndTime - (_currentNoteStartTime - _earlyTimingAdjustValue)), 0f, 1f) : Mathf.Clamp(1f - (_currentNoteEndTime - _trackTime - 0.005555f * TootTallyGlobalVariables.gameSpeedMultiplier) / (_currentNoteEndTime - _currentNoteStartTime), 0f, 1f));
return _currentNoteStartY + _gameController.easeInOutVal(Mathf.Abs(arg), 0f, _currentNoteEndY - _currentNoteStartY, 1f);
}
public static float B2s(float time, float bpm)
{
return time / bpm * 60f;
}
}
public static class AutoTootManager
{
private static AutoTootController _controller;
private static TromboneEventManager[] _eventManagers;
private static BackgroundPuppetController _bgPuppetController;
private static Vector2 _screenDim;
private static bool _lastIsTooting;
[HarmonyPatch(typeof(GameController), "Start")]
[HarmonyPostfix]
public static void OnGameControllerStartSetEasingFunction(GameController __instance)
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
_controller = __instance.pointer.AddComponent<AutoTootController>();
_controller.Init(__instance);
if ((Object)(object)__instance.bgcontroller != (Object)null)
{
_eventManagers = __instance.bgcontroller.fullbgobject.GetComponentsInChildren<TromboneEventManager>();
_bgPuppetController = __instance.bgcontroller.fullbgobject.GetComponent<BackgroundPuppetController>();
}
else
{
_eventManagers = null;
_bgPuppetController = null;
}
_lastIsTooting = false;
_screenDim = new Vector2((float)Screen.width, (float)Screen.height);
TootTallyGlobalVariables.usedAutotoot = false;
}
[HarmonyPatch(typeof(GameController), "getScoreAverage")]
[HarmonyPrefix]
public static void OnGameControllerGetScoreAverageSetPerfectPlay(GameController __instance)
{
if (Plugin.Instance.PerfectPlay.Value && _controller.isEnabled)
{
__instance.notescoreaverage = 100f;
__instance.notescoretotal = 100f;
__instance.released_button_between_notes = true;
__instance.released_during_timing_window = true;
__instance.force_no_gap_gameobject_to_appear = false;
__instance.notescoresamples = 1f;
}
}
[HarmonyPatch(typeof(GameController), "doScoreText")]
[HarmonyPrefix]
public static void OnGameControllerDoScoreTextSetPerfectPlay(ref int whichtext, ref float notescore)
{
if (Plugin.Instance.PerfectPlay.Value && _controller.isEnabled)
{
whichtext = 4;
notescore = 100f;
}
}
[HarmonyPatch(typeof(GameController), "Update")]
[HarmonyPostfix]
public static void OnGameControllerUpdateSetPointerPosition(GameController __instance)
{
if (_controller.isEnabled)
{
__instance.puppet_humanc.doPuppetControl((0f - _controller.pointerPosition.y) / 225f);
BackgroundPuppetController bgPuppetController = _bgPuppetController;
if (bgPuppetController != null)
{
bgPuppetController.DoPuppetControl((0f - _controller.pointerPosition.y) / 225f, __instance.vibratoamt);
}
}
}
[HarmonyPatch(typeof(GameController), "isNoteButtonPressed")]
[HarmonyPostfix]
public static void OnIsNoteButtonPressedOverwriteValue(GameController __instance, ref bool __result)
{
if (_controller.isEnabled && !__instance.freeplay && !__instance.paused && !__instance.quitting)
{
__result = _controller.isTooting;
}
}
[HarmonyPatch(typeof(TromboneEventInvoker), "LateUpdate")]
[HarmonyPostfix]
public static void TromboneEventInvokerPostfix(TromboneEventInvoker __instance)
{
if (!_controller.isEnabled || _eventManagers == null)
{
return;
}
if (_controller.isTooting)
{
if (_lastIsTooting)
{
return;
}
_lastIsTooting = true;
TromboneEventManager[] eventManagers = _eventManagers;
foreach (TromboneEventManager val in eventManagers)
{
UnityEvent playerTootInputStart = val.PlayerTootInputStart;
if (playerTootInputStart != null)
{
playerTootInputStart.Invoke();
}
}
}
else
{
if (!_lastIsTooting)
{
return;
}
_lastIsTooting = false;
TromboneEventManager[] eventManagers2 = _eventManagers;
foreach (TromboneEventManager val2 in eventManagers2)
{
UnityEvent playerTootInputEnd = val2.PlayerTootInputEnd;
if (playerTootInputEnd != null)
{
playerTootInputEnd.Invoke();
}
}
}
}
[HarmonyPatch(typeof(TromboneEventManager), "Update")]
[HarmonyPostfix]
public static void TromboneEventManagerPostfix(TromboneEventManager __instance)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (_controller.isEnabled && _eventManagers != null)
{
Vector2 val = ConvertPointerPosToMousePos(_controller.pointerPosition);
Traverse.Create((object)__instance).Field("mousePosition").SetValue((object)val);
((UnityEvent<Vector3>)(object)__instance.MousePositionUpdated).Invoke(Vector2.op_Implicit(new Vector2(val.x / _screenDim.x, val.y / _screenDim.y)));
}
}
private static Vector2 ConvertPointerPosToMousePos(Vector2 pointerPos)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
pointerPos.y = (pointerPos.y + 225f) / 450f * _screenDim.y;
pointerPos.x /= _screenDim.x;
return pointerPos;
}
[HarmonyPatch(typeof(PointSceneController), "updateSave")]
[HarmonyPrefix]
public static bool AvoidSaveChange()
{
return !TootTallyGlobalVariables.usedAutotoot;
}
[HarmonyPatch(typeof(PointSceneController), "checkScoreCheevos")]
[HarmonyPrefix]
public static bool AvoidAchievementCheck()
{
return !TootTallyGlobalVariables.usedAutotoot;
}
[HarmonyPatch(typeof(PointSceneController), "doCoins")]
[HarmonyPostfix]
public static void ReplayIndicator(PointSceneController __instance)
{
if (TootTallyGlobalVariables.usedAutotoot)
{
__instance.tootstext.text = "AutoToot Done";
}
}
}
public static class EasingHelper
{
public enum EasingType
{
Linear,
InQuad,
OutQuad,
InOutQuad,
InCubic,
OutCubic,
InOutCubic,
InQuart,
OutQuart,
InOutQuart,
InQuint,
OutQuint,
InOutQuint,
InSine,
OutSine,
InOutSine,
InExpo,
OutExpo,
InOutExpo,
InCirc,
OutCirc,
InOutCirc,
InElastic,
OutElastic,
InOutElastic,
InBack,
OutBack,
InOutBack,
InBounce,
OutBounce,
InOutBounce
}
public static Func<float, float> GetCurrentEasing(EasingType easing)
{
if (1 == 0)
{
}
Func<float, float> result = easing switch
{
EasingType.Linear => Linear,
EasingType.InQuad => InQuad,
EasingType.OutQuad => OutQuad,
EasingType.InOutQuad => InOutQuad,
EasingType.InCubic => InCubic,
EasingType.OutCubic => OutCubic,
EasingType.InOutCubic => InOutCubic,
EasingType.InQuart => InQuart,
EasingType.OutQuart => OutQuart,
EasingType.InOutQuart => InOutQuart,
EasingType.InQuint => InQuint,
EasingType.OutQuint => OutQuint,
EasingType.InOutQuint => InOutQuint,
EasingType.InSine => InSine,
EasingType.OutSine => OutSine,
EasingType.InOutSine => InOutSine,
EasingType.InExpo => InExpo,
EasingType.OutExpo => OutExpo,
EasingType.InOutExpo => InOutExpo,
EasingType.InCirc => InCirc,
EasingType.OutCirc => OutCirc,
EasingType.InOutCirc => InOutCirc,
EasingType.InElastic => InElastic,
EasingType.OutElastic => OutElastic,
EasingType.InOutElastic => InOutElastic,
EasingType.InBack => InBack,
EasingType.OutBack => OutBack,
EasingType.InOutBack => InOutBack,
EasingType.InBounce => InBounce,
EasingType.OutBounce => OutBounce,
_ => InOutBounce,
};
if (1 == 0)
{
}
return result;
}
public static float Linear(float t)
{
return t;
}
public static float InQuad(float t)
{
return t * t;
}
public static float OutQuad(float t)
{
return 1f - InQuad(1f - t);
}
public static float InOutQuad(float t)
{
if ((double)t < 0.5)
{
return InQuad(t * 2f) / 2f;
}
return 1f - InQuad((1f - t) * 2f) / 2f;
}
public static float InCubic(float t)
{
return t * t * t;
}
public static float OutCubic(float t)
{
return 1f - InCubic(1f - t);
}
public static float InOutCubic(float t)
{
if ((double)t < 0.5)
{
return InCubic(t * 2f) / 2f;
}
return 1f - InCubic((1f - t) * 2f) / 2f;
}
public static float InQuart(float t)
{
return t * t * t * t;
}
public static float OutQuart(float t)
{
return 1f - InQuart(1f - t);
}
public static float InOutQuart(float t)
{
if ((double)t < 0.5)
{
return InQuart(t * 2f) / 2f;
}
return 1f - InQuart((1f - t) * 2f) / 2f;
}
public static float InQuint(float t)
{
return t * t * t * t * t;
}
public static float OutQuint(float t)
{
return 1f - InQuint(1f - t);
}
public static float InOutQuint(float t)
{
if ((double)t < 0.5)
{
return InQuint(t * 2f) / 2f;
}
return 1f - InQuint((1f - t) * 2f) / 2f;
}
public static float InSine(float t)
{
return (float)(0.0 - Math.Cos((double)t * Math.PI / 2.0));
}
public static float OutSine(float t)
{
return (float)Math.Sin((double)t * Math.PI / 2.0);
}
public static float InOutSine(float t)
{
return (float)(Math.Cos((double)t * Math.PI) - 1.0) / -2f;
}
public static float InExpo(float t)
{
return (float)Math.Pow(2.0, 10f * (t - 1f));
}
public static float OutExpo(float t)
{
return 1f - InExpo(1f - t);
}
public static float InOutExpo(float t)
{
if ((double)t < 0.5)
{
return InExpo(t * 2f) / 2f;
}
return 1f - InExpo((1f - t) * 2f) / 2f;
}
public static float InCirc(float t)
{
return 0f - ((float)Math.Sqrt(1f - t * t) - 1f);
}
public static float OutCirc(float t)
{
return 1f - InCirc(1f - t);
}
public static float InOutCirc(float t)
{
if ((double)t < 0.5)
{
return InCirc(t * 2f) / 2f;
}
return 1f - InCirc((1f - t) * 2f) / 2f;
}
public static float InElastic(float t)
{
return 1f - OutElastic(1f - t);
}
public static float OutElastic(float t)
{
float num = 0.3f;
return (float)Math.Pow(2.0, -10f * t) * (float)Math.Sin((double)(t - num / 4f) * (Math.PI * 2.0) / (double)num) + 1f;
}
public static float InOutElastic(float t)
{
if ((double)t < 0.5)
{
return InElastic(t * 2f) / 2f;
}
return 1f - InElastic((1f - t) * 2f) / 2f;
}
public static float InBack(float t)
{
float num = 1.70158f;
return t * t * ((num + 1f) * t - num);
}
public static float OutBack(float t)
{
return 1f - InBack(1f - t);
}
public static float InOutBack(float t)
{
if ((double)t < 0.5)
{
return InBack(t * 2f) / 2f;
}
return 1f - InBack((1f - t) * 2f) / 2f;
}
public static float InBounce(float t)
{
return 1f - OutBounce(1f - t);
}
public static float OutBounce(float t)
{
float num = 2.75f;
float num2 = 7.5625f;
if (t < 1f / num)
{
return num2 * t * t;
}
if (t < 2f / num)
{
t -= 1.5f / num;
return num2 * t * t + 0.75f;
}
if ((double)t < 2.5 / (double)num)
{
t -= 2.25f / num;
return num2 * t * t + 0.9375f;
}
t -= 2.625f / num;
return num2 * t * t + 63f / 64f;
}
public static float InOutBounce(float t)
{
if ((double)t < 0.5)
{
return InBounce(t * 2f) / 2f;
}
return 1f - InBounce((1f - t) * 2f) / 2f;
}
}
[BepInPlugin("TootTallyAutoToot", "TootTallyAutoToot", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInIncompatibility("AutoToot")]
public class Plugin : BaseUnityPlugin, ITootTallyModule
{
public static Plugin Instance;
private const string CONFIG_NAME = "TTAutoToot.cfg";
private Harmony _harmony;
public static TootTallySettingPage settingPage;
public ConfigEntry<bool> ModuleConfigEnabled { get; set; }
public bool IsConfigInitialized { get; set; }
public string Name
{
get
{
return "TootTallyAutoToot";
}
set
{
Name = value;
}
}
public ConfigEntry<KeyCode> ToggleKey { get; set; }
public ConfigEntry<EasingHelper.EasingType> EasingType { get; set; }
public ConfigEntry<float> EarlyTimingAdjust { get; set; }
public ConfigEntry<float> LateTimingAdjust { get; set; }
public ConfigEntry<bool> SyncTootWithSong { get; set; }
public ConfigEntry<bool> PerfectPlay { get; set; }
public ConfigEntry<bool> ShowAutoTootText { get; set; }
public ConfigEntry<float> DistanceFromBottom { get; set; }
public ConfigEntry<float> TextSize { get; set; }
public static void LogInfo(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
}
public static void LogError(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogError((object)msg);
}
private void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
if (!((Object)(object)Instance != (Object)null))
{
Instance = this;
_harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize);
}
}
private void TryInitialize()
{
ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Module", "TTAutoToot", true, "Bot that automatically plays the song for you.");
TootTallyModuleManager.AddModule((ITootTallyModule)(object)this);
Plugin.Instance.AddModuleToSettingPage((ITootTallyModule)(object)this);
}
public void LoadModule()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(Paths.BepInExRootPath, "config/");
ConfigFile val = new ConfigFile(text + "TTAutoToot.cfg", true)
{
SaveOnConfigSet = true
};
ToggleKey = val.Bind<KeyCode>("General", "ToggleKey", (KeyCode)282, "Enable / Disable AutoToot.");
EasingType = val.Bind<EasingHelper.EasingType>("General", "EasingType", EasingHelper.EasingType.InOutQuad, "Easing function for transitions.\nRecommended to use EaseOut only smoothing functions for better results.");
EarlyTimingAdjust = val.Bind<float>("General", "EarlyTimingAdjust", 15f, "How early will it snap to the notes.\n Defaulted at 15ms.");
LateTimingAdjust = val.Bind<float>("General", "LateTimingAdjust", 10f, "How late will it wait before moving to the next note.\n Defaulted at 10ms.");
SyncTootWithSong = val.Bind<bool>("General", "SyncTootWithSong", false, "Sync toot with the song instead of notes.\nIf trombone WAPS too much, lower Timing Adjust value.");
PerfectPlay = val.Bind<bool>("General", "PerfectPlay", false, "Forces perfect score on every notes.");
ShowAutoTootText = val.Bind<bool>("General", "ShowAutoTootText", true, "Show the autotoot enabled text when enabling autotoot.");
DistanceFromBottom = val.Bind<float>("General", "DistanceFromBottom", 0f, "Distance of the Text UI Compared to the bottom of the screen.\nDefaulted at 0px");
TextSize = val.Bind<float>("General", "TextSize", 12f, "Size of the Text UI.\nDefaulted at 12px");
settingPage = TootTallySettingsManager.AddNewPage("TTAutoToot", "TTAutoToot", 40f, new Color(0f, 0f, 0f, 0f));
settingPage.AddLabel("Toggle Key", (FontStyles)0, (TextAlignmentOptions)4097);
settingPage.AddDropdown("Toggle Key", (ConfigEntryBase)(object)ToggleKey);
settingPage.AddLabel("Easing Type", (FontStyles)0, (TextAlignmentOptions)4097);
settingPage.AddDropdown("Easing Type", (ConfigEntryBase)(object)EasingType);
settingPage.AddSlider("Early Timing Adjust", 1f, 100f, EarlyTimingAdjust, true);
settingPage.AddSlider("Late Timing Adjust", 1f, 100f, LateTimingAdjust, true);
settingPage.AddToggle("Sync toot with song", SyncTootWithSong, (UnityAction<bool>)null);
settingPage.AddToggle("Perfect Play", PerfectPlay, (UnityAction<bool>)null);
settingPage.AddToggle("Show AutoToot Text", ShowAutoTootText, (UnityAction<bool>)null);
settingPage.AddSlider("Text Y Distance", -50f, 100f, DistanceFromBottom, true);
settingPage.AddSlider("Text Size", 8f, 32f, DistanceFromBottom, true);
_harmony.PatchAll(typeof(AutoTootManager));
LogInfo("Module loaded!");
}
public void UnloadModule()
{
_harmony.UnpatchSelf();
settingPage.Remove();
LogInfo("Module unloaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TootTallyAutoToot";
public const string PLUGIN_NAME = "TootTallyAutoToot";
public const string PLUGIN_VERSION = "1.0.1";
}
}