1
1
# BaboonAPI
2
2
3
+ [ ![ download counter] ( https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Ftrombone-champ.thunderstore.io%2Fapi%2Fexperimental%2Fpackage%2FTromboneChamps%2FBaboonAPI%2F&query=%24.total_downloads&label=downloads )] ( https://trombone-champ.thunderstore.io/package/TromboneChamps/BaboonAPI/ )
4
+
3
5
Trombone Champ modding API, aiming to provide nicer hooks to
4
6
promote compatibility & improve the base game code
5
7
6
8
## Installing
7
9
10
+ You can find the mod on [ Thunderstore] ( https://trombone-champ.thunderstore.io/package/TromboneChamps/BaboonAPI/ ) .
11
+
12
+ ### Manual installation
13
+
8
14
1 . Install BepInEx over the base game
9
15
2 . Install FSharp.Core - ` FSharp.Core.dll ` gets put in ` bin/Release/net472 `
10
16
by the build process, I usually put it in ` BepInEx/core `
@@ -13,113 +19,4 @@ promote compatibility & improve the base game code
13
19
14
20
## Developer Usage
15
21
16
- A quick-and-dirty example plugin for the track registration API:
17
-
18
- ``` csharp
19
- using System .Collections .Generic ;
20
- using BaboonAPI .Hooks .Tracks ;
21
- using BepInEx ;
22
- using UnityEngine ;
23
-
24
- namespace Chimpanzee
25
- {
26
- [BepInPlugin (" ch.offbeatwit.chimpanzee" , " Chimpanzee" , " 1.0.0.0" )]
27
- [BepInDependency (" ch.offbeatwit.baboonapi.plugin" )]
28
- public class ChimpanzeePlugin : BaseUnityPlugin
29
- {
30
- private void Awake ()
31
- {
32
- // Register a listener for the track registration event
33
- TrackRegistrationEvent .EVENT .Register (new ChimpanzeeTrackCallback ());
34
- }
35
- }
36
-
37
- public class ChimpanzeeTrackCallback : TrackRegistrationEvent .Listener
38
- {
39
- public IEnumerable <TromboneTrack > OnRegisterTracks ()
40
- {
41
- // Load and return your tracks here.
42
- yield return new ChimpTrack (" chimps" , " Chimps Forever" , " Chimps" , " 2022" , " Me" , " A cool track!" ,
43
- " Weirdcore" , 2 , 120 , 140 );
44
- }
45
- }
46
-
47
- public class ChimpTrack : TromboneTrack
48
- {
49
- public ChimpTrack (string trackref , string tracknameLong , string tracknameShort , string year , string artist ,
50
- string desc , string genre , int difficulty , int tempo , int length )
51
- {
52
- this .trackref = trackref ;
53
- trackname_long = tracknameLong ;
54
- trackname_short = tracknameShort ;
55
- this .year = year ;
56
- this .artist = artist ;
57
- this .desc = desc ;
58
- this .genre = genre ;
59
- this .difficulty = difficulty ;
60
- this .tempo = tempo ;
61
- this .length = length ;
62
- }
63
-
64
- public LoadedTromboneTrack LoadTrack ()
65
- {
66
- var bundle = AssetBundle .LoadFromFile (" MyCoolBundle" );
67
- return new LoadedChimpTrack (trackref , bundle );
68
- }
69
-
70
- public SavedLevel LoadChart ()
71
- {
72
- // Load the actual chart data
73
- return new SavedLevel ();
74
- }
75
-
76
- public bool IsVisible ()
77
- {
78
- return true ;
79
- }
80
-
81
- public string trackref { get ; }
82
- public string trackname_long { get ; }
83
- public string trackname_short { get ; }
84
- public string year { get ; }
85
- public string artist { get ; }
86
- public string desc { get ; }
87
- public string genre { get ; }
88
- public int difficulty { get ; }
89
- public int tempo { get ; }
90
- public int length { get ; }
91
- }
92
-
93
- public class LoadedChimpTrack : LoadedTromboneTrack
94
- {
95
- private readonly AssetBundle _assetBundle ;
96
-
97
- public LoadedChimpTrack (string trackref , AssetBundle assetBundle )
98
- {
99
- this .trackref = trackref ;
100
- _assetBundle = assetBundle ;
101
- }
102
-
103
- public void Dispose ()
104
- {
105
- // Clean up any bundles you loaded, etc.
106
- _assetBundle .Unload (true );
107
- }
108
-
109
- public AudioSource LoadAudio ()
110
- {
111
- // Load an audio source from somewhere!
112
- var obj = _assetBundle .LoadAsset <GameObject >($" music_{trackref }" );
113
- return obj .GetComponent <AudioSource >();
114
- }
115
-
116
- public GameObject LoadBackground (BackgroundContext ctx )
117
- {
118
- // Load or create a background GameObject
119
- return _assetBundle .LoadAsset <GameObject >($" BGCam_{trackref }" );
120
- }
121
-
122
- public string trackref { get ; }
123
- }
124
- }
125
- ```
22
+ We have documentation over at https://baboonapi.trombone.wiki
0 commit comments