From ef429709da4291dbb28ffc9833650e5abdeb5fa3 Mon Sep 17 00:00:00 2001 From: lxymahatma <326265648@qq.com> Date: Sun, 19 Feb 2023 19:46:57 +0900 Subject: [PATCH 1/6] remove onsceneload, set indicator when game start --- .gitignore | 355 +++++++++++++++++- AccuracyIndicator/AccuracyIndicator.csproj | 203 +++++----- .../Indicator/InGameIndicator.cs | 2 +- AccuracyIndicator/Main.cs | 3 - AccuracyIndicator/Patch/GameStartPatch.cs | 17 + AccuracyIndicator/Patch/SceneChangePatch.cs | 16 +- AccuracyIndicator/Properties/AssemblyInfo.cs | 6 +- 7 files changed, 484 insertions(+), 118 deletions(-) create mode 100644 AccuracyIndicator/Patch/GameStartPatch.cs diff --git a/.gitignore b/.gitignore index 182853c..9fb0f72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,353 @@ -.idea +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# Ignore the proxy and the MASM file +Proxy/proxy.c +Proxy/dllproxy.asm + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper *.DotSettings.user -*/bin -*/obj \ No newline at end of file + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ \ No newline at end of file diff --git a/AccuracyIndicator/AccuracyIndicator.csproj b/AccuracyIndicator/AccuracyIndicator.csproj index 5d68558..8543a57 100644 --- a/AccuracyIndicator/AccuracyIndicator.csproj +++ b/AccuracyIndicator/AccuracyIndicator.csproj @@ -1,97 +1,112 @@  - - - Debug - AnyCPU - {7E1AD6AF-F9E2-4F37-B476-78C2876F3FEC} - Library - Properties - AccuracyIndicator - AccuracyIndicator - v4.7.2 - 10.0 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\0Harmony.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Assembly-CSharp.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Il2Cppmscorlib.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\MelonLoader.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\mscorlib.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnhollowerBaseLib.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Unity.Addressables.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Unity.ResourceManager.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.CoreModule.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.TextCoreModule.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.UI.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.UIElementsModule.dll - - - ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.UIModule.dll - - - + + + Debug + AnyCPU + {7E1AD6AF-F9E2-4F37-B476-78C2876F3FEC} + Library + Properties + AccuracyIndicator + AccuracyIndicator + v4.7.2 + 10.0 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + + + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\0Harmony.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Assembly-CSharp.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Il2Cppmscorlib.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\MelonLoader.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\mscorlib.dll + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnhollowerBaseLib.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Unity.Addressables.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\Unity.ResourceManager.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.CoreModule.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.TextCoreModule.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.UI.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.UIElementsModule.dll + False + + + ..\..\..\Jeux\SteamLibrary\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.UIModule.dll + False + + + \ No newline at end of file diff --git a/AccuracyIndicator/Indicator/InGameIndicator.cs b/AccuracyIndicator/Indicator/InGameIndicator.cs index 2babcae..69e8b92 100644 --- a/AccuracyIndicator/Indicator/InGameIndicator.cs +++ b/AccuracyIndicator/Indicator/InGameIndicator.cs @@ -93,7 +93,7 @@ public void AddHit(float time) _hitEntries.Add(new HitEntry(Time.time, time, hitIndicator, hitRi)); - if (time is < -0.14f or > 0.14f) + if (time is < -0.13f or > 0.13f) return; // -140 = 0 diff --git a/AccuracyIndicator/Main.cs b/AccuracyIndicator/Main.cs index 1806e6a..b4b0cee 100644 --- a/AccuracyIndicator/Main.cs +++ b/AccuracyIndicator/Main.cs @@ -21,9 +21,6 @@ public override void OnInitializeMelon() HarmonyInstance.PatchAll(); } - public override void OnSceneWasLoaded(int buildIndex, string sceneName) => - SceneChangePatch.OnSceneWasLoaded(sceneName); - public override void OnSceneWasUnloaded(int buildIndex, string sceneName) => SceneChangePatch.OnSceneWasUnloaded(sceneName); diff --git a/AccuracyIndicator/Patch/GameStartPatch.cs b/AccuracyIndicator/Patch/GameStartPatch.cs new file mode 100644 index 0000000..91ab122 --- /dev/null +++ b/AccuracyIndicator/Patch/GameStartPatch.cs @@ -0,0 +1,17 @@ +using AccuracyIndicator.Indicator; +using FormulaBase; +using HarmonyLib; +using UnityEngine; + +namespace AccuracyIndicator.Patch +{ + [HarmonyPatch(typeof(StageBattleComponent), "GameStart")] + public static class GameStartPatch + { + private static void Postfix() + { + Main.IndicatorObj = new GameObject("Indicator"); + Main.InGameIndicator = Main.IndicatorObj.AddComponent(); + } + } +} diff --git a/AccuracyIndicator/Patch/SceneChangePatch.cs b/AccuracyIndicator/Patch/SceneChangePatch.cs index fa42ea3..29c16ad 100644 --- a/AccuracyIndicator/Patch/SceneChangePatch.cs +++ b/AccuracyIndicator/Patch/SceneChangePatch.cs @@ -1,23 +1,11 @@ -using HarmonyLib; -using AccuracyIndicator.Indicator; +using AccuracyIndicator.Indicator; +using HarmonyLib; using UnityEngine; namespace AccuracyIndicator.Patch; public static class SceneChangePatch { - - public static void OnSceneWasLoaded(string sceneName) - { - switch (sceneName) - { - case "GameMain": - Main.IndicatorObj = new GameObject("Indicator"); - Main.InGameIndicator = Main.IndicatorObj.AddComponent(); - break; - } - } - public static void OnSceneWasUnloaded(string sceneName) { switch (sceneName) diff --git a/AccuracyIndicator/Properties/AssemblyInfo.cs b/AccuracyIndicator/Properties/AssemblyInfo.cs index ef72663..dd7544c 100644 --- a/AccuracyIndicator/Properties/AssemblyInfo.cs +++ b/AccuracyIndicator/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ // 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.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyFileVersion("1.2.1.0")] -[assembly: MelonInfo(typeof(Main), "Accuracy Indicator", "1.2.0", "Azn9", "https://github.com/Azn9/MDAccuracyIndicatorMod")] +[assembly: MelonInfo(typeof(Main), "Accuracy Indicator", "1.2.1", "Azn9", "https://github.com/Azn9/MDAccuracyIndicatorMod")] [assembly: MelonGame("PeroPeroGames", "MuseDash")] \ No newline at end of file From cfbb19d8ae0191b4de05ec1738e7c63a25ed5a1f Mon Sep 17 00:00:00 2001 From: lxymahatma <326265648@qq.com> Date: Sun, 19 Feb 2023 20:04:20 +0900 Subject: [PATCH 2/6] fix patch error when retry chart (ig) --- AccuracyIndicator/Indicator/InGameIndicator.cs | 4 ++-- AccuracyIndicator/Patch/PauseResumePatch.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AccuracyIndicator/Indicator/InGameIndicator.cs b/AccuracyIndicator/Indicator/InGameIndicator.cs index 69e8b92..3a6a9ec 100644 --- a/AccuracyIndicator/Indicator/InGameIndicator.cs +++ b/AccuracyIndicator/Indicator/InGameIndicator.cs @@ -39,11 +39,11 @@ private void Start() _canvas.AddComponent(); _canvas.GetComponent().renderMode = RenderMode.ScreenSpaceOverlay; - // -0.14 | -0.05 | -0.025 | 0.025 | 0.05 | 0.14 + // -0.13 | -0.05 | -0.025 | 0.025 | 0.05 | 0.13 // Total length: 0.28 = 730px // Ok : 0.1 = 260px // Perfect : 0.05 = 130px - + Utils.CreateBars(_canvas, 0, DefaultY, 730, 260, 130); var arrow = new GameObject("Arrow"); diff --git a/AccuracyIndicator/Patch/PauseResumePatch.cs b/AccuracyIndicator/Patch/PauseResumePatch.cs index cb9445f..df6a2cb 100644 --- a/AccuracyIndicator/Patch/PauseResumePatch.cs +++ b/AccuracyIndicator/Patch/PauseResumePatch.cs @@ -10,7 +10,7 @@ public static class PausePatch { private static void Postfix() { - if (Main.InGameIndicator != null) + if (Main.InGameIndicator is not null) Main.InGameIndicator.Pause(); } } @@ -20,7 +20,7 @@ public static class ResumePatch { private static void Postfix() { - if (Main.InGameIndicator != null) + if (Main.InGameIndicator is not null) Main.InGameIndicator.Resume(); } } From 420c49120c506d4bc8c24e7bdb81fb8bde4ba799 Mon Sep 17 00:00:00 2001 From: lxymahatma <326265648@qq.com> Date: Sun, 19 Feb 2023 20:24:30 +0900 Subject: [PATCH 3/6] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9fb0f72..b90ef8b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ bld/ [Oo]bj/ [Ll]og/ +.idea # Visual Studio 2015/2017 cache/options directory .vs/ # Uncomment if you have tasks that create the project's static files in wwwroot From 6bc01259e03aa66f2ee8e888ec430fe4faa43abd Mon Sep 17 00:00:00 2001 From: Axel Joly Date: Sun, 19 Feb 2023 12:38:52 +0100 Subject: [PATCH 4/6] Move things from -/+140ms to -/+130ms --- .../Indicator/InGameIndicator.cs | 32 +++++++++---------- .../Indicator/VictoryIndicator.cs | 10 +++--- README.MD | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/AccuracyIndicator/Indicator/InGameIndicator.cs b/AccuracyIndicator/Indicator/InGameIndicator.cs index 3a6a9ec..09aa277 100644 --- a/AccuracyIndicator/Indicator/InGameIndicator.cs +++ b/AccuracyIndicator/Indicator/InGameIndicator.cs @@ -28,7 +28,7 @@ private void Start() { _antiGC.Add(this); - for (float i = -140; i < 140; i += 5) + for (float i = -130; i < 130; i += 5) { _hitReport.Add(new ReportRange()); } @@ -40,11 +40,11 @@ private void Start() _canvas.GetComponent().renderMode = RenderMode.ScreenSpaceOverlay; // -0.13 | -0.05 | -0.025 | 0.025 | 0.05 | 0.13 - // Total length: 0.28 = 730px - // Ok : 0.1 = 260px - // Perfect : 0.05 = 130px + // Total length: 0.26 = 730px + // Ok : 0.1 = 280px + // Perfect : 0.05 = 140px - Utils.CreateBars(_canvas, 0, DefaultY, 730, 260, 130); + Utils.CreateBars(_canvas, 0, DefaultY, 730, 280, 140); var arrow = new GameObject("Arrow"); arrow.transform.SetParent(_canvas.transform); @@ -71,10 +71,13 @@ private void Start() public void AddHit(float time) { + if (time is < -0.13f or > 0.13f) + return; + _totalDelay += time; _totalHits++; - var x = Utils.ConvertWidthFrom1920P(time / 0.28f * 730f); + var x = Utils.ConvertWidthFrom1920P(time / 0.26f * 730f); var color = time switch { @@ -93,18 +96,15 @@ public void AddHit(float time) _hitEntries.Add(new HitEntry(Time.time, time, hitIndicator, hitRi)); - if (time is < -0.13f or > 0.13f) - return; - - // -140 = 0 - // -135 = 1 + // -130 = 0 + // -125 = 1 // ... - // time * 1000 is >= -140 and <= 140 - // (time * 1000) / 5 is >= -28 and <= 28 - // (time * 1000) / 5 + 28 is >= 0 and <= 56 + // time * 1000 is >= -130 and <= 130 + // (time * 1000) / 5 is >= -26 and <= 26 + // (time * 1000) / 5 + 26 is >= 0 and <= 52 - var timeRange = (int)(time * 1000) / 5 + 28; + var timeRange = (int)(time * 1000) / 5 + 26; _hitReport[timeRange].Cast().Amount++; } @@ -157,7 +157,7 @@ private void Update() } var meanDelay = countDelay == 0 ? 0 : totalDelay / countDelay; - var x = Utils.ConvertWidthFrom1920P(meanDelay / 0.28f * 730f); + var x = Utils.ConvertWidthFrom1920P(meanDelay / 0.26f * 730f); var position = _arrowRt.anchoredPosition; var newPosition = new Vector2(x, position.y); diff --git a/AccuracyIndicator/Indicator/VictoryIndicator.cs b/AccuracyIndicator/Indicator/VictoryIndicator.cs index 4ed0408..21fa6d2 100644 --- a/AccuracyIndicator/Indicator/VictoryIndicator.cs +++ b/AccuracyIndicator/Indicator/VictoryIndicator.cs @@ -72,22 +72,22 @@ private void Render() Utils.CreateBars(_canvas, Utils.ConvertWidthFrom1920P(-650), Utils.ConvertHeightFrom1080P(230), 600, 171, 106); - int max = 0; + var max = 0; - for (float i = -140; i < 140; i += 5) + for (float i = -130; i < 130; i += 5) { var time = i / 1000f; - var timeRange = (int)(time * 1000) / 5 + 28; + var timeRange = (int)(time * 1000) / 5 + 26; var hits = _report[timeRange].Cast(); if (hits.Amount > max) max = hits.Amount; } - for (float i = -140; i < 140; i += 5) + for (float i = -130; i < 130; i += 5) { var time = i / 1000f; - var timeRange = (int)(time * 1000) / 5 + 28; + var timeRange = (int)(time * 1000) / 5 + 26; var hits = _report[timeRange].Cast(); var bar = new GameObject($"Bar {time}"); diff --git a/README.MD b/README.MD index 6215571..462228e 100644 --- a/README.MD +++ b/README.MD @@ -15,4 +15,4 @@ Simply grab the latest .dll from the [**releases**](https://github.com/Azn9/MDAc ## What does the color mean? - Blue is 'Perfect' judgement (from -25ms to +25ms) - Green is 'Perfect' judgement with "late" or "early" displayed (from -50ms to +50ms) -- Orange is 'Great' judgement (from -140ms to +140ms) +- Orange is 'Great' judgement (from -130ms to +130ms) From 1c1a3e29c56227bdbc7efc8d5aee1fa1d518d934 Mon Sep 17 00:00:00 2001 From: Axel Joly Date: Sun, 19 Feb 2023 12:41:38 +0100 Subject: [PATCH 5/6] Fix bar being displayed twice --- AccuracyIndicator/Patch/GameStartPatch.cs | 6 +++--- AccuracyIndicator/Properties/AssemblyInfo.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AccuracyIndicator/Patch/GameStartPatch.cs b/AccuracyIndicator/Patch/GameStartPatch.cs index 91ab122..85d5261 100644 --- a/AccuracyIndicator/Patch/GameStartPatch.cs +++ b/AccuracyIndicator/Patch/GameStartPatch.cs @@ -10,8 +10,8 @@ public static class GameStartPatch { private static void Postfix() { - Main.IndicatorObj = new GameObject("Indicator"); - Main.InGameIndicator = Main.IndicatorObj.AddComponent(); + Main.IndicatorObj ??= new GameObject("Indicator"); + Main.InGameIndicator ??= Main.IndicatorObj.AddComponent(); } } -} +} \ No newline at end of file diff --git a/AccuracyIndicator/Properties/AssemblyInfo.cs b/AccuracyIndicator/Properties/AssemblyInfo.cs index dd7544c..fd0259e 100644 --- a/AccuracyIndicator/Properties/AssemblyInfo.cs +++ b/AccuracyIndicator/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ // 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.2.1.0")] -[assembly: AssemblyFileVersion("1.2.1.0")] +[assembly: AssemblyVersion("1.3.0")] +[assembly: AssemblyFileVersion("1.3.0")] -[assembly: MelonInfo(typeof(Main), "Accuracy Indicator", "1.2.1", "Azn9", "https://github.com/Azn9/MDAccuracyIndicatorMod")] +[assembly: MelonInfo(typeof(Main), "Accuracy Indicator", "1.3.0", "Azn9", "https://github.com/Azn9/MDAccuracyIndicatorMod")] [assembly: MelonGame("PeroPeroGames", "MuseDash")] \ No newline at end of file From 16c3359f11bfdf4a20f321aa35d2ba806b713192 Mon Sep 17 00:00:00 2001 From: Axel Joly Date: Sun, 19 Feb 2023 12:55:53 +0100 Subject: [PATCH 6/6] Fix indicator not showing and errors after restarting a play --- AccuracyIndicator/Patch/SceneChangePatch.cs | 38 ++++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/AccuracyIndicator/Patch/SceneChangePatch.cs b/AccuracyIndicator/Patch/SceneChangePatch.cs index 29c16ad..8adf28e 100644 --- a/AccuracyIndicator/Patch/SceneChangePatch.cs +++ b/AccuracyIndicator/Patch/SceneChangePatch.cs @@ -1,5 +1,6 @@ using AccuracyIndicator.Indicator; using HarmonyLib; +using MelonLoader; using UnityEngine; namespace AccuracyIndicator.Patch; @@ -8,46 +9,49 @@ public static class SceneChangePatch { public static void OnSceneWasUnloaded(string sceneName) { - switch (sceneName) - { - case "GameMain": - if (Main.IndicatorObj != null) - { - Object.Destroy(Main.IndicatorObj); - Main.IndicatorObj = null; - } - - break; - } + if (sceneName == "GameMain") + Destroy(); } - + [HarmonyPatch(typeof(PnlVictory), "OnVictory")] internal static class VictoryPatch { - private static void Postfix() { var meanDelay = Main.InGameIndicator.GetMeanDelay(); var report = Main.InGameIndicator.GetReport(); Object.Destroy(Main.InGameIndicator); + Main.InGameIndicator = null; var victoryIndicator = Main.IndicatorObj.AddComponent(); - + victoryIndicator.SetMeanDelay(meanDelay); victoryIndicator.SetReport(report); } } - + [HarmonyPatch(typeof(PnlFail), "Fail")] internal static class FailPatch { - private static void Postfix() + { + Destroy(); + } + } + + private static void Destroy() + { + if (Main.InGameIndicator is not null) + { + Object.Destroy(Main.InGameIndicator); + Main.InGameIndicator = null; + } + + if (Main.IndicatorObj is not null) { Object.Destroy(Main.IndicatorObj); Main.IndicatorObj = null; } } - } \ No newline at end of file