diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-26 12:06:27 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-26 12:06:27 -0400 |
commit | ba2a395da7026de4be32733fc27011e161ead255 (patch) | |
tree | d8dc59a2b74093202e6886b44f131faf35dcf405 /AnodyneArchipelago/Patches | |
parent | 585fc3873406049a37f9417afc061c9cde266b76 (diff) | |
download | anodyne-archipelago-ba2a395da7026de4be32733fc27011e161ead255.tar.gz anodyne-archipelago-ba2a395da7026de4be32733fc27011e161ead255.tar.bz2 anodyne-archipelago-ba2a395da7026de4be32733fc27011e161ead255.zip |
Added AP icon for treasure chests
Diffstat (limited to 'AnodyneArchipelago/Patches')
-rw-r--r-- | AnodyneArchipelago/Patches/StatePatches.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/AnodyneArchipelago/Patches/StatePatches.cs b/AnodyneArchipelago/Patches/StatePatches.cs index c1e03fe..6da5eb5 100644 --- a/AnodyneArchipelago/Patches/StatePatches.cs +++ b/AnodyneArchipelago/Patches/StatePatches.cs | |||
@@ -10,9 +10,24 @@ using static AnodyneSharp.AnodyneGame; | |||
10 | using AnodyneSharp.Drawing; | 10 | using AnodyneSharp.Drawing; |
11 | using System.IO; | 11 | using System.IO; |
12 | using System; | 12 | using System; |
13 | using AnodyneSharp.Resources; | ||
14 | using BepInEx; | ||
15 | using Microsoft.Xna.Framework.Graphics; | ||
16 | using Microsoft.Xna.Framework; | ||
17 | using System.Collections.Generic; | ||
13 | 18 | ||
14 | namespace AnodyneArchipelago.Patches | 19 | namespace AnodyneArchipelago.Patches |
15 | { | 20 | { |
21 | [HarmonyPatch(typeof(AnodyneGame), "LoadContent")] | ||
22 | class AnodyneLoadContentPatch | ||
23 | { | ||
24 | static void Prefix(AnodyneGame __instance) | ||
25 | { | ||
26 | FieldInfo gdmField = typeof(AnodyneGame).GetField("graphics", BindingFlags.NonPublic | BindingFlags.Instance); | ||
27 | Plugin.GraphicsDevice = ((GraphicsDeviceManager)gdmField.GetValue(__instance)).GraphicsDevice; | ||
28 | } | ||
29 | } | ||
30 | |||
16 | [HarmonyPatch(typeof(AnodyneGame), "Update")] | 31 | [HarmonyPatch(typeof(AnodyneGame), "Update")] |
17 | class GameUpdatePatch | 32 | class GameUpdatePatch |
18 | { | 33 | { |
@@ -127,4 +142,18 @@ namespace AnodyneArchipelago.Patches | |||
127 | Plugin.ArchipelagoManager.ActivateGoal(); | 142 | Plugin.ArchipelagoManager.ActivateGoal(); |
128 | } | 143 | } |
129 | } | 144 | } |
145 | |||
146 | [HarmonyPatch(typeof(ResourceManager), nameof(ResourceManager.LoadResources))] | ||
147 | static class LoadResourcesPatch | ||
148 | { | ||
149 | static void Postfix() | ||
150 | { | ||
151 | FileStream filestream = File.OpenRead($"{Paths.GameRootPath}\\Resources\\archipelago.png"); | ||
152 | Texture2D apSprite = Texture2D.FromStream(Plugin.GraphicsDevice, filestream); | ||
153 | |||
154 | FieldInfo texturesField = typeof(ResourceManager).GetField("_textures", BindingFlags.NonPublic | BindingFlags.Static); | ||
155 | Dictionary<string, Texture2D> textures = (Dictionary<string, Texture2D>)texturesField.GetValue(null); | ||
156 | textures["archipelago"] = apSprite; | ||
157 | } | ||
158 | } | ||
130 | } | 159 | } |