mirror of
https://github.com/Theaninova/HitScoreVisualizer.git
synced 2025-12-11 02:56:26 +00:00
Plugin working
This commit is contained in:
25
HitScoreVisualizer.sln
Normal file
25
HitScoreVisualizer.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2035
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HitScoreVisualizer", "HitScoreVisualizer\HitScoreVisualizer.csproj", "{7D8A403B-A4EE-42AD-85EF-ACFD7F087A79}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7D8A403B-A4EE-42AD-85EF-ACFD7F087A79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7D8A403B-A4EE-42AD-85EF-ACFD7F087A79}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7D8A403B-A4EE-42AD-85EF-ACFD7F087A79}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7D8A403B-A4EE-42AD-85EF-ACFD7F087A79}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FCB42BAF-E3A9-4B03-B8A5-2538DB0373DF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,29 @@
|
||||
using Harmony;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HitScoreVisualizer.Harmony_Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(FlyingScoreTextEffect), "HandleSaberAfterCutSwingRatingCounterDidChangeEvent",
|
||||
new Type[] { typeof(SaberAfterCutSwingRatingCounter), typeof(float) })]
|
||||
class FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent
|
||||
{
|
||||
static void Postfix(SaberAfterCutSwingRatingCounter afterCutRating, FlyingScoreTextEffect __instance,
|
||||
ref Color ____color, NoteCutInfo ____noteCutInfo, int ____multiplier)
|
||||
{
|
||||
ScoreController.ScoreWithoutMultiplier(____noteCutInfo, afterCutRating, out int before, out int after);
|
||||
int total = before + after;
|
||||
____color =
|
||||
(
|
||||
total < 100 ? Color.red :
|
||||
total <= 105 ? new Color(1, 165f / 255f, 0) :
|
||||
total < 110 ? new Color(0, 0.5f, 1) :
|
||||
Color.green
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
67
HitScoreVisualizer/HitScoreVisualizer.csproj
Normal file
67
HitScoreVisualizer/HitScoreVisualizer.csproj
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7D8A403B-A4EE-42AD-85EF-ACFD7F087A79}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>HitScoreVisualizer</RootNamespace>
|
||||
<AssemblyName>HitScoreVisualizer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp-firstpass">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="IllusionPlugin">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Harmony Patches\FlyingScoreTextEffectHandleSaberAfterCutSwingRatingCounterDidChangeEvent.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
61
HitScoreVisualizer/Plugin.cs
Normal file
61
HitScoreVisualizer/Plugin.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Harmony;
|
||||
using IllusionPlugin;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace HitScoreVisualizer
|
||||
{
|
||||
public class Plugin : IPlugin
|
||||
{
|
||||
public string Name => "HitScoreVisualizer";
|
||||
public string Version => "0.0.1";
|
||||
public void OnApplicationStart()
|
||||
{
|
||||
SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
|
||||
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
|
||||
try
|
||||
{
|
||||
var harmony = HarmonyInstance.Create("com.arti.BeatSaber.HitScoreVisualizer");
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("[HitScoreVisualizer] This plugin requires Harmony. Make sure you " +
|
||||
"installed the plugin properly, as the Harmony DLL should have been installed with it.");
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
|
||||
{
|
||||
}
|
||||
|
||||
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnApplicationQuit()
|
||||
{
|
||||
SceneManager.activeSceneChanged -= SceneManagerOnActiveSceneChanged;
|
||||
SceneManager.sceneLoaded -= SceneManager_sceneLoaded;
|
||||
}
|
||||
|
||||
public void OnLevelWasLoaded(int level)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnLevelWasInitialized(int level)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnFixedUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
36
HitScoreVisualizer/Properties/AssemblyInfo.cs
Normal file
36
HitScoreVisualizer/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("HitScoreVisualizer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("HitScoreVisualizer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("7d8a403b-a4ee-42ad-85ef-acfd7f087a79")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Reference in New Issue
Block a user