using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using BoplFixedMath;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("ScaleControl")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Ever wanted to fight like Ant-man? Now you can! Shrink to dodge, and then grow to shoot massive projectiles!")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("ScaleControl")]
[assembly: AssemblyTitle("ScaleControl")]
[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 ScaleControl
{
[BepInPlugin("me.antimality.ScaleControl", "ScaleControl", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private GameObject warningBox;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Plugin ScaleControl is loaded!");
}
private void Update()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (!GameLobby.isOnlineGame)
{
PlayerPatch.UpdateLocal();
}
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "ChSelect_online" && (Object)(object)warningBox == (Object)null)
{
DisplayWarning();
return;
}
activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "ChSelect_online" && (Object)(object)warningBox != (Object)null)
{
Dispose();
}
}
private void OnDestroy()
{
Dispose();
}
private void DisplayWarning()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
Canvas component = GameObject.Find("Canvas").GetComponent<Canvas>();
if ((Object)(object)component == (Object)null)
{
Log.LogError((object)"No suitable canvas!");
return;
}
warningBox = new GameObject("ScaleControl Warning", new Type[2]
{
typeof(RectTransform),
typeof(TextMeshProUGUI)
});
warningBox.transform.SetParent(((Component)component).transform);
TextMeshProUGUI component2 = warningBox.GetComponent<TextMeshProUGUI>();
((Graphic)component2).raycastTarget = false;
((TMP_Text)component2).text = "WARNING: Scale Control mod does NOT work online";
((Graphic)component2).color = Color.red;
((TMP_Text)component2).alignment = (TextAlignmentOptions)514;
((TMP_Text)component2).font = LocalizedText.localizationTable.GetFont(Settings.Get().Language, false);
RectTransform component3 = warningBox.GetComponent<RectTransform>();
Rect rect = ((Component)component).GetComponent<RectTransform>().rect;
float height = ((Rect)(ref rect)).height;
rect = ((Component)component).GetComponent<RectTransform>().rect;
float width = ((Rect)(ref rect)).width;
((TMP_Text)component2).fontSize = width / 100f;
component3.anchoredPosition = new Vector2(0f, (0f - height) / 2f + 100f);
component3.sizeDelta = new Vector2(width, 100f);
warningBox.SetActive(true);
}
private void Dispose()
{
Object.Destroy((Object)(object)warningBox);
}
}
public class PlayerPatch
{
private static Fix MouseFactor = (Fix)0.5;
private static Fix GamepadFactor = (Fix)0.03;
public static void UpdateOnline()
{
foreach (Player item in PlayerHandler.Get().PlayerList())
{
_ = item.IsLocalPlayer;
}
}
public static void UpdateLocal()
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
foreach (Player item in PlayerHandler.Get().PlayerList())
{
if (item.UsesKeyboardAndMouse)
{
if (((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y > 0f)
{
item.Scale += MouseFactor;
}
else if (((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y < 0f)
{
item.Scale -= MouseFactor;
}
if (((ButtonControl)Keyboard.current[(Key)20]).wasPressedThisFrame)
{
item.Scale = Fix.One;
}
}
else
{
Enumerator<Gamepad> enumerator2 = Gamepad.all.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
Gamepad current2 = enumerator2.Current;
if (item.inputDevice.deviceId == ((InputDevice)current2).deviceId)
{
if (((InputControl<float>)(object)current2.rightTrigger).ReadValue() > 0f || ((InputControl<float>)(object)current2.leftTrigger).ReadValue() > 0f)
{
item.Scale += GamepadFactor * (Fix)(((InputControl<float>)(object)current2.rightTrigger).ReadValue() - ((InputControl<float>)(object)current2.leftTrigger).ReadValue());
}
if (current2.leftStickButton.isPressed)
{
item.Scale = Fix.One;
}
}
}
}
finally
{
((IDisposable)enumerator2).Dispose();
}
}
item.Scale = Fix.Max(item.Scale, (Fix)0.01f);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ScaleControl";
public const string PLUGIN_NAME = "ScaleControl";
public const string PLUGIN_VERSION = "1.0.1";
}
}