Skip to content

Commit e0b6e42

Browse files
authored
Fix animations for tromboners in custom backgrounds (#7)
* Use GameLibs and add TrombLoader dependency * gitignore macOS metadata * fix background tromboners not animating * switch to using bgcontroller.fullbgobject instead of GameObject.Find
1 parent 83122c5 commit e0b6e42

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,7 @@ FodyWeavers.xsd
399399

400400
riderModule.iml
401401
/_ReSharper.Caches/
402-
.idea/
402+
.idea/
403+
404+
# macOS metadata files
405+
.DS_Store

AutoToot/AutoToot.csproj

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netstandard2.0</TargetFramework>
3+
<TargetFramework>net472</TargetFramework>
44
<AssemblyName>AutoToot</AssemblyName>
55
<Description>Auto play for Trombone Champ.</Description>
66
<Version>1.2.4</Version>
@@ -23,24 +23,8 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<Reference Include="0Harmony">
27-
<HintPath>$(TromboneChampDir)\BepInEx\core\0Harmony.dll</HintPath>
28-
</Reference>
29-
<Reference Include="Assembly-CSharp">
30-
<HintPath>$(TromboneChampDir)\TromboneChamp_Data\Managed\Assembly-CSharp-nstrip.dll</HintPath>
31-
</Reference>
32-
<Reference Include="UnityEngine">
33-
<HintPath>$(TromboneChampDir)\TromboneChamp_Data\Managed\UnityEngine.dll</HintPath>
34-
</Reference>
35-
<Reference Include="UnityEngine.CoreModule">
36-
<HintPath>$(TromboneChampDir)\TromboneChamp_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
37-
</Reference>
38-
<Reference Include="UnityEngine.InputLegacyModule">
39-
<HintPath>$(TromboneChampDir)\TromboneChamp_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
40-
</Reference>
41-
<Reference Include="UnityEngine.UI">
42-
<HintPath>$(TromboneChampDir)\TromboneChamp_Data\Managed\UnityEngine.UI.dll</HintPath>
43-
</Reference>
26+
<PackageReference Include="TromboneChamp.GameLibs" Version="1.14.0" />
27+
<PackageReference Include="TromboneChamp.TrombLoader" Version="2.1.0" />
4428
</ItemGroup>
4529

4630
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

AutoToot/Bot.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3232
using AutoToot.Helpers;
3333
using BepInEx.Logging;
3434
using UnityEngine;
35+
using TrombLoader.Data;
3536

3637
#pragma warning disable CS0618
3738
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
@@ -47,6 +48,11 @@ public Bot(GameController gameController)
4748
{
4849
_gameController = gameController;
4950
_humanPuppetController = gameController.puppet_humanc;
51+
_backgroundPuppetController = null;
52+
_bg = gameController.bgcontroller.fullbgobject;
53+
if (_bg) {
54+
_backgroundPuppetController = _bg.GetComponent<BackgroundPuppetController>();
55+
}
5056

5157
_noteHolderPosition = GameObject.Find(NotesHolderPath)?.GetComponent<RectTransform>();
5258
_pointer = GameObject.Find(CursorPath)?.GetComponent<RectTransform>();
@@ -95,6 +101,9 @@ public void Update()
95101
_pointer.anchoredPosition = pointerPosition;
96102

97103
_humanPuppetController.doPuppetControl(-pointerY / GameCanvasSize * 2);
104+
if (_backgroundPuppetController){
105+
_backgroundPuppetController.DoPuppetControl(-pointerY / GameCanvasSize * 2, _gameController.vibratoamt);
106+
}
98107
}
99108
}
100109

@@ -139,6 +148,8 @@ private bool ShouldToot(float currentTime, float noteStartTime, float noteEndTim
139148

140149
private readonly GameController _gameController;
141150
private readonly HumanPuppetController _humanPuppetController;
151+
private readonly GameObject _bg;
152+
private readonly BackgroundPuppetController _backgroundPuppetController;
142153
private readonly RectTransform _noteHolderPosition;
143154
private readonly RectTransform _pointer;
144155

0 commit comments

Comments
 (0)