diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 3e759b7..dfcfd56 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files +*.rsuser *.suo *.user *.userosscache @@ -12,6 +13,9 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# Mono auto generated files +mono_crash.* + # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -19,10 +23,13 @@ [Rr]eleases/ x64/ x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ +[Ll]ogs/ # Visual Studio 2015/2017 cache/options directory .vs/ @@ -36,9 +43,10 @@ Generated\ Files/ [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -# NUNIT +# NUnit *.VisualState.xml TestResult.xml +nunit-*.xml # Build Results of an ATL Project [Dd]ebugPS/ @@ -52,7 +60,6 @@ BenchmarkDotNet.Artifacts/ project.lock.json project.fragment.lock.json artifacts/ -**/Properties/launchSettings.json # StyleCop StyleCopReport.xml @@ -60,7 +67,7 @@ StyleCopReport.xml # Files built by Visual Studio *_i.c *_p.c -*_i.h +*_h.h *.ilk *.meta *.obj @@ -77,6 +84,7 @@ StyleCopReport.xml *.tlh *.tmp *.tmp_proj +*_wpftmp.csproj *.log *.vspscc *.vssscc @@ -119,9 +127,6 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding add-in -.JustCode - # TeamCity is a build add-in _TeamCity* @@ -179,6 +184,8 @@ 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. @@ -203,12 +210,14 @@ 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/ +!?*.[Cc]ache/ # Others ClientBin/ @@ -221,7 +230,7 @@ ClientBin/ *.publishsettings orleans.codegen.cs -# Including strong name files can present a security risk +# Including strong name files can present a security risk # (https://github.com/github/gitignore/pull/2483#issue-259490424) #*.snk @@ -252,6 +261,9 @@ ServiceFabricBackup/ *.bim.layout *.bim_*.settings *.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl # Microsoft Fakes FakesAssemblies/ @@ -287,12 +299,8 @@ paket-files/ # FAKE - F# Make .fake/ -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ +# CodeRush personal settings +.cr/personal # Python Tools for Visual Studio (PTVS) __pycache__/ @@ -317,7 +325,7 @@ __pycache__/ # OpenCover UI analysis results OpenCover/ -# Azure Stream Analytics local run output +# Azure Stream Analytics local run output ASALocalRun/ # MSBuild Binary and Structured Log @@ -326,5 +334,17 @@ ASALocalRun/ # NVidia Nsight GPU debugger configuration file *.nvuser -# MFractors (Xamarin productivity tool) working folder +# 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/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ diff --git a/CustomMenuPointers.sln b/CustomMenuPointers.sln index bc36020..8f69117 100644 --- a/CustomMenuPointers.sln +++ b/CustomMenuPointers.sln @@ -5,6 +5,14 @@ VisualStudioVersion = 16.0.29209.62 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomMenuPointers", "CustomMenuPointers\CustomMenuPointers.csproj", "{4488C785-6249-4CDC-8203-38CB97045BFE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3CDBAA68-B56A-4F3B-B81A-1D9814E338A0}" + ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/CustomMenuPointers/CustomMenuPointers.cs b/CustomMenuPointers/CustomMenuPointers.cs index 7052c57..453ec8d 100644 --- a/CustomMenuPointers/CustomMenuPointers.cs +++ b/CustomMenuPointers/CustomMenuPointers.cs @@ -87,7 +87,7 @@ public void ReplaceWithCustomSabersForScene(bool showMenuCore = true) this.UnloadEverything(); - Logger.Info($"Current Custom Saber: {CustomSaber.Plugin._currentSaberName}"); + Logger.Info($"Current Custom Saber: {CustomSabersMod.instance.CurrentSaberName}"); // Load the asset bundle objects var loadedSaberAssetBundle = CustomSabersMod.instance.GetCurrentDefaultSaberAssetBundle(); diff --git a/CustomMenuPointers/CustomMenuPointers.csproj b/CustomMenuPointers/CustomMenuPointers.csproj index 33733c9..72b43e6 100644 --- a/CustomMenuPointers/CustomMenuPointers.csproj +++ b/CustomMenuPointers/CustomMenuPointers.csproj @@ -31,25 +31,27 @@ 4 - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll - - - False - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BSML.dll + $(GameDirPath)Plugins\BSML.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BS_Utils.dll + $(GameDirPath)Plugins\BS_Utils.dll False - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\CustomSaber.dll + $(GameDirPath)Plugins\CustomSaber.dll + + + $(GameDirPath)Beat Saber_Data\Managed\HMLib.dll + + + $(GameDirPath)Beat Saber_Data\Managed\HMUI.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IPA.Loader.dll + $(GameDirPath)Beat Saber_Data\Managed\IPA.Loader.dll + + + $(GameDirPath)Beat Saber_Data\Managed\MainAssembly.dll @@ -61,21 +63,21 @@ False - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Unity.TextMeshPro.dll + $(GameDirPath)Beat Saber_Data\Managed\Unity.TextMeshPro.dll False - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll + $(GameDirPath)Beat Saber_Data\Managed\UnityEngine.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AssetBundleModule.dll + $(GameDirPath)Beat Saber_Data\Managed\UnityEngine.AssetBundleModule.dll - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll + $(GameDirPath)Beat Saber_Data\Managed\UnityEngine.CoreModule.dll False - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UI.dll + $(GameDirPath)Beat Saber_Data\Managed\UnityEngine.UI.dll @@ -111,6 +113,6 @@ - copy CustomMenuPointers.dll "C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins" + copy "$(TargetFileName)" "$(GameDirPath)Plugins" - \ No newline at end of file + diff --git a/CustomMenuPointers/CustomSabersMod.cs b/CustomMenuPointers/CustomSabersMod.cs index 8e35390..606bbd3 100644 --- a/CustomMenuPointers/CustomSabersMod.cs +++ b/CustomMenuPointers/CustomSabersMod.cs @@ -1,5 +1,5 @@ -using IPA.Loader; -using System.Reflection; +using CustomSaber.Settings; +using IPA.Loader; using UnityEngine; namespace CustomMenuPointers @@ -8,7 +8,7 @@ public class CustomSabersMod : PersistentSingleton { public bool IsLoaded { get; private set; } - public string CurrentSaberName => CustomSaber.Plugin._currentSaberName; + public string CurrentSaberName => Configuration.CurrentlySelectedSaber; private void Awake() @@ -19,8 +19,8 @@ private void Awake() public bool IsUsingDefaultSabers() { return !IsLoaded || - CustomSaber.Plugin._currentSaberName == null || - CustomSaber.Plugin._currentSaberName == "Default Sabers"; + this.CurrentSaberName == null || + this.CurrentSaberName == "Default Sabers"; } public AssetBundle GetCurrentDefaultSaberAssetBundle() @@ -28,11 +28,9 @@ public AssetBundle GetCurrentDefaultSaberAssetBundle() if (!IsLoaded) return null; // Get the Custom Saber AssetBundle - var assembly = Assembly.GetAssembly(typeof(CustomSaber.CustomTrail)); - var type = assembly.GetType("CustomSaber.SaberLoader"); - MethodInfo getSaberAssetBundle = type.GetMethod("GetSaberAssetBundle", BindingFlags.Static | BindingFlags.Public); - object assetBundleObj = getSaberAssetBundle.Invoke(null, new[] { CustomSaber.Plugin._currentSaberName }); - return assetBundleObj as AssetBundle; + int index = CustomSaber.Utilities.SaberAssetLoader.SelectedSaber; + var currentSaberData = CustomSaber.Utilities.SaberAssetLoader.CustomSabers[index]; + return currentSaberData.AssetBundle; } /// diff --git a/CustomMenuPointers/Plugin.cs b/CustomMenuPointers/Plugin.cs index 00971a3..c996eff 100644 --- a/CustomMenuPointers/Plugin.cs +++ b/CustomMenuPointers/Plugin.cs @@ -12,9 +12,6 @@ public class Plugin : IBeatSaberPlugin public const string MenuCore = "MenuCore"; public const string StandardGameplay = "StandardGameplay"; - public string Name => AssemblyName; - public string Version => "0.1"; - private CustomMenuPointersUI customMenuPointersUI; public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) @@ -27,11 +24,6 @@ public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) if (nextScene.name == MenuCore) { CustomMenuPointers.instance.ShowMenuPointers(true); - if (this.customMenuPointersUI == null) - { - this.customMenuPointersUI = new GameObject(nameof(CustomMenuPointersUI)).AddComponent(); - this.customMenuPointersUI.AddUIElements(); - } } } @@ -44,6 +36,8 @@ public void OnApplicationStart() PersistentSingleton.TouchInstance(); PersistentSingleton.TouchInstance(); PersistentSingleton.TouchInstance(); + + if (this.customMenuPointersUI == null) this.customMenuPointersUI = new GameObject(nameof(CustomMenuPointersUI)).AddComponent(); } public void OnFixedUpdate() diff --git a/CustomMenuPointers/Properties/AssemblyInfo.cs b/CustomMenuPointers/Properties/AssemblyInfo.cs index 9eaee6d..eb3f00b 100644 --- a/CustomMenuPointers/Properties/AssemblyInfo.cs +++ b/CustomMenuPointers/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -10,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Kylon99")] [assembly: AssemblyProduct("CustomMenuPointers")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +31,5 @@ // 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("0.1.0.0")] -[assembly: AssemblyFileVersion("0.1.0.0")] +[assembly: AssemblyVersion("0.1.1.0")] +[assembly: AssemblyFileVersion("0.1.1.0")] diff --git a/CustomMenuPointers/UI/CustomMenuPointersUI.cs b/CustomMenuPointers/UI/CustomMenuPointersUI.cs index 3419b39..3b26f23 100644 --- a/CustomMenuPointers/UI/CustomMenuPointersUI.cs +++ b/CustomMenuPointers/UI/CustomMenuPointersUI.cs @@ -1,5 +1,7 @@ -using BeatSaberMarkupLanguage.Settings; -using CustomUI.MenuButton; +using BeatSaberMarkupLanguage; +using BeatSaberMarkupLanguage.MenuButtons; +using BeatSaberMarkupLanguage.Settings; +using BS_Utils.Utilities; using UnityEngine; namespace CustomMenuPointers.UI @@ -13,21 +15,24 @@ public class CustomMenuPointersUI : MonoBehaviour private void Awake() { - this.customMenuPointerMenu = new GameObject(nameof(ModMainFlowCoordinator)).AddComponent(); + var menuButton = new MenuButton("Menu Pointers", "Change the pointers seen in the menus!", ShowModFlowCoordinator, true); + MenuButtons.instance.RegisterButton(menuButton); + + BSMLSettings.instance.AddSettingsMenu("Menu Pointers", Plugin.AssemblyName + ".UI.Views.SettingsView.bsml", MenuSettings.instance); } - public void AddUIElements() + public void AddMenuSettings() { - // Show the Menu Pointer settings menu button - BSMLSettings.instance.AddSettingsMenu( - "Menu Pointers", - Plugin.AssemblyName + ".UI.Views.SettingsView.bsml", - MenuSettings.instance); + } + + public void ShowModFlowCoordinator() + { + if (this.customMenuPointerMenu == null) + this.customMenuPointerMenu = BeatSaberUI.CreateFlowCoordinator(); + + if (this.customMenuPointerMenu.IsBusy) return; - var menuButton = MenuButtonUI.AddButton("Menu Pointers", "Change the pointers seen in the menus!", () => - { - this.customMenuPointerMenu.Present(); - }); + BeatSaberUI.MainFlowCoordinator.InvokeMethod("PresentFlowCoordinator", customMenuPointerMenu, null, false, false); } } } diff --git a/CustomMenuPointers/UI/ModMainFlowCoordinator.cs b/CustomMenuPointers/UI/ModMainFlowCoordinator.cs index 98ead4c..dc89175 100644 --- a/CustomMenuPointers/UI/ModMainFlowCoordinator.cs +++ b/CustomMenuPointers/UI/ModMainFlowCoordinator.cs @@ -1,8 +1,5 @@ using BeatSaberMarkupLanguage; -using BS_Utils.Utilities; -using System.Linq; -using UnityEngine; -using VRUI; +using HMUI; namespace CustomMenuPointers.UI { @@ -11,36 +8,31 @@ namespace CustomMenuPointers.UI /// public class ModMainFlowCoordinator : FlowCoordinator { - private DismissableNavigationController dismissableNavController; + private SelectionListViewController selectionListViewController; + public bool IsBusy { get; set; } - public void Present() + private void Awake() { - var mainFlowCoordinator = Resources.FindObjectsOfTypeAll().First(); - mainFlowCoordinator.InvokeMethod("PresentFlowCoordinator", new object[] { this, null, false, false }); + selectionListViewController = BeatSaberUI.CreateViewController(); } protected override void DidActivate(bool firstActivation, ActivationType activationType) { - if (firstActivation && activationType == ActivationType.AddedToHierarchy) + if (firstActivation) { this.title = "Custom Menu Pointers"; - - // Create and assign our view controllers - var selectionListViewController = BeatSaberUI.CreateViewController(); - - this.dismissableNavController = Instantiate(Resources.FindObjectsOfTypeAll().First()); - this.dismissableNavController.didFinishEvent += this.Dismiss; - - this.SetViewControllerToNavigationConctroller(this.dismissableNavController, selectionListViewController); - this.ProvideInitialViewControllers(this.dismissableNavController); + showBackButton = true; } + + IsBusy = true; + this.ProvideInitialViewControllers(selectionListViewController); + IsBusy = false; } - private void Dismiss(DismissableNavigationController navController) + protected override void BackButtonWasPressed(ViewController topViewController) { - var mainFlowCoordinator = Resources.FindObjectsOfTypeAll().First(); - (mainFlowCoordinator as FlowCoordinator).InvokeMethod("DismissFlowCoordinator", new object[] { this, null, false }); + if (IsBusy) return; + BeatSaberUI.MainFlowCoordinator.DismissFlowCoordinator(this); } - } } diff --git a/CustomMenuPointers/UI/SelectionListViewController.cs b/CustomMenuPointers/UI/SelectionListViewController.cs index 2febd65..b8f4ad5 100644 --- a/CustomMenuPointers/UI/SelectionListViewController.cs +++ b/CustomMenuPointers/UI/SelectionListViewController.cs @@ -1,7 +1,7 @@ using BeatSaberMarkupLanguage.Attributes; using BeatSaberMarkupLanguage.Components; using BeatSaberMarkupLanguage.ViewControllers; -using CustomUI.Utilities; +using BS_Utils.Utilities; using HMUI; using static BeatSaberMarkupLanguage.Components.CustomListTableData; diff --git a/CustomMenuPointers/manifest.json b/CustomMenuPointers/manifest.json index a49fef7..4bb9308 100644 --- a/CustomMenuPointers/manifest.json +++ b/CustomMenuPointers/manifest.json @@ -3,17 +3,15 @@ "author": "Kylon99", "description": "Loads custom menu pointers for Beat Saber", "features": [], - "gameVersion": "1.3.0", + "gameVersion": "1.7.0", "icon": "CustomMenuPointers.Resources.CustomMenuPointers.png", - "id": "custommenupointers", + "id": "CustomMenuPointers", "name": "CustomMenuPointers", - "version": "0.1.0", + "version": "0.1.1", "dependsOn": { - "BSIPA": "^3.12.2", - "BS Utils": "^1.3.6", - "BeatSaberMarkupLanguage": "^1.0.4", - "Custom Sabers": "^3.2.2", - "CustomUI": "^1.6.0" + "BSIPA": "^3.13.7", + "BeatSaberMarkupLanguage": "^1.1.4", + "BS Utils": "^1.4.1" }, "links": { "project-home": "https://github.com/Kylon99/CustomMenuPointers", diff --git a/README.md b/README.md index 958b319..b861c5e 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,9 @@ ## Requirements This mod depends on the following mods. Download them at [BeatMods](https://beatmods.com). -* BSIPA v3.13.2 -* BS Utils v1.3.6 -* BSML v1.0.4 -* CustomUI v1.6.0 -* Custom Sabers v3.2.2 +* BSIPA v3.13.7 +* BeatSaberMarkupLanguage v1.1.4 +* BS Utils v1.4.1 ## Installation @@ -19,6 +17,10 @@ Drop the CustomMenuPointers.dll file into your Plugins folder under your BeatSab ## Changelog +### 0.1.1 +* Updated to support Beat Saber 1.7.0 +* Updated to support Custom Sabers 4.0.1 + ### 0.1.0 * Initial checkin * Supports using Custom Sabers as the Menu Pointer