-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,767 additions
and
548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deviator", "Deviator\Deviator.csproj", "{878B33D0-AABC-4A4F-8095-AFDE451F894A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{878B33D0-AABC-4A4F-8095-AFDE451F894A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{878B33D0-AABC-4A4F-8095-AFDE451F894A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{878B33D0-AABC-4A4F-8095-AFDE451F894A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{878B33D0-AABC-4A4F-8095-AFDE451F894A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Version>0.1.0</Version> | ||
<AssemblyVersion>$(Version)</AssemblyVersion> | ||
<FileVersion>$(Version)</FileVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<OutputPath>G:\SteamLibrary\steamapps\common\DEVIATOR\BepInEx\plugins</OutputPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<OutputPath>G:\SteamLibrary\steamapps\common\DEVIATOR\BepInEx\plugins</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>libs\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Cinemachine"> | ||
<HintPath>libs\Cinemachine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.2D.Animation.Runtime"> | ||
<HintPath>libs\Unity.2D.Animation.Runtime.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.2D.SpriteShape.Runtime"> | ||
<HintPath>libs\Unity.2D.SpriteShape.Runtime.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.InputSystem"> | ||
<HintPath>libs\Unity.InputSystem.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.RenderPipelines.Core.Runtime"> | ||
<HintPath>libs\Unity.RenderPipelines.Core.Runtime.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.RenderPipelines.Universal.Runtime"> | ||
<HintPath>libs\Unity.RenderPipelines.Universal.Runtime.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Unity.Timeline"> | ||
<HintPath>libs\Unity.Timeline.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>libs\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AIModule"> | ||
<HintPath>libs\UnityEngine.AIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AnimationModule"> | ||
<HintPath>libs\UnityEngine.AnimationModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AssetBundleModule"> | ||
<HintPath>libs\UnityEngine.AssetBundleModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AudioModule"> | ||
<HintPath>libs\UnityEngine.AudioModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>libs\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.DirectorModule"> | ||
<HintPath>libs\UnityEngine.DirectorModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ImageConversionModule"> | ||
<HintPath>libs\UnityEngine.ImageConversionModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.IMGUIModule"> | ||
<HintPath>libs\UnityEngine.IMGUIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.InputLegacyModule"> | ||
<HintPath>libs\UnityEngine.InputLegacyModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.JSONSerializeModule"> | ||
<HintPath>libs\UnityEngine.JSONSerializeModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ParticleSystemModule"> | ||
<HintPath>libs\UnityEngine.ParticleSystemModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Physics2DModule"> | ||
<HintPath>libs\UnityEngine.Physics2DModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.PhysicsModule"> | ||
<HintPath>libs\UnityEngine.PhysicsModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ScreenCaptureModule"> | ||
<HintPath>libs\UnityEngine.ScreenCaptureModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.SharedInternalsModule"> | ||
<HintPath>libs\UnityEngine.SharedInternalsModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.SpriteShapeModule"> | ||
<HintPath>libs\UnityEngine.SpriteShapeModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.TextRenderingModule"> | ||
<HintPath>libs\UnityEngine.TextRenderingModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.TilemapModule"> | ||
<HintPath>libs\UnityEngine.TilemapModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>libs\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UIElementsModule"> | ||
<HintPath>libs\UnityEngine.UIElementsModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UIModule"> | ||
<HintPath>libs\UnityEngine.UIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UnityWebRequestModule"> | ||
<HintPath>libs\UnityEngine.UnityWebRequestModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UnityWebRequestTextureModule"> | ||
<HintPath>libs\UnityEngine.UnityWebRequestTextureModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.VFXModule"> | ||
<HintPath>libs\UnityEngine.VFXModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.VideoModule"> | ||
<HintPath>libs\UnityEngine.VideoModule.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Deviator.csproj.DotSettings" /> | ||
<None Remove="libs\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="libs\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Remove="libs\**" /> | ||
</ItemGroup> | ||
|
||
<Import Project="..\zip.target"/> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">Default</s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Global using directives | ||
|
||
global using System; | ||
global using System.Collections.Generic; | ||
global using System.Linq; | ||
global using System.Reflection; | ||
global using System.Reflection.Emit; | ||
global using System.Runtime.InteropServices; | ||
global using BepInEx; | ||
global using BepInEx.Configuration; | ||
global using BepInEx.Logging; | ||
global using Deviator.Misc; | ||
global using Deviator.WindowsAPI; | ||
global using GameScripts.Game; | ||
global using GameScripts.UI; | ||
global using GameScripts.Util; | ||
global using Debug = UnityEngine.Debug; | ||
global using HarmonyLib; | ||
global using MiscModule.Functions; | ||
global using MonoMod.Utils; | ||
global using UnityEngine; | ||
global using UnityEngine.SceneManagement; | ||
global using UnityEngine.UI; |
151 changes: 151 additions & 0 deletions
151
src/Deviator/Deviator/Misc/ConfigurationManagerAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
namespace Deviator.Misc; | ||
|
||
/// <summary> | ||
/// Class that specifies how a setting should be displayed inside the ConfigurationManager settings window. | ||
/// | ||
/// Usage: | ||
/// This class template has to be copied inside the plugin's project and referenced by its code directly. | ||
/// make a new instance, assign any fields that you want to override, and pass it as a tag for your setting. | ||
/// | ||
/// If a field is null (default), it will be ignored and won't change how the setting is displayed. | ||
/// If a field is non-null (you assigned a value to it), it will override default behavior. | ||
/// </summary> | ||
/// | ||
/// <example> | ||
/// Here's an example of overriding order of settings and marking one of the settings as advanced: | ||
/// <code> | ||
/// // Override IsAdvanced and Order | ||
/// Config.Bind("X", "1", 1, new ConfigDescription("", null, new ConfigurationManagerAttributes { IsAdvanced = true, Order = 3 })); | ||
/// // Override only Order, IsAdvanced stays as the default value assigned by ConfigManager | ||
/// Config.Bind("X", "2", 2, new ConfigDescription("", null, new ConfigurationManagerAttributes { Order = 1 })); | ||
/// Config.Bind("X", "3", 3, new ConfigDescription("", null, new ConfigurationManagerAttributes { Order = 2 })); | ||
/// </code> | ||
/// </example> | ||
/// | ||
/// <remarks> | ||
/// You can read more and see examples in the readme at https://github.com/BepInEx/BepInEx.ConfigurationManager | ||
/// You can optionally remove fields that you won't use from this class, it's the same as leaving them null. | ||
/// </remarks> | ||
#pragma warning disable 0169, 0414, 0649 | ||
internal sealed class ConfigurationManagerAttributes | ||
{ | ||
/// <summary> | ||
/// Should the setting be shown as a percentage (only use with value range settings). | ||
/// </summary> | ||
public bool? ShowRangeAsPercent; | ||
|
||
/// <summary> | ||
/// Custom setting editor (OnGUI code that replaces the default editor provided by ConfigurationManager). | ||
/// See below for a deeper explanation. Using a custom drawer will cause many of the other fields to do nothing. | ||
/// </summary> | ||
public Action<ConfigEntryBase> CustomDrawer; | ||
|
||
/// <summary> | ||
/// Custom setting editor that allows polling keyboard input with the Input (or UnityInput) class. | ||
/// Use either CustomDrawer or CustomHotkeyDrawer, using both at the same time leads to undefined behaviour. | ||
/// </summary> | ||
public CustomHotkeyDrawerFunc CustomHotkeyDrawer; | ||
|
||
/// <summary> | ||
/// Custom setting draw action that allows polling keyboard input with the Input class. | ||
/// Note: Make sure to focus on your UI control when you are accepting input so user doesn't type in the search box or in another setting (best to do this on every frame). | ||
/// If you don't draw any selectable UI controls You can use `GUIUtility.keyboardControl = -1;` on every frame to make sure that nothing is selected. | ||
/// </summary> | ||
/// <example> | ||
/// CustomHotkeyDrawer = (ConfigEntryBase setting, ref bool isEditing) => | ||
/// { | ||
/// if (isEditing) | ||
/// { | ||
/// // Make sure nothing else is selected since we aren't focusing on a text box with GUI.FocusControl. | ||
/// GUIUtility.keyboardControl = -1; | ||
/// | ||
/// // Use Input.GetKeyDown and others here, remember to set isEditing to false after you're done! | ||
/// // It's best to check Input.anyKeyDown and set isEditing to false immediately if it's true, | ||
/// // so that the input doesn't have a chance to propagate to the game itself. | ||
/// | ||
/// if (GUILayout.Button("Stop")) | ||
/// isEditing = false; | ||
/// } | ||
/// else | ||
/// { | ||
/// if (GUILayout.Button("Start")) | ||
/// isEditing = true; | ||
/// } | ||
/// | ||
/// // This will only be true when isEditing is true and you hold any key | ||
/// GUILayout.Label("Any key pressed: " + Input.anyKey); | ||
/// } | ||
/// </example> | ||
/// <param name="setting"> | ||
/// Setting currently being set (if available). | ||
/// </param> | ||
/// <param name="isCurrentlyAcceptingInput"> | ||
/// Set this ref parameter to true when you want the current setting drawer to receive Input events. | ||
/// The value will persist after being set, use it to see if the current instance is being edited. | ||
/// Remember to set it to false after you are done! | ||
/// </param> | ||
public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput); | ||
|
||
/// <summary> | ||
/// Show this setting in the settings screen at all? If false, don't show. | ||
/// </summary> | ||
public bool? Browsable; | ||
|
||
/// <summary> | ||
/// Category the setting is under. Null to be directly under the plugin. | ||
/// </summary> | ||
public string Category; | ||
|
||
/// <summary> | ||
/// If set, a "Default" button will be shown next to the setting to allow resetting to default. | ||
/// </summary> | ||
public object DefaultValue; | ||
|
||
/// <summary> | ||
/// Force the "Reset" button to not be displayed, even if a valid DefaultValue is available. | ||
/// </summary> | ||
public bool? HideDefaultButton; | ||
|
||
/// <summary> | ||
/// Force the setting name to not be displayed. Should only be used with a <see cref="CustomDrawer"/> to get more space. | ||
/// Can be used together with <see cref="HideDefaultButton"/> to gain even more space. | ||
/// </summary> | ||
public bool? HideSettingName; | ||
|
||
/// <summary> | ||
/// Optional description shown when hovering over the setting. | ||
/// Not recommended, provide the description when creating the setting instead. | ||
/// </summary> | ||
public string Description; | ||
|
||
/// <summary> | ||
/// Name of the setting. | ||
/// </summary> | ||
public string DispName; | ||
|
||
/// <summary> | ||
/// Order of the setting on the settings list relative to other settings in a category. | ||
/// 0 by default, higher number is higher on the list. | ||
/// </summary> | ||
public int? Order; | ||
|
||
/// <summary> | ||
/// Only show the value, don't allow editing it. | ||
/// </summary> | ||
public bool? ReadOnly; | ||
|
||
/// <summary> | ||
/// If true, don't show the setting by default. User has to turn on showing advanced settings or search for it. | ||
/// </summary> | ||
public bool? IsAdvanced; | ||
|
||
/// <summary> | ||
/// Custom converter from setting type to string for the built-in editor textboxes. | ||
/// </summary> | ||
public Func<object, string> ObjToStr; | ||
|
||
/// <summary> | ||
/// Custom converter from string to setting type for the built-in editor textboxes. | ||
/// </summary> | ||
public Func<string, object> StrToObj; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Deviator.Misc; | ||
|
||
public static class Utils | ||
{ | ||
|
||
// public static string GetFullPath(this GameObject gameObject) | ||
// { | ||
// var path = gameObject.name; | ||
// var parent = gameObject.transform.parent; | ||
// while (parent != null) | ||
// { | ||
// path = parent.name + "/" + path; | ||
// parent = parent.parent; | ||
// } | ||
// | ||
// return path; | ||
// } | ||
|
||
internal static int FindLowestFrameRateMultipleAboveFifty(int originalRate) | ||
{ | ||
for (var rate = originalRate / 2; rate > 50; rate--) | ||
{ | ||
if (originalRate % rate == 0) | ||
{ | ||
return rate; | ||
} | ||
} | ||
|
||
return originalRate; | ||
} | ||
|
||
} |
Oops, something went wrong.