Browse Source

Added BSIPA-ModList project

pull/11/head
Anairkoen Schno 5 years ago
parent
commit
da11fe0cca
11 changed files with 387 additions and 0 deletions
  1. +110
    -0
      BSIPA-ModList/BSIPA-ModList.csproj
  2. BIN
      BSIPA-ModList/Icons/Thumbs.db
  3. BIN
      BSIPA-ModList/Icons/mod_bsipa.png
  4. BIN
      BSIPA-ModList/Icons/mod_ipa.png
  5. BIN
      BSIPA-ModList/Icons/self.png
  6. BIN
      BSIPA-ModList/Icons/self.xcf
  7. +65
    -0
      BSIPA-ModList/Plugin.cs
  8. +36
    -0
      BSIPA-ModList/Properties/AssemblyInfo.cs
  9. +135
    -0
      BSIPA-ModList/UI/ModListController.cs
  10. +26
    -0
      BSIPA-ModList/UI/ModListMenu.cs
  11. +15
    -0
      BSIPA-ModList/manifest.json

+ 110
- 0
BSIPA-ModList/BSIPA-ModList.csproj View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{23AB2621-A05C-4377-8418-85E6012C0BBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BSIPA_ModList</RootNamespace>
<AssemblyName>BSIPA-ModList</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\Refs\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BeatSaberCustomUI">
<HintPath>..\Refs\BeatSaberCustomUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\Refs\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\ModListController.cs" />
<Compile Include="UI\ModListMenu.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IPA.Loader\IPA.Loader.csproj">
<Project>{5ad344f0-01a0-4ca8-92e5-9d095737744d}</Project>
<Name>IPA.Loader</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="manifest.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SemanticVersioning">
<Version>1.2.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Icons\mod_bsipa.png" />
<EmbeddedResource Include="Icons\mod_ipa.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Icons\self.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
<Message Text="Packing..." Importance="normal" />
<!--<ItemGroup>
<Dlls Include="$(SolutionDir)IPA.Injector\bin\$(OtherConfig)\**\*" Exclude="$(SolutionDir)IPA.Injector\bin\$(OtherConfig)\Libraries\**\*" />
<Dlls Include="$(SolutionDir)Doorstop\Proxy\bin\x64\$(ProxyConfig)\**\*.dll" />
<Dlls Include="$(SolutionDir)Doorstop\Proxy\bin\x64\$(ProxyConfig)\**\*.pdb" />
</ItemGroup>
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\%(RecursiveDir)" />
<Move SourceFiles="$(OutputPath)IPA\proxy.dll" DestinationFiles="$(OutputPath)IPA\winhttp.dll" />
<Move Condition="Exists('$(OutputPath)IPA\proxy.pdb')" SourceFiles="$(OutputPath)IPA\proxy.pdb" DestinationFiles="$(OutputPath)IPA\winhttp.pdb" />
<ItemGroup>
<BadFiles Include="$(OutputPath)*.dll" />
<BadFiles Include="$(OutputPath)*.pdb" Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='Verbose_Release'" />
<BadFiles Include="$(OutputPath)IPA\*.pdb" Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='Verbose_Release'" />
</ItemGroup>
<Delete Files="@(BadFiles)" />
<RemoveDir Directories="$(OutputPath)Libraries\" />-->
<ItemGroup>
<BadFiles Include="$(OutputPath)**/*" Exclude="$(OutputPath)**/$(AssemblyName).*" />
</ItemGroup>
<Delete Files="@(BadFiles)" />
<ItemGroup>
<UnBadFiles Include="$(OutputPath)*" />
</ItemGroup>
<Move SourceFiles="@(UnBadFiles)" DestinationFolder="$(OutputPath)Plugins/" />
</Target>
</Project>

BIN
BSIPA-ModList/Icons/Thumbs.db View File


BIN
BSIPA-ModList/Icons/mod_bsipa.png View File

Before After
Width: 2048  |  Height: 2048  |  Size: 67 KiB

BIN
BSIPA-ModList/Icons/mod_ipa.png View File

Before After
Width: 2048  |  Height: 2048  |  Size: 63 KiB

BIN
BSIPA-ModList/Icons/self.png View File

Before After
Width: 2048  |  Height: 2048  |  Size: 925 KiB

BIN
BSIPA-ModList/Icons/self.xcf View File


+ 65
- 0
BSIPA-ModList/Plugin.cs View File

@ -0,0 +1,65 @@
using IPA;
using UnityEngine.SceneManagement;
using IPALogger = IPA.Logging.Logger;
using CustomUI.BeatSaber;
using BSIPA_ModList.UI;
using CustomUI.MenuButton;
using UnityEngine.Events;
namespace BSIPA_ModList
{
internal static class Logger
{
internal static IPALogger log { get; set; }
}
public class Plugin : IBeatSaberPlugin
{
public void Init(IPALogger logger)
{
Logger.log = logger;
Logger.log.Debug("Init");
}
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
{
}
public void OnApplicationQuit()
{
}
private ModListMenu menu;
private MenuButton button;
public void OnApplicationStart()
{
Logger.log.Debug("Creating Menu");
}
public void OnFixedUpdate()
{
}
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
{
if (scene.name == "MenuCore" && button == null)
{
menu = BeatSaberUI.CreateCustomMenu<ModListMenu>("Installed Mods");
button = MenuButtonUI.AddButton("All Mods", "Shows all installed mods, along with controls for updating them.", () =>
{
Logger.log.Debug("Presenting menu");
menu.Present();
});
}
}
public void OnSceneUnloaded(Scene scene)
{
}
public void OnUpdate()
{
}
}
}

+ 36
- 0
BSIPA-ModList/Properties/AssemblyInfo.cs View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BSIPA-ModList")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BSIPA-ModList")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("23ab2621-a05c-4377-8418-85e6012c0bbe")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 135
- 0
BSIPA-ModList/UI/ModListController.cs View File

@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using CustomUI.BeatSaber;
using CustomUI.Utilities;
using HMUI;
using IPA.Loader;
using IPA.Old;
using UnityEngine;
namespace BSIPA_ModList.UI
{
internal class ModListController : CustomListViewController
{
private interface IClickableCell
{
void OnSelect(ModListController cntrl);
}
private class BSIPAModCell : CustomCellInfo, IClickableCell
{
private static Sprite _defaultIcon;
public static Sprite DefaultIcon
{
get
{
if (_defaultIcon == null)
_defaultIcon = UIUtilities.LoadSpriteFromResources("BSIPA_ModList.Icons.mod_bsipa.png");
return _defaultIcon;
}
}
internal PluginLoader.PluginInfo Plugin;
public BSIPAModCell(PluginLoader.PluginInfo plugin)
: base($"{plugin.Metadata.Name} <size=60%>v{plugin.Metadata.Version}", plugin.Metadata.Manifest.Author, null)
{
Plugin = plugin;
if (plugin.Metadata.Manifest.IconPath != null)
icon = UIUtilities.LoadSpriteRaw(UIUtilities.GetResource(plugin.Metadata.Assembly, plugin.Metadata.Manifest.IconPath));
else
icon = DefaultIcon;
Logger.log.Debug($"BSIPAModCell {plugin.Metadata.Name} {plugin.Metadata.Version}");
}
public void OnSelect(ModListController cntrl)
{
Logger.log.Debug($"Selected BSIPAModCell {Plugin.Metadata.Name} {Plugin.Metadata.Version}");
}
}
private class BSIPAIgnoredModCell : CustomCellInfo, IClickableCell
{
internal PluginLoader.PluginMetadata Plugin;
public BSIPAIgnoredModCell(PluginLoader.PluginMetadata plugin)
: base($"<color=#878787>{plugin.Name} <size=60%>v{plugin.Version}", $"{plugin.Manifest.Author} <color=#BFBFBF>- <i>Not loaded</i>", BSIPAModCell.DefaultIcon)
{
Plugin = plugin;
Logger.log.Debug($"BSIPAIgnoredModCell {plugin.Name} {plugin.Version}");
}
public void OnSelect(ModListController cntrl)
{
Logger.log.Debug($"Selected BSIPAIgnoredModCell {Plugin.Name} {Plugin.Version}");
}
}
#pragma warning disable CS0618
private class IPAModCell : CustomCellInfo, IClickableCell
{
private static Sprite _defaultIcon;
public static Sprite DefaultIcon
{
get
{
if (_defaultIcon == null)
_defaultIcon = UIUtilities.LoadSpriteFromResources("BSIPA_ModList.Icons.mod_ipa.png");
return _defaultIcon;
}
}
internal IPlugin Plugin;
public IPAModCell(IPlugin plugin)
: base($"{plugin.Name} <size=60%>{plugin.Version}", "<color=#BFBFBF><i>Legacy</i>", DefaultIcon)
{
Plugin = plugin;
Logger.log.Debug($"IPAModCell {plugin.Name} {plugin.Version}");
}
public void OnSelect(ModListController cntrl)
{
Logger.log.Debug($"Selected IPAModCell {Plugin.Name} {Plugin.Version}");
}
}
#pragma warning restore
#pragma warning disable CS0618
public void Init(IEnumerable<PluginLoader.PluginInfo> bsipaPlugins, IEnumerable<PluginLoader.PluginMetadata> ignoredPlugins, IEnumerable<IPlugin> ipaPlugins)
{
Logger.log.Debug("List Controller Init");
DidActivateEvent = DidActivate;
DidSelectRowEvent = DidSelectRow;
includePageButtons = true;
reuseIdentifier = "BSIPAModListTableCell";
foreach (var plugin in bsipaPlugins)
Data.Add(new BSIPAModCell(plugin));
foreach (var plugin in ignoredPlugins)
Data.Add(new BSIPAIgnoredModCell(plugin));
foreach (var plugin in ipaPlugins)
Data.Add(new IPAModCell(plugin));
}
#pragma warning restore
private void DidSelectRow(TableView view, int index)
{
Debug.Assert(ReferenceEquals(view.dataSource, this));
(Data[index] as IClickableCell)?.OnSelect(this);
}
private new void DidActivate(bool first, ActivationType type)
{
}
}
}

+ 26
- 0
BSIPA-ModList/UI/ModListMenu.cs View File

@ -0,0 +1,26 @@
using CustomUI.BeatSaber;
using IPA.Loader;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BSIPA_ModList.UI
{
internal class ModListMenu : CustomMenu
{
private ModListController controller;
#pragma warning disable CS0618
public ModListMenu()
{
Logger.log.Debug("Menu constructor");
controller = BeatSaberUI.CreateViewController<ModListController>();
controller.Init(PluginManager.AllPlugins, PluginLoader.ignoredPlugins, PluginManager.Plugins);
SetMainViewController(controller, true);
}
#pragma warning restore
}
}

+ 15
- 0
BSIPA-ModList/manifest.json View File

@ -0,0 +1,15 @@
{
"$schema": "https://raw.githubusercontent.com/nike4613/ModSaber-MetadataFileSchema/master/Schema.json",
"author": "DaNike",
"description": "An in-game interface client for BSIPA.",
"gameVersion": "0.13.2",
"id": "BSIPA-ModList",
"name": "BSIPA Mod List",
"version": "1.0.0",
"icon": "BSIPA_ModList.Icons.self.png",
"dependsOn": {
"BSIPA": "^3.12.13",
"CustomUI": "^1.5.4"
},
"features": []
}

Loading…
Cancel
Save