Skip to content

Commit

Permalink
Mods Folder Icon
Browse files Browse the repository at this point in the history
  • Loading branch information
gompocp committed May 4, 2021
1 parent f5f054a commit de79c3c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ActionMenuApi/AMAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public static void AddModFolder(string text, Action openFunc, Texture2D icon = n
AMAPI.AddSubMenuToSubMenu(text, openFunc, icon, null);
});
}

private static void AddPedalToList(ActionMenuPageType pageType, PedalStruct customPedal, Insertion insertion)
{
switch (pageType)
Expand Down
6 changes: 6 additions & 0 deletions ActionMenuApi/ActionMenuApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
<Reference Include="UnityEngine, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -96,6 +99,9 @@
<Compile Include="Types\Insertion.cs" />
<Compile Include="Types\PedalType.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="actionmenuapi.icons" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>COPY "$(MSBuildProjectDirectory)\bin\ActionMenuApi.dll" "E:\Windows\Programs\Software\SteamLibrary\steamapps\common\VRChat\Mods"</PostBuildEvent>
Expand Down
17 changes: 16 additions & 1 deletion ActionMenuApi/ModMenu/ModsFolder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using ActionMenuApi.Pedals;
using MelonLoader;
using UnhollowerRuntimeLib;
using UnityEngine;

namespace ActionMenuApi.ModMenu
Expand Down Expand Up @@ -40,7 +43,19 @@ public void AddMainPageButton()

public static void CreateInstance()
{
if(instance == null) new ModsFolder("Mods", Texture2D.whiteTexture); //TEMP Texture //TODO: Swap to a different texture
if (instance != null) return;
AssetBundle iconsAssetBundle;
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ActionMenuApi.actionmenuapi.icons"))
using (var tempStream = new MemoryStream((int)stream.Length))
{
stream.CopyTo(tempStream);

iconsAssetBundle = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0);
iconsAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset;
}
Texture2D modsSectionIcon = iconsAssetBundle.LoadAsset_Internal("Assets/ActionMenuApi/vrcmg.png", Il2CppType.Of<Texture2D>()).Cast<Texture2D>();
modsSectionIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset;
new ModsFolder("Mods", modsSectionIcon); //TEMP Texture //TODO: Swap to a different texture
}
}
}
Binary file added ActionMenuApi/actionmenuapi.icons
Binary file not shown.

0 comments on commit de79c3c

Please sign in to comment.