File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using System ;
2+ using UnityEngine ;
3+
4+ namespace MiniMapLibrary
5+ {
6+ /// <summary>
7+ /// Represents some object that should provide sprites to be displayed on the minimap
8+ /// </summary>
9+ public interface ISpriteManager : IDisposable
10+ {
11+ /// <summary>
12+ /// Uses the provided <see cref="InteractableKind"/> to generate/provide and return a sprite that should represent that kind in the minimap
13+ /// </summary>
14+ /// <param name="type"></param>
15+ /// <returns></returns>
16+ Sprite GetSprite ( InteractableKind type ) ;
17+ }
18+ }
Original file line number Diff line number Diff line change 88#nullable enable
99namespace MiniMapLibrary
1010{
11- public sealed class SpriteManager : IDisposable
11+ public sealed class SpriteManager : IDisposable , ISpriteManager
1212 {
1313 public const string DefaultResourcePath = "Textures/MiscIcons/texMysteryIcon" ;
1414
@@ -23,7 +23,7 @@ static SpriteManager()
2323
2424 private static void InitializeResources ( )
2525 {
26- void Add ( InteractableKind type , string ResourcePath )
26+ static void Add ( InteractableKind type , string ResourcePath )
2727 {
2828 s_ResourceDictionary . Add ( type , ResourcePath ) ;
2929 }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ namespace MiniMapMod
1515 [ BepInPlugin ( "MiniMap" , "Mini Map Mod" , "2.0.4" ) ]
1616 public class MiniMapPlugin : BaseUnityPlugin
1717 {
18- private readonly SpriteManager SpriteManager = new ( ) ;
18+ private readonly ISpriteManager SpriteManager = new SpriteManager ( ) ;
1919
2020 private readonly List < ITrackedObject > TrackedObjects = new ( ) ;
2121
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public class Minimap
1818
1919 public bool Created { get ; private set ; } = false ;
2020
21- public void CreateMinimap ( SpriteManager spriteManager , GameObject Parent )
21+ public void CreateMinimap ( ISpriteManager spriteManager , GameObject Parent )
2222 {
2323 if ( Created )
2424 {
@@ -67,7 +67,7 @@ public void SetRotation(Quaternion rotation)
6767 ContainerTransform . localRotation = Quaternion . Euler ( 0 , 0 , euler . y ) ;
6868 }
6969
70- public RectTransform CreateIcon ( InteractableKind type , Vector3 minimapPosition , SpriteManager spriteManager )
70+ public RectTransform CreateIcon ( InteractableKind type , Vector3 minimapPosition , ISpriteManager spriteManager )
7171 {
7272 var icon = CreateIcon ( type , spriteManager . GetSprite ( type ) ) ;
7373
@@ -96,7 +96,7 @@ private void CreateIconContainer()
9696 Container = container ;
9797 }
9898
99- private void CreatePlayerIcon ( SpriteManager spriteManager )
99+ private void CreatePlayerIcon ( ISpriteManager spriteManager )
100100 {
101101 GameObject playerIcon = CreateIcon ( InteractableKind . Player , spriteManager . GetSprite ( InteractableKind . Player ) ) ;
102102
You can’t perform that action at this time.
0 commit comments