Decompiled source of ToggleBuildView v1.0.1

GongT.ToggleBuildView.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Systems;
using CommonAPI.Systems.ModLocalization;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("GongT.ToggleBuildView")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+283043fa810456d5942323048f8636d945c7fc85")]
[assembly: AssemblyProduct("建造模式按键切换第三人称、上帝视角,热键可修改")]
[assembly: AssemblyTitle("GongT.ToggleBuildView")]
[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 ToggleBuildView
{
	[BepInPlugin("GongT.ToggleBuildView", "建造模式按键切换第三人称、上帝视角,热键可修改", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CommonAPISubmoduleDependency(new string[] { "CustomKeyBindSystem", "LocalizationModule" })]
	public class ToggleBuildView : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			Logger = new ManualLogSource("GongT.ToggleBuildView");
			Logger.LogInfo((object)"加载: 1.0.1");
			BuiltinKey val = default(BuiltinKey);
			val.key = new CombineKey(98, (byte)1, (ECombineKeyAction)0, false);
			val.name = "ToggleBuildViewMode";
			val.conflictGroup = 2309;
			val.canOverride = true;
			CustomKeyBindSystem.RegisterKeyBind<PressKeyBind>(val);
			string text = "GongT.ToggleBuildView".Split(new char[1] { ' ' }).Last();
			LocalizationModule.RegisterTranslation("KEYToggleBuildViewMode", "[" + text + "] Toggle build view mode", "[" + text + "] 切换第三人称/上帝视角", "");
			LocalizationModule.RegisterTranslation("BuildViewModeCenter", "Third Person View", "第三人称视角", "");
			LocalizationModule.RegisterTranslation("BuildViewModeGod", "God View", "上帝视角", "");
		}

		public void Update()
		{
			if (!VFInput.inputing && GameMain.mainPlayer != null && !DSPGame.IsMenuDemo && CustomKeyBindSystem.GetKeyBind("ToggleBuildViewMode").keyValue)
			{
				if (!GameMain.mainPlayer.controller.actionBuild.active)
				{
					Logger.LogDebug((object)"不在建造模式下");
					return;
				}
				PlayerController.operationWhenBuild = !PlayerController.operationWhenBuild;
				UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead(Localization.Translate(PlayerController.operationWhenBuild ? "BuildViewModeCenter" : "BuildViewModeGod"));
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GongT.ToggleBuildView";

		public const string PLUGIN_NAME = "建造模式按键切换第三人称、上帝视角,热键可修改";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}