├── WikiImages
├── Ban.png
├── Oldest.png
├── Utility.png
├── SongMenu.png
└── Suggestions.png
├── TaohSongSuggest
├── UI
│ ├── Images
│ │ ├── sync.png
│ │ └── kofilogo.png
│ ├── MapListController.cs
│ ├── Views
│ │ ├── PlaylistDetailView.bsml
│ │ ├── SongSuggestTab.bsml
│ │ ├── AccSaberSettings.bsml
│ │ ├── LevelDetailSuggestButtonsView.bsml
│ │ ├── SongSuggestLeft.bsml
│ │ └── SongSuggestMain.bsml
│ ├── SettingsLeftController.cs
│ ├── TSSFlowCoordinator.cs
│ ├── PlaylistDetailViewController.cs
│ ├── TabViewController.cs
│ ├── SettingsController.cs
│ └── LevelDetailViewController.cs
├── Configuration
│ ├── InitialData
│ │ └── Files.meta
│ └── PluginConfig.cs
├── Directory.Build.props
├── manifest.json
├── Managers
│ ├── UIManager.cs
│ └── SongSuggestManager.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Patches
│ ├── LevelDetailPatch.cs
│ ├── LevelPackPatch.cs
│ └── ProcessScorePatch.cs
├── Plugin.cs
└── SmartSongSuggest.csproj
├── Files.meta
├── .editorconfig
├── SmartSongSuggest.sln
├── .gitattributes
└── .gitignore
/WikiImages/Ban.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/WikiImages/Ban.png
--------------------------------------------------------------------------------
/WikiImages/Oldest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/WikiImages/Oldest.png
--------------------------------------------------------------------------------
/WikiImages/Utility.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/WikiImages/Utility.png
--------------------------------------------------------------------------------
/WikiImages/SongMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/WikiImages/SongMenu.png
--------------------------------------------------------------------------------
/WikiImages/Suggestions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/WikiImages/Suggestions.png
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Images/sync.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/TaohSongSuggest/UI/Images/sync.png
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Images/kofilogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HypersonicSharkz/SmartSongSuggest/HEAD/TaohSongSuggest/UI/Images/kofilogo.png
--------------------------------------------------------------------------------
/Files.meta:
--------------------------------------------------------------------------------
1 | {"top10kVersion":"50.0","songLibraryVersion":"44.0","top10kUpdated":"2025-12-13T13:47:22.6094171Z","beatLeaderLeaderboardUpdated":1765608371,"beatLeaderSongsUpdated":1765608371}
--------------------------------------------------------------------------------
/TaohSongSuggest/Configuration/InitialData/Files.meta:
--------------------------------------------------------------------------------
1 | {"top10kVersion":"50.1","songLibraryVersion":"45.1","top10kUpdated":"2025-12-18T13:09:16.723718Z","beatLeaderLeaderboardUpdated":1766042160,"beatLeaderSongsUpdated":1766042160}
--------------------------------------------------------------------------------
/TaohSongSuggest/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | True
6 | BSIPA
7 |
8 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/MapListController.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage.ViewControllers;
2 | using HMUI;
3 | using System;
4 |
5 | namespace SmartSongSuggest.UI
6 | {
7 | class MapListController : BSMLAutomaticViewController
8 | {
9 | public TableCell CellForIdx(TableView tableView, int idx)
10 | {
11 | throw new NotImplementedException();
12 | }
13 |
14 | public float CellSize() => 14f;
15 |
16 | public int NumberOfCells()
17 | {
18 | throw new NotImplementedException();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # CS0649: Field 'LevelDetailViewController.parserParams' is never assigned to, and will always have its default value null
4 | dotnet_diagnostic.CS0649.severity = suggestion
5 |
6 | # CS0169: The field 'PlaylistDetailViewController.parserParams' is never used
7 | dotnet_diagnostic.CS0169.severity = suggestion
8 |
9 | # CS0067: The event 'PlaylistDetailViewController.PropertyChanged' is never used
10 | dotnet_diagnostic.CS0067.severity = suggestion
11 |
12 | # CS0414: The field 'PluginConfig._activeLeaderboard' is assigned but its value is never used
13 | dotnet_diagnostic.CS0414.severity = suggestion
14 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Views/PlaylistDetailView.bsml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/TaohSongSuggest/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json",
3 | "id": "SmartSongSuggest",
4 | "name": "SmartSongSuggest",
5 | "author": "HypersonicSharkz & Taoh",
6 | "version": "2.1.1",
7 | "description": "Can make and update a playlist with ranked song suggestions, based on played and liked songs. Option to ban songs temporary or permanent. Can also make a playlist based on oldest ranked scores.",
8 | "gameVersion": "1.38.0",
9 | "dependsOn": {
10 | "BSIPA": "^4.2.0",
11 | "SongCore": "^3.8.0",
12 | "BeatSaberPlaylistsLib": "^1.5.0",
13 | "BeatSaberMarkupLanguage": "^1.5.0",
14 | "SongDetailsCache": "^1.1.2",
15 | "BS Utils": "^1.11.0"
16 | }
17 | }
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Views/SongSuggestTab.bsml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Managers/UIManager.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage.MenuButtons;
2 | using HMUI;
3 | using BeatSaberMarkupLanguage;
4 | using SmartSongSuggest.UI;
5 | using BeatSaberMarkupLanguage.GameplaySetup;
6 | using System.Threading.Tasks;
7 | using System.Threading;
8 |
9 | namespace SmartSongSuggest.Managers
10 | {
11 | static class UIManager
12 | {
13 | public static void Init()
14 | {
15 | GameplaySetup.Instance.AddTab("Smart Song Suggest", "SmartSongSuggest.UI.Views.SongSuggestTab.bsml", TabViewController.instance);
16 | TabViewController.instance.Initialize();
17 | }
18 |
19 | internal static FlowCoordinator _parentFlow { get; private set; }
20 | internal static TSSFlowCoordinator _flow { get; private set; }
21 |
22 | public static void ShowFlow() => ShowFlow(false);
23 | public static void ShowFlow(bool immediately)
24 | {
25 | if (_flow == null)
26 | _flow = BeatSaberUI.CreateFlowCoordinator();
27 |
28 | _parentFlow = BeatSaberUI.MainFlowCoordinator.YoungestChildFlowCoordinatorOrSelf();
29 |
30 | BeatSaberUI.PresentFlowCoordinator(_parentFlow, _flow, immediately: immediately);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Views/AccSaberSettings.bsml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SmartSongSuggest.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.7.34024.191
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartSongSuggest", "TaohSongSuggest\SmartSongSuggest.csproj", "{6D0449C7-68C0-4F15-A36F-F3DCA1882696}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{18D6DB90-F5BA-4BCD-9E04-611710AD488D}"
9 | ProjectSection(SolutionItems) = preProject
10 | .editorconfig = .editorconfig
11 | EndProjectSection
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Release|Any CPU = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {6D0449C7-68C0-4F15-A36F-F3DCA1882696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {6D0449C7-68C0-4F15-A36F-F3DCA1882696}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {6D0449C7-68C0-4F15-A36F-F3DCA1882696}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {6D0449C7-68C0-4F15-A36F-F3DCA1882696}.Release|Any CPU.Build.0 = Release|Any CPU
23 | EndGlobalSection
24 | GlobalSection(SolutionProperties) = preSolution
25 | HideSolutionNode = FALSE
26 | EndGlobalSection
27 | GlobalSection(ExtensibilityGlobals) = postSolution
28 | SolutionGuid = {069FCBFA-7C65-45C1-B060-599C24A9D410}
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("SmartSongSuggest")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("SmartSongSuggest")]
12 | [assembly: AssemblyCopyright("Copyright © 2022")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("6abc286e-aa1f-4299-a734-3f10ea92795b")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("2.1.1")]
35 | [assembly: AssemblyFileVersion("2.1.1")]
36 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/SettingsLeftController.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage.Attributes;
2 | using BeatSaberMarkupLanguage.ViewControllers;
3 | using SmartSongSuggest.Configuration;
4 | using SmartSongSuggest.Managers;
5 | using System.ComponentModel;
6 | using System.Reflection;
7 |
8 | namespace SmartSongSuggest.UI
9 | {
10 | [HotReload(RelativePathToLayout = @"Views\SongSuggestLeft.bsml")]
11 | [ViewDefinition("SmartSongSuggest.UI.Views.SongSuggestLeft.bsml")]
12 | class SettingsLeftController : BSMLAutomaticViewController, INotifyPropertyChanged
13 | {
14 | public static PluginConfig cfgInstance = SettingsController.cfgInstance;
15 |
16 |
17 |
18 | string uiVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
19 | string coreVersion = $"{SongSuggestNS.SongSuggest.GetCoreVersion()}";
20 | [UIValue("mod-version")]
21 | public string modVersion => $"UI: {uiVersion}\nCore: {coreVersion}";
22 |
23 | [UIAction("open-kofi")]
24 | public void OpenKoFi()
25 | {
26 | System.Diagnostics.Process.Start("https://ko-fi.com/smartsongsuggest");
27 | }
28 |
29 | public void ClearCache()
30 | {
31 | SongSuggestManager.toolBox.ClearUser();
32 | }
33 |
34 | public void ClearBans()
35 | {
36 | SongSuggestManager.toolBox.ClearBan();
37 | }
38 |
39 | public void ClearSeeds()
40 | {
41 | SongSuggestManager.toolBox.ClearLiked();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Patches/LevelDetailPatch.cs:
--------------------------------------------------------------------------------
1 | using HarmonyLib;
2 | using System.Collections;
3 | using SmartSongSuggest.UI;
4 | using UnityEngine;
5 | using SmartSongSuggest.Managers;
6 | using System;
7 | using BeatSaberPlaylistsLib;
8 |
9 | namespace SmartSongSuggest.Patches
10 | {
11 | [HarmonyPatch(typeof(StandardLevelDetailViewController), "DidActivate")]
12 | static class LevelDetailPatch
13 | {
14 | static void Prefix(StandardLevelDetailViewController __instance, bool firstActivation)
15 | {
16 | //Informs the SongSuggestManager a new assignment is needed.
17 | if (firstActivation)
18 | {
19 | if (SettingsController.cfgInstance.LogEnabled) Console.WriteLine("Prefix: First Activation");
20 | SongSuggestManager.needsAssignment = true;
21 | }
22 |
23 | //Only activate once on a new reload, and only after SongSuggestCore is done loading
24 | if (SongSuggestManager.needsAssignment)
25 | {
26 | SongSuggestManager.needsAssignment = false;
27 | SharedCoroutineStarter.instance.StartCoroutine(InitDelayed(__instance.transform));
28 | SettingsController.cfgInstance.CachedPlayerID = BS_Utils.Gameplay.GetUserInfo.GetUserID();
29 | }
30 | }
31 |
32 | static IEnumerator InitDelayed(Transform t)
33 | {
34 | while (!SongSuggestManager.readyForAssignment)
35 | yield return new WaitForEndOfFrame();
36 |
37 | try
38 | {
39 | LevelDetailViewController.AttachTo(t.Find("LevelDetail"));
40 | }
41 | catch (Exception e)
42 | {
43 | SongSuggestManager.needsAssignment = true;
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/TSSFlowCoordinator.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage;
2 | using HMUI;
3 | using SmartSongSuggest.Managers;
4 | using UnityEngine;
5 |
6 | namespace SmartSongSuggest.UI
7 | {
8 | class TSSFlowCoordinator : FlowCoordinator
9 | {
10 | internal static SettingsController settingsView;
11 | internal static SettingsLeftController settingsLeftView;
12 | internal static MapListController mapListView;
13 |
14 | public static TSSFlowCoordinator Instance;
15 |
16 | protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
17 | {
18 | Instance = this;
19 |
20 | if (firstActivation)
21 | {
22 | SetTitle("Smart Song Suggest");
23 | settingsView = BeatSaberUI.CreateViewController();
24 | settingsLeftView = BeatSaberUI.CreateViewController();
25 |
26 | ProvideInitialViewControllers(settingsView, settingsLeftView);
27 |
28 | showBackButton = true;
29 | }
30 | }
31 |
32 | public void ToggleBackButton(bool enable)
33 | {
34 | GameObject backBtn = GameObject.Find("MenuCore/UI/ScreenSystem/TopScreen/TitleViewController/BackButton");
35 | backBtn.GetComponent().interactable = enable;
36 |
37 | settingsView.SetButtonsEnable(enable);
38 | }
39 |
40 | protected override void BackButtonWasPressed(ViewController topViewController)
41 | {
42 | UIManager._parentFlow.DismissFlowCoordinator(this, () =>
43 | {
44 | if (SongSuggestManager.lastPlaylist != null)
45 | {
46 | SongSuggestManager.GoToPlaylist(SongSuggestManager.lastPlaylist);
47 | }
48 | LevelDetailViewController.persController.CheckButtons();
49 | }, ViewController.AnimationDirection.Horizontal, true);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Plugin.cs:
--------------------------------------------------------------------------------
1 | using HarmonyLib;
2 | using IPA;
3 | using IPA.Config;
4 | using IPA.Config.Stores;
5 | using SongDetailsCache;
6 | using System.Reflection;
7 | using SmartSongSuggest.Configuration;
8 | using SmartSongSuggest.Managers;
9 | using SmartSongSuggest.UI;
10 | using IPALogger = IPA.Logging.Logger;
11 | using UnityEngine;
12 | using System.Collections;
13 | using BeatSaberMarkupLanguage.Util;
14 | using BeatSaberMarkupLanguage.MenuButtons;
15 | using System;
16 |
17 | namespace SmartSongSuggest
18 | {
19 | [Plugin(RuntimeOptions.DynamicInit)]
20 | public class Plugin
21 | {
22 | internal static IPALogger Log { get; private set; }
23 | internal static Harmony harmony { get; private set; }
24 |
25 | internal static SongDetails songDetails { get; private set; }
26 |
27 | [Init]
28 | ///
29 | /// Called when the plugin is first loaded by IPA (either when the game starts or when the plugin is enabled if it starts disabled).
30 | /// [Init] methods that use a Constructor or called before regular methods like InitWithConfig.
31 | /// Only use [Init] with one Constructor.
32 | ///
33 | public void Init(IPALogger logger, Config conf)
34 | {
35 | Log = logger;
36 |
37 | SettingsController.cfgInstance = conf.Generated();
38 | if (SettingsController.cfgInstance.LogEnabled) Log.Info("SmartSongSuggest initialized.");
39 | MainMenuAwaiter.MainMenuInitializing += MainMenuAwaiter_MainMenuInitializing;
40 | }
41 |
42 | private void MainMenuAwaiter_MainMenuInitializing()
43 | {
44 | UIManager.Init();
45 | SongSuggestManager.Init();
46 | songDetails = SongDetails.Init().Result;
47 | }
48 |
49 | [OnStart]
50 | public void OnApplicationStart()
51 | {
52 | harmony = new Harmony("HypersonicSharkz.BeatSaber.SmartSongSuggest");
53 | harmony.PatchAll(Assembly.GetExecutingAssembly());
54 | }
55 |
56 | [OnExit]
57 | public void OnApplicationQuit()
58 | {
59 | harmony.UnpatchSelf();
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Views/LevelDetailSuggestButtonsView.bsml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Patches/LevelPackPatch.cs:
--------------------------------------------------------------------------------
1 | using HarmonyLib;
2 | using System.Collections;
3 | using SmartSongSuggest.UI;
4 | using UnityEngine;
5 | using SmartSongSuggest.Managers;
6 | using System;
7 | using SongSuggestNS;
8 | using Newtonsoft.Json.Linq;
9 | using BeatSaberPlaylistsLib;
10 |
11 | namespace SmartSongSuggest.Patches
12 | {
13 | [HarmonyPatch(typeof(LevelPackDetailViewController), "DidActivate")]
14 | static class LevelPackPatch
15 | {
16 | static void Prefix(LevelPackDetailViewController __instance, bool firstActivation)
17 | {
18 | //Informs the SongSuggestManager a new assignment is needed.
19 | if (firstActivation)
20 | {
21 | Helper.levelPackDetailViewController = __instance;
22 | Helper.TryAttach();
23 | }
24 | }
25 | }
26 |
27 | [HarmonyPatch(typeof(AnnotatedBeatmapLevelCollectionsViewController), "DidActivate")]
28 | static class AnnotatedLevelPackPatch
29 | {
30 | static void Prefix(AnnotatedBeatmapLevelCollectionsViewController __instance, bool firstActivation)
31 | {
32 | //Informs the SongSuggestManager a new assignment is needed.
33 | if (firstActivation)
34 | {
35 | Helper.annotatedBeatmapLevelCollections = __instance;
36 | Helper.TryAttach();
37 | }
38 | }
39 | }
40 |
41 |
42 | static class Helper
43 | {
44 | public static AnnotatedBeatmapLevelCollectionsViewController annotatedBeatmapLevelCollections;
45 | public static LevelPackDetailViewController levelPackDetailViewController;
46 |
47 | public static void TryAttach()
48 | {
49 | if (!annotatedBeatmapLevelCollections || !levelPackDetailViewController)
50 | return;
51 |
52 | SharedCoroutineStarter.instance.StartCoroutine(InitDelayed());
53 | }
54 |
55 | static IEnumerator InitDelayed()
56 | {
57 | yield return new WaitForEndOfFrame();
58 |
59 | PlaylistDetailViewController.AttachTo(levelPackDetailViewController.transform.Find("Detail"), levelPackDetailViewController, annotatedBeatmapLevelCollections);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SmartSongSuggest.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SmartSongSuggest.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Patches/ProcessScorePatch.cs:
--------------------------------------------------------------------------------
1 | using HarmonyLib;
2 | using SmartSongSuggest.UI;
3 | using SongLibraryNS;
4 |
5 | namespace SmartSongSuggest.Patches
6 | {
7 | [HarmonyPatch(typeof(LevelCompletionResultsHelper), nameof(LevelCompletionResultsHelper.ProcessScore))]
8 | static class ProcessScorePatch
9 | {
10 | static void Postfix(in BeatmapKey beatmapKey, PlayerData playerData, PlayerLevelStatsData playerLevelStats, LevelCompletionResults levelCompletionResults, IReadonlyBeatmapData transformedBeatmapData, PlatformLeaderboardsModel platformLeaderboardsModel)
11 | {
12 | Managers.SongSuggestManager.toolBox.log?.WriteLine($"Processing Result Screen");
13 | //if (!SettingsController.cfgInstance.RecordLocalScores) return;
14 |
15 | //We respect score submissions being turned off
16 | if (BS_Utils.Gameplay.ScoreSubmission.Disabled) return;
17 |
18 | //A fail is a fail
19 | if (levelCompletionResults.levelEndStateType == LevelCompletionResults.LevelEndStateType.Failed) return;
20 |
21 | float maxScore = ScoreModel.ComputeMaxMultipliedScoreForBeatmap(transformedBeatmapData);
22 | int modifiedScore = levelCompletionResults.modifiedScore;
23 | int multipliedScore = levelCompletionResults.multipliedScore;
24 |
25 | //Avoid Lightshow maps with 0 notes, as it can give divice by 0 for acc. One should not record lightshows, one should enjoy them.
26 | if (modifiedScore == 0 || maxScore == 0) return;
27 |
28 | //Played hit 0 energy and failed during gameplay. This is leaderboard specific handling, for Song Suggest locals we only use songs that was completed without triggering NoFail.
29 | if (levelCompletionResults.energy == 0) return;
30 |
31 | //??Is this a check for speed FS/SF, or level failed with NoFail turned on??
32 | //if (modifiedScore > multipliedScore) return;
33 |
34 | //Multiplied is "base score" and "modified score" is including modifiers, we record base acc, and further modifications should be done "elsewhere".
35 | float acc = multipliedScore / maxScore;
36 |
37 | string mapType = playerLevelStats.beatmapCharacteristic.serializedName;
38 | string mapId = beatmapKey.levelId.Substring(13).Split('_')[0];
39 | string difficulty = beatmapKey.difficulty.SerializedName();
40 | var songID = SongLibrary.GetID(mapType, difficulty, mapId);
41 |
42 | //Mod can only calculate with Normal speed for now.
43 | string speed = $"{levelCompletionResults.gameplayModifiers.songSpeed}";
44 | if (speed != "Normal") return;
45 |
46 | //**Missing ... generation of the modifiers text
47 | //Store Session Score
48 | Managers.SongSuggestManager.toolBox.AddSessionScore(songID, acc, "");
49 |
50 | //Verify that recording is active)
51 | if (SettingsController.cfgInstance.RecordLocalScores) Managers.SongSuggestManager.toolBox.AddLocalScore(songID, acc, "");
52 |
53 | //Update the RankPlate as data changed.
54 | LevelDetailViewController.persController.RankPlateChanged();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Views/SongSuggestLeft.bsml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/PlaylistDetailViewController.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage;
2 | using BeatSaberMarkupLanguage.Attributes;
3 | using BeatSaberMarkupLanguage.Parser;
4 | using BeatSaberPlaylistsLib;
5 | using BeatSaberPlaylistsLib.Types;
6 | using HMUI;
7 | using Settings;
8 | using SmartSongSuggest.Configuration;
9 | using SmartSongSuggest.Managers;
10 | using SongSuggestNS;
11 | using System;
12 | using System.Collections.Generic;
13 | using System.ComponentModel;
14 | using System.Linq;
15 | using System.Reflection;
16 | using System.Text;
17 | using System.Threading.Tasks;
18 | using UnityEngine;
19 |
20 | namespace SmartSongSuggest.UI
21 | {
22 | public class PlaylistDetailViewController : INotifyPropertyChanged
23 | {
24 | internal static readonly PlaylistDetailViewController persController = new PlaylistDetailViewController();
25 | internal LevelPackDetailViewController lpdvc;
26 | internal static AnnotatedBeatmapLevelCollectionsViewController annotatedBeatmapLevelCollectionsViewController;
27 | internal static IPlaylist selectedPlaylist;
28 |
29 | public event PropertyChangedEventHandler PropertyChanged;
30 |
31 | [UIParams]
32 | private readonly BSMLParserParams parserParams;
33 |
34 | [UIComponent("root")]
35 | private readonly Transform rootTransform;
36 |
37 | [UIComponent("syncurl-button")]
38 | private readonly NoTransitionsButton syncUrlButton;
39 |
40 | private void ProcessSyncPlaylist()
41 | {
42 | Task.Run(() =>
43 | {
44 | //Save link to updated playlist in case user selects another during update. (under async thread, we can have a delay when requesting the playlist from web in SongSuggestCore.)
45 | var pl = selectedPlaylist;
46 |
47 | if (selectedPlaylist == null)
48 | return;
49 |
50 | string path = PlaylistManager.DefaultManager.GetManagerForPlaylist(selectedPlaylist).PlaylistPath;
51 | path = path.Replace(PlaylistManager.DefaultManager.PlaylistPath, "");
52 |
53 | string fileName = selectedPlaylist.Filename;
54 | string extension = selectedPlaylist.SuggestedExtension;
55 | SongSuggestManager.toolBox.log?.WriteLine($"Variables: {path} {fileName} {extension}");
56 |
57 | PlaylistPath playlistPath = new PlaylistPath() { FileExtension = extension, FileName = fileName, Subfolders = path };
58 |
59 | SongSuggest.MainInstance.FilterSyncURL(playlistPath, playlistPath);
60 |
61 | //Tell main thread to update the playlist.
62 | IPA.Utilities.Async.UnityMainThreadTaskScheduler.Factory.StartNew(() =>
63 | {
64 | SongSuggestManager.UpdatePlaylists(pl);
65 | });
66 | });
67 | }
68 |
69 | public static bool AttachTo(Transform t, LevelPackDetailViewController pack, AnnotatedBeatmapLevelCollectionsViewController collectionsViewController)
70 | {
71 | if (t == null)
72 | return false;
73 |
74 | try
75 | {
76 | annotatedBeatmapLevelCollectionsViewController = collectionsViewController;
77 |
78 | BSMLParser.Instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "SmartSongSuggest.UI.Views.PlaylistDetailView.bsml"), t.gameObject, persController);
79 | persController.rootTransform.localScale *= 0.6f;
80 | persController.lpdvc = pack;
81 | persController.lpdvc.didActivateEvent += Lpdvc_didActivateEvent;
82 |
83 | annotatedBeatmapLevelCollectionsViewController.didSelectAnnotatedBeatmapLevelCollectionEvent += collectionSelected;
84 | collectionSelected(annotatedBeatmapLevelCollectionsViewController.selectedAnnotatedBeatmapLevelPack);
85 | return true;
86 | }
87 | catch (Exception ex)
88 | {
89 | Plugin.Log.Error(ex);
90 | return false;
91 | }
92 | }
93 |
94 | private static void collectionSelected(BeatmapLevelPack obj)
95 | {
96 | if (obj is PlaylistLevelPack pl)
97 | {
98 | selectedPlaylist = pl.playlist;
99 | }
100 | else
101 | {
102 | selectedPlaylist = null;
103 | }
104 |
105 | persController.UpdateView();
106 | }
107 |
108 | private static void Lpdvc_didActivateEvent(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
109 | {
110 | persController.UpdateView();
111 | }
112 |
113 | private void UpdateView()
114 | {
115 | var cfg = SettingsController.cfgInstance;
116 | bool active = selectedPlaylist != null && selectedPlaylist.TryGetCustomData("syncURL", out var outSyncURL) && cfg.ShowSyncURL;
117 | syncUrlButton.gameObject.SetActive(active);
118 | //syncUrlButton.gameObject.SetActive(selectedPlaylist != null && selectedPlaylist.TryGetCustomData("syncURL", out var outSyncURL));
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/TabViewController.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage.Attributes;
2 | using BeatSaberMarkupLanguage.Components;
3 | using BeatSaberMarkupLanguage.Util;
4 | using BeatSaberMarkupLanguage.ViewControllers;
5 | using BeatSaberPlaylistsLib.Types;
6 | using HMUI;
7 | using Settings;
8 | using SmartSongSuggest.Configuration;
9 | using SmartSongSuggest.Managers;
10 | using System;
11 | using System.Collections.Generic;
12 | using System.Linq;
13 | using System.Text;
14 | using System.Threading;
15 | using System.Threading.Tasks;
16 | using TMPro;
17 | using UnityEngine;
18 |
19 | namespace SmartSongSuggest.UI
20 | {
21 | internal class TabViewController : NotifiableSingleton
22 | {
23 | [UIComponent("bgProgress")]
24 | public ImageView bgProgress;
25 |
26 | [UIComponent("statusText")]
27 | public TextMeshProUGUI statusComponent;
28 |
29 | [UIValue("loaded")]
30 | public bool loaded
31 | {
32 | get => SongSuggestManager.toolBox != null;
33 | }
34 |
35 | public async void Initialize()
36 | {
37 | while (SongSuggestManager.toolBox == null)
38 | {
39 | RefreshProgressBar(0);
40 | await Task.Delay(200);
41 | }
42 |
43 | RefreshProgressBar(0);
44 |
45 | NotifyPropertyChanged(nameof(loaded));
46 | }
47 |
48 | [UIAction("RegenSuggest")]
49 | public void RegenSuggest()
50 | {
51 | Task.Run(() =>
52 | {
53 | try
54 | {
55 | while (SongSuggestManager.toolBox == null)
56 | Thread.Sleep(500);
57 |
58 | SongSuggestManager.toolBox.status = "Starting Search";
59 |
60 | IPA.Utilities.Async.UnityMainThreadTaskScheduler.Factory.StartNew(() => UpdateProgessNew());
61 |
62 | PluginConfig cfg = SettingsController.cfgInstance;
63 |
64 | SongSuggestSettings linkedSettings = SongSuggestManager.GetSongSuggestSettingsOld(cfg);
65 |
66 | SongSuggestManager.toolBox.GenerateSongSuggestions(linkedSettings);
67 |
68 | SongSuggestManager.toolBox.songSuggest.songSuggestCompletion = 1;
69 |
70 | //Task.Delay(100);
71 |
72 | IPA.Utilities.Async.UnityMainThreadTaskScheduler.Factory.StartNew(() =>
73 | {
74 | IPlaylist pl = SongSuggestManager.UpdatePlaylists("Song Suggest");
75 | if (pl == null)
76 | return;
77 |
78 | var lfnc = GameObject.FindObjectOfType();
79 | lfnc.SelectAnnotatedBeatmapLevelCollection(pl.PlaylistLevelPack);
80 | });
81 | }
82 | catch (Exception e)
83 | {
84 | Plugin.Log.Error(e);
85 | }
86 | });
87 | }
88 |
89 | [UIAction("RegenOldest")]
90 | public void RegenOldNew()
91 | {
92 | Task.Run(() =>
93 | {
94 | try
95 | {
96 | while (SongSuggestManager.toolBox == null)
97 | Thread.Sleep(500);
98 |
99 | SongSuggestManager.toolBox.status = "Starting Search";
100 |
101 | IPA.Utilities.Async.UnityMainThreadTaskScheduler.Factory.StartNew(() => UpdateProgessNew());
102 |
103 | var ui = SettingsController.cfgInstance;
104 |
105 | OldAndNewSettings settings = SongSuggestManager.GetOldAndNewSettings(ui);
106 |
107 | SongSuggestManager.toolBox.GenerateOldestSongs(settings);
108 |
109 | IPA.Utilities.Async.UnityMainThreadTaskScheduler.Factory.StartNew(() =>
110 | {
111 | IPlaylist pl = SongSuggestManager.UpdatePlaylists("Old and New");
112 | if (pl == null)
113 | return;
114 |
115 | var lfnc = GameObject.FindObjectOfType();
116 | lfnc.SelectAnnotatedBeatmapLevelCollection(pl.PlaylistLevelPack);
117 | });
118 | }
119 | catch (Exception e)
120 | {
121 | Plugin.Log.Error(e);
122 | }
123 | });
124 | }
125 |
126 | [UIAction("Settings")]
127 | public void Settings()
128 | {
129 | UIManager.ShowFlow();
130 | }
131 |
132 | public async void UpdateProgessNew()
133 | {
134 | while (SongSuggestManager.toolBox.status.ToLowerInvariant() != "ready")
135 | {
136 | RefreshProgressBar(SongSuggestManager.toolBox.songSuggest != null ? (float)SongSuggestManager.toolBox.songSuggest.songSuggestCompletion : 0);
137 | await Task.Delay(200);
138 | }
139 |
140 | SongSuggestManager.toolBox.status = "Ready";
141 | RefreshProgressBar(0);
142 | }
143 |
144 | int dots = 0;
145 | public void RefreshProgressBar(float prog)
146 | {
147 | try
148 | {
149 | dots = (dots % 3) + 1;
150 | statusComponent.text = SongSuggestManager.toolBox != null ? SongSuggestManager.toolBox.status : "Loading" + new string('.', dots);
151 |
152 | bgProgress.color = Color.green;
153 |
154 | //Core was not placed in libs, lets inform user of this
155 | if (!SongSuggestManager.coreDetected)
156 | {
157 | statusComponent.text = "No Core Found, make sure SongSuggestCore.dll is placed in the Libs folder";
158 | bgProgress.color = Color.red;
159 | }
160 |
161 | //Core and UI version do not match
162 | if (!SongSuggestManager.coreVersionValidated)
163 | {
164 | statusComponent.text = "SongSuggestCore.dll is of an unsupported version";
165 | bgProgress.color = Color.red;
166 | }
167 |
168 | var x = (bgProgress.gameObject.transform as RectTransform);
169 | if (x == null)
170 | return;
171 |
172 | x.anchorMax = new Vector2(prog, 1);
173 |
174 | x.ForceUpdateRectTransforms();
175 | }
176 | catch
177 | {
178 |
179 | }
180 |
181 | }
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/SettingsController.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using BeatSaberMarkupLanguage.Attributes;
3 | using BeatSaberMarkupLanguage.ViewControllers;
4 | using HMUI;
5 | using SmartSongSuggest.Configuration;
6 | using SmartSongSuggest.Managers;
7 | using TMPro;
8 | using UnityEngine;
9 | using BeatSaberMarkupLanguage.Parser;
10 | using System.Collections.Generic;
11 | using System.Linq;
12 | using SongSuggestNS;
13 | using System.Collections;
14 | using System;
15 | using Newtonsoft.Json;
16 | using BeatSaberMarkupLanguage;
17 |
18 | namespace SmartSongSuggest.UI
19 | {
20 | [HotReload(RelativePathToLayout = @"Views\SongSuggestMain.bsml")]
21 | [ViewDefinition("SmartSongSuggest.UI.Views.SongSuggestMain.bsml")]
22 | class SettingsController : BSMLAutomaticViewController, INotifyPropertyChanged
23 | {
24 | public static PluginConfig cfgInstance;
25 |
26 | [UIParams]
27 | private readonly BSMLParserParams parserParams;
28 |
29 | [UIComponent("bgProgress")]
30 | public ImageView bgProgress;
31 |
32 | [UIComponent("statusText")]
33 | public TextMeshProUGUI statusComponent;
34 |
35 | [UIComponent("SuggestBTN")]
36 | public NoTransitionsButton suggestBTN;
37 |
38 | [UIComponent("OldestBTN")]
39 | public NoTransitionsButton oldestBTN;
40 |
41 | bool _suggestShow = true;
42 |
43 | [UIValue("suggest-show")]
44 | public bool ShowSuggestSettings
45 | {
46 | get => _suggestShow;
47 | set
48 | {
49 | _suggestShow = value;
50 | NotifyPropertyChanged(nameof(SuggestColor));
51 | NotifyPropertyChanged(nameof(OldestColor));
52 | NotifyPropertyChanged(nameof(ShowOldestSettings));
53 | NotifyPropertyChanged(nameof(ShowSuggestSettings));
54 | }
55 | }
56 |
57 | [UIValue("oldest-show")]
58 | public bool ShowOldestSettings => !_suggestShow;
59 |
60 |
61 | [UIValue("color-suggest")]
62 | public string SuggestColor => _suggestShow ? "#00ff00" : "white";
63 |
64 |
65 | string _errorHeader = "";
66 | [UIValue("error-header")]
67 | public string ErrorHeader => _errorHeader;
68 |
69 | string _errorDescription = "";
70 | [UIValue("error-description")]
71 | public string ErrorDescription => _errorDescription;
72 |
73 |
74 |
75 | [UIValue("color-oldest")]
76 | public string OldestColor => _suggestShow ? "white" : "#00ff00";
77 |
78 | [UIAction("settingsOldest")]
79 | void so()
80 | {
81 | ShowSuggestSettings = false;
82 | }
83 |
84 | [UIAction("settingsSuggest")]
85 | void ss()
86 | {
87 | ShowSuggestSettings = true;
88 | }
89 |
90 | protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
91 | {
92 | base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling);
93 | RefreshProgressBar(0f);
94 | }
95 |
96 | void GenerateOldest()
97 | {
98 | SongSuggestManager.Oldest100ActivePlayer();
99 | }
100 |
101 | void GeneratePlaylist()
102 | {
103 | SongSuggestManager.SuggestSongs();
104 | }
105 |
106 | public void SetButtonsEnable(bool enable)
107 | {
108 | suggestBTN.interactable = enable;
109 | oldestBTN.interactable = enable;
110 | }
111 |
112 | int dots = 0;
113 | public void RefreshProgressBar(float prog)
114 | {
115 | try
116 | {
117 | dots = (dots % 3) + 1;
118 | statusComponent.text = SongSuggestManager.toolBox != null ? SongSuggestManager.toolBox.status : "Loading" + new string('.', dots);
119 |
120 | bgProgress.color = Color.green;
121 |
122 | var x = (bgProgress.gameObject.transform as RectTransform);
123 | if (x == null)
124 | return;
125 |
126 | x.anchorMax = new Vector2(prog, 1);
127 |
128 | x.ForceUpdateRectTransforms();
129 | }
130 | catch
131 | {
132 |
133 | }
134 | }
135 |
136 | public void ShowError(string header, string description)
137 | {
138 | _errorHeader = header;
139 | _errorDescription = description;
140 |
141 | NotifyPropertyChanged(nameof(ErrorDescription));
142 | NotifyPropertyChanged(nameof(ErrorHeader));
143 |
144 | this.parserParams.EmitEvent("close-modal");
145 | this.parserParams.EmitEvent("open-modal");
146 | }
147 |
148 | [UIValue("contents")]
149 | public IList Contents
150 | {
151 | get
152 | {
153 | List contents = new List();
154 |
155 | IEnumerable songCategories = Enum.GetValues(typeof(SongCategory)).Cast();
156 | bool update = false;
157 |
158 | foreach (SongCategory category in songCategories)
159 | {
160 | SongCategoryDisplay savedCategory = cfgInstance.SongCategories.FirstOrDefault(c => c.SongCategory == category);
161 | if (savedCategory == null)
162 | {
163 | savedCategory = new SongCategoryDisplay();
164 | savedCategory.SongCategory = category;
165 | cfgInstance.SongCategories.Add(savedCategory);
166 | update = true;
167 | }
168 |
169 | contents.Add(savedCategory);
170 | }
171 |
172 | if (update)
173 | cfgInstance.Changed();
174 |
175 | return contents;
176 | }
177 | }
178 |
179 | [UIAction("settings-click")]
180 | private void ShowSettings()
181 | {
182 | this.parserParams.EmitEvent("close-settings");
183 | this.parserParams.EmitEvent("open-settings");
184 | }
185 |
186 | [UIAction("accsaber-click")]
187 | private void ShowScoreSaber()
188 | {
189 | this.parserParams.EmitEvent("close-accsaber");
190 | this.parserParams.EmitEvent("open-accsaber");
191 | }
192 |
193 |
194 | [UIAction("categories-click")]
195 | private void ShowCategories()
196 | {
197 | this.parserParams.EmitEvent("close-categories");
198 | this.parserParams.EmitEvent("open-categories");
199 | }
200 |
201 | [UIValue("category-size")]
202 | private int CategorySize
203 | {
204 | get
205 | {
206 | int count = Enum.GetValues(typeof(SongCategory)).Length;
207 | return count * 8 + 15;
208 | }
209 | }
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
364 | /TaohSongSuggest/Configuration/InitialData/Top10kPlayers.json
365 |
--------------------------------------------------------------------------------
/TaohSongSuggest/SmartSongSuggest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {6D0449C7-68C0-4F15-A36F-F3DCA1882696}
9 | Library
10 | Properties
11 | SmartSongSuggest
12 | SmartSongSuggest
13 | v4.8
14 | 512
15 | true
16 | portable
17 | ..\Refs
18 | $(LocalRefsDir)
19 | $(MSBuildProjectDirectory)\
20 |
21 | prompt
22 | 4
23 |
24 |
25 |
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 |
30 |
31 | true
32 | bin\Release\
33 | prompt
34 | 4
35 |
36 |
37 | True
38 |
39 |
40 | True
41 | True
42 |
43 |
44 |
45 | $(BeatSaberDir)\IPA\Libs\0Harmony.dll
46 |
47 |
48 | $(BeatSaberDir)\Beat Saber_Data\Managed\BeatmapCore.dll
49 |
50 |
51 | False
52 | $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll
53 | False
54 |
55 |
56 | $(BeatSaberDir)\Libs\BeatSaberPlaylistsLib.dll
57 |
58 |
59 | False
60 | $(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll
61 | False
62 |
63 |
64 | $(BeatSaberDir)\Plugins\BSML.dll
65 |
66 |
67 | False
68 | $(BeatSaberDir)\Plugins\BS_Utils.dll
69 |
70 |
71 | False
72 | $(BeatSaberDir)\Beat Saber_Data\Managed\DataModels.dll
73 | False
74 |
75 |
76 | False
77 | $(BeatSaberDir)\Beat Saber_Data\Managed\GameplayCore.dll
78 |
79 |
80 | False
81 | $(BeatSaberDir)\Libs\Newtonsoft.Json.dll
82 |
83 |
84 | False
85 | $(BeatSaberDir)\Plugins\SongCore.dll
86 |
87 |
88 | $(BeatSaberDir)\Libs\SongDetailsCache.dll
89 |
90 |
91 | $(BeatSaberDir)\Libs\SongSuggestCore.dll
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | $(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll
101 | False
102 |
103 |
104 | $(BeatSaberDir)\Beat Saber_Data\Managed\HMLib.dll
105 | False
106 |
107 |
108 | $(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll
109 | False
110 |
111 |
112 | $(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll
113 | False
114 |
115 |
116 | $(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll
117 | False
118 |
119 |
120 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.dll
121 | False
122 |
123 |
124 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll
125 | False
126 |
127 |
128 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll
129 | False
130 |
131 |
132 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll
133 | False
134 |
135 |
136 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIModule.dll
137 | False
138 |
139 |
140 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.VRModule.dll
141 | False
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | True
154 | True
155 | Resources.resx
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 | ResXFileCodeGenerator
170 | Resources.Designer.cs
171 | Designer
172 |
173 |
174 |
175 |
176 | .editorconfig
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 | 2.0.0-beta4
191 | runtime; build; native; contentfiles; analyzers; buildtransitive
192 | all
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/LevelDetailViewController.cs:
--------------------------------------------------------------------------------
1 | using BeatSaberMarkupLanguage;
2 | using BeatSaberMarkupLanguage.Attributes;
3 | using System.Reflection;
4 | using UnityEngine;
5 | using System.ComponentModel;
6 | using System;
7 | using HMUI;
8 | using SongDetailsCache.Structs;
9 | using SongCore.Utilities;
10 | using SmartSongSuggest.Managers;
11 | using TMPro;
12 | using System.Collections;
13 | using BeatSaberMarkupLanguage.Parser;
14 | using SongSuggestNS;
15 | using SmartSongSuggest.Configuration;
16 | using BeatSaberPlaylistsLib;
17 | using SongLibraryNS;
18 |
19 | namespace SmartSongSuggest.UI
20 | {
21 | class LevelDetailViewController : INotifyPropertyChanged
22 | {
23 | internal static readonly LevelDetailViewController persController = new LevelDetailViewController();
24 | internal StandardLevelDetailViewController sldv;
25 |
26 | [UIParams]
27 | private readonly BSMLParserParams parserParams;
28 |
29 | [UIComponent("root")]
30 | private readonly Transform rootTransform;
31 |
32 | [UIComponent("addToIgnoredBTN")]
33 | private readonly NoTransitionsButton addToIgnoredBTN;
34 |
35 | [UIComponent("addToLikedBTN")]
36 | private readonly NoTransitionsButton addToLikedBTN;
37 |
38 | [UIComponent("addToIgnoredBTN")]
39 | public TextMeshProUGUI addToIgnoredBTNText;
40 |
41 | [UIComponent("addToLikedBTN")]
42 | public TextMeshProUGUI addToLikedBTNText;
43 |
44 | [UIComponent("rankPlateText")]
45 | public TextMeshProUGUI rankPlateTextMesh;
46 |
47 | bool mapRanked;
48 | bool showRankPlate;
49 | bool showBanButton;
50 | bool showSeedButton;
51 |
52 | public event PropertyChangedEventHandler PropertyChanged;
53 |
54 | private string _banHover;
55 | private string _likeHover;
56 |
57 | private string _banColor = "white";
58 | private string _likeColor = "white";
59 |
60 | private int _banDays;
61 |
62 | [UIValue("ban-hover")]
63 | private string BanHover
64 | {
65 | get => _banHover;
66 | set
67 | {
68 | _banHover = value;
69 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BanHover)));
70 | }
71 | }
72 |
73 | [UIValue("like-hover")]
74 | private string LikeHover
75 | {
76 | get => _likeHover;
77 | set
78 | {
79 | _likeHover = value;
80 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LikeHover)));
81 | }
82 | }
83 |
84 | [UIValue("ban-color")]
85 | private string BanColor
86 | {
87 | get => _banColor;
88 | set
89 | {
90 | _banColor = value;
91 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BanColor)));
92 | }
93 | }
94 |
95 | [UIValue("like-color")]
96 | private string LikeColor
97 | {
98 | get => _likeColor;
99 | set
100 | {
101 | _likeColor = value;
102 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LikeColor)));
103 | }
104 | }
105 |
106 | [UIValue("ban-short")]
107 | private int BanShort => SettingsController.cfgInstance.BanShort;
108 |
109 | [UIValue("ban-medium")]
110 | private int BanMedium => SettingsController.cfgInstance.BanMedium;
111 | [UIValue("ban-long")]
112 | private int BanLong => SettingsController.cfgInstance.BanLong;
113 |
114 | [UIValue("ban-length")]
115 | private string BanCustom
116 | {
117 | get => SettingsController.cfgInstance.BanCustom.ToString();
118 | set
119 | {
120 | if (int.TryParse(value, out _banDays))
121 | {
122 | SettingsController.cfgInstance.BanCustom = _banDays;
123 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BanCustom)));
124 | }
125 | }
126 | }
127 |
128 | [UIAction("one-day-ban")]
129 | private void odb() => AddDifficultyBeatmapToIgnored(SettingsController.cfgInstance.BanShort);
130 |
131 | [UIAction("one-week-ban")]
132 | private void owb() => AddDifficultyBeatmapToIgnored(SettingsController.cfgInstance.BanMedium);
133 |
134 | [UIAction("one-month-ban")]
135 | private void omb() => AddDifficultyBeatmapToIgnored(SettingsController.cfgInstance.BanLong);
136 |
137 | [UIAction("perm-ban")]
138 | private void pb() => AddDifficultyBeatmapToIgnored(-1);
139 |
140 |
141 | [UIAction("custom-day-ban")]
142 | private void CustomDayBan()
143 | {
144 | AddDifficultyBeatmapToIgnored(SettingsController.cfgInstance.BanCustom);
145 | }
146 |
147 | LevelDetailViewController() { }
148 |
149 | public static void AttachTo(Transform t)
150 | {
151 | if (t == null)
152 | return;
153 |
154 | BSMLParser.Instance.Parse(BeatSaberMarkupLanguage.Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "SmartSongSuggest.UI.Views.LevelDetailSuggestButtonsView.bsml"), t.gameObject, persController);
155 | persController.rootTransform.localScale *= 0.7f;
156 | persController.sldv = GameObject.FindObjectOfType();
157 | persController.sldv.didChangeContentEvent += persController.didChangeContent;
158 | persController.sldv.didChangeDifficultyBeatmapEvent += persController.didChangeDifficulty;
159 |
160 | persController.CheckButtons();
161 | }
162 |
163 | private void didChangeDifficulty(StandardLevelDetailViewController arg1)
164 | {
165 | CheckButtons();
166 | }
167 |
168 | private void didChangeContent(StandardLevelDetailViewController arg1, StandardLevelDetailViewController.ContentType arg2)
169 | {
170 | if (arg2 == StandardLevelDetailViewController.ContentType.OwnedAndReady)
171 | {
172 | CheckButtons();
173 | }
174 | }
175 |
176 | string levelHash => sldv != null ? Hashing.GetCustomLevelHash(sldv.beatmapLevel) : null;
177 | string levelDifficulty => sldv?.beatmapKey.difficulty.SerializedName();
178 | string levelCharacteristic => sldv?.beatmapKey.beatmapCharacteristic?.serializedName;
179 | SongID songID => SongSuggestManager.toolBox.songLibrary.GetID(levelCharacteristic, levelDifficulty, levelHash);
180 |
181 |
182 | //Something changed so lets update display components to fit for next rendering.
183 | internal void CheckButtons()
184 | {
185 | try
186 | {
187 |
188 | //Reset variables to not show the components until they are revalidated
189 | addToIgnoredBTN.gameObject.SetActive(false);
190 | addToLikedBTN.gameObject.SetActive(false);
191 | rankPlateTextMesh.gameObject.SetActive(false);
192 | showSeedButton = false;
193 | showBanButton = false;
194 | showRankPlate = false;
195 |
196 | SongSuggestManager.toolBox.log?.WriteLine("Checking if a non Custom Map has been selected");
197 | //Check if we are ready to update (general checks)
198 | //Check song is selected
199 | if (sldv == null) return;
200 | if (sldv.beatmapLevel.hasPrecalculatedData) return;
201 |
202 | //Check SongSuggest has finished loading
203 | if (SongSuggestManager.toolBox == null) return;
204 |
205 | SongSuggestManager.toolBox.log?.WriteLine($"Checking if map is Ranked: {levelCharacteristic} {levelDifficulty} {levelHash}");
206 | mapRanked = SongSuggestManager.toolBox.songLibrary.HasAnySongCategory(songID);
207 |
208 | //Components update their values based on their state.
209 | DisplayBan();
210 | DisplaySeed();
211 | DisplayRankPlate();
212 |
213 | //Update components with new values.
214 | SharedCoroutineStarter.instance.StartCoroutine(SetActiveLate());
215 |
216 |
217 | }
218 | catch (Exception e)
219 | {
220 | Plugin.Log.Error(e);
221 | }
222 |
223 | }
224 |
225 | private void DisplayRankPlate()
226 | {
227 | //Reset text for now
228 | rankPlateTextMesh.text = "";
229 |
230 | SongSuggestManager.toolBox.log?.WriteLine($"Checking if RankPlate is active: {SettingsController.cfgInstance.ShowRankPlate}, and song got a Ranking: {mapRanked}");
231 |
232 | if (!mapRanked) return;
233 | showRankPlate = SettingsController.cfgInstance.ShowRankPlate;
234 |
235 | SongSuggestManager.toolBox.log?.WriteLine("Getting Songrank");
236 | string songRank = $"{SongSuggestManager.toolBox.GetSongRanking(songID)}";
237 | string maxRank = $"{SongSuggestManager.toolBox.GetSongRankingCount()}";
238 | string AP = $"{SongSuggestManager.toolBox.GetAPString(songID)}";
239 |
240 | string rankPlateString = "";
241 | if (songRank != "") rankPlateString = $"{rankPlateString} {songRank}/{maxRank}";
242 | if (AP != "") rankPlateString = $"{rankPlateString} {AP}";
243 | rankPlateString = rankPlateString.Trim();
244 |
245 | SongSuggestManager.toolBox.log?.WriteLine($"Setting Rank Plate Text: {rankPlateString}");
246 | rankPlateTextMesh.text = rankPlateString;
247 | }
248 |
249 | private void DisplaySeed()
250 | {
251 | //Only show for ranked maps, others cannot be displayed
252 | if (!mapRanked) return;
253 | showSeedButton = SettingsController.cfgInstance.ShowSeedButton && SettingsController.cfgInstance.UseSeedSongs;
254 |
255 | if (SongSuggestManager.toolBox.songLiking.IsLiked(songID))
256 | {
257 | LikeHover = "Remove song from seed songs.";
258 | LikeColor = "green";
259 | }
260 | else
261 | {
262 | LikeHover = "Mark as a seed song.";
263 | LikeColor = "white";
264 | }
265 | }
266 |
267 | private void DisplayBan()
268 | {
269 | showBanButton = SettingsController.cfgInstance.ShowBanButton;
270 |
271 | if (SongSuggestManager.toolBox.songBanning.IsBanned(songID))
272 | {
273 | BanHover = "Click to unban map from suggestions";
274 | BanColor = "red";
275 | }
276 | else
277 | {
278 | BanHover = "Don't want to see this map in your suggestions? Press this";
279 | BanColor = "white";
280 |
281 | }
282 | }
283 |
284 | IEnumerator SetActiveLate()
285 | {
286 | yield return new WaitForEndOfFrame();
287 | addToIgnoredBTN.gameObject.SetActive(showBanButton);
288 | addToLikedBTN.gameObject.SetActive(showSeedButton);
289 | rankPlateTextMesh.gameObject.SetActive(showRankPlate);
290 | }
291 |
292 | void CheckBanState()
293 | {
294 | //string diffLabel = sldv.beatmapKey.difficulty.SerializedName();
295 | //string characteristic = sldv.beatmapKey.beatmapCharacteristic.serializedName;
296 |
297 | if (SongSuggestManager.toolBox.songBanning.IsBanned(songID))
298 | {
299 | SongSuggestManager.toolBox.songBanning.LiftBan(songID);
300 | }
301 | else
302 | {
303 | parserParams.EmitEvent("open-modal");
304 | }
305 |
306 | CheckButtons();
307 | }
308 |
309 | void AddDifficultyBeatmapToIgnored(int days)
310 | {
311 | //string diffLabel = sldv.beatmapKey.difficulty.SerializedName();
312 | //string characteristic = sldv.beatmapKey.beatmapCharacteristic.serializedName;
313 |
314 | if (days == -1)
315 | {
316 | SongSuggestManager.toolBox.songBanning.SetPermaBan(songID);
317 | }
318 | else
319 | {
320 | SongSuggestManager.toolBox.songBanning.SetBan(songID, days);
321 | }
322 |
323 | CheckButtons();
324 | }
325 |
326 | void AddDifficultyBeatmapToLiked()
327 | {
328 | if (SongSuggestManager.toolBox.songLiking.IsLiked(songID))
329 | {
330 | SongSuggestManager.toolBox.songLiking.RemoveLike(songID);
331 | }
332 | else
333 | {
334 | SongSuggestManager.toolBox.songLiking.SetLike(songID);
335 | }
336 |
337 | CheckButtons();
338 |
339 | }
340 |
341 | public virtual void RankPlateChanged()
342 | {
343 | CheckButtons();
344 | }
345 | }
346 | }
347 |
--------------------------------------------------------------------------------
/TaohSongSuggest/UI/Views/SongSuggestMain.bsml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/TaohSongSuggest/Configuration/PluginConfig.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.CompilerServices;
5 | using BeatSaberMarkupLanguage.Attributes;
6 | using IPA.Config.Stores;
7 | using UnityEngine;
8 | using SongSuggestNS;
9 | using System;
10 | using IPA.Config.Stores.Attributes;
11 | using IPA.Config.Stores.Converters;
12 | using Newtonsoft.Json;
13 | using SmartSongSuggest.UI;
14 | using System.ComponentModel;
15 | using IPA.Config.Data;
16 | using Settings;
17 | using SmartSongSuggest.Managers;
18 | using SongLibraryNS;
19 |
20 | [assembly: InternalsVisibleTo(GeneratedStore.AssemblyVisibilityTarget)]
21 | namespace SmartSongSuggest.Configuration
22 | {
23 | internal class PluginConfig : INotifyPropertyChanged
24 | {
25 | public virtual string __comment_Config_Options__ { get; set; } = "Log/Ban Days";
26 | public virtual bool LogEnabled { get; set; } = false;
27 |
28 | public virtual int BanShort { get; set; } = 1;
29 |
30 | public virtual int BanMedium { get; set; } = 7;
31 |
32 | public virtual int BanLong { get; set; } = 30;
33 |
34 | public virtual int BanCustom { get; set; } = 60;
35 |
36 | public virtual string __comment_Suggest__ { get; set; } = "Configureable Values for the Suggestions Tab starts here";
37 | [Ignore]
38 | [NonNullable]
39 | [UseConverter(typeof(ListConverter))]
40 | public virtual List DefaultLeaderboardNames { get; set; }
41 | [UIValue("suggest-leaderboard-options")]
42 | [Ignore]
43 | public List