Skip to content

Commit

Permalink
Merge pull request #71 from irlbunny/update-1.37.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Auros authored Sep 25, 2024
2 parents 00c07f0 + 5acdbb2 commit cc71aed
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 21 deletions.
4 changes: 2 additions & 2 deletions SiraUtil.Suite/Installers/OtherCustomInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public OtherCustomInstaller(GameplayCoreSceneSetupData gameplayCoreSceneSetupDat
{
_gameplayCoreSceneSetupData = gameplayCoreSceneSetupData;
Assert.IsNotNull(_gameplayCoreSceneSetupData);
Assert.IsNotNull(_gameplayCoreSceneSetupData.difficultyBeatmap);
Plugin.Log.Info(_gameplayCoreSceneSetupData.difficultyBeatmap.SerializedName());
Assert.IsNotNull(_gameplayCoreSceneSetupData.beatmapKey);
Plugin.Log.Info(_gameplayCoreSceneSetupData.beatmapKey.SerializedName());
}

public override void InstallBindings()
Expand Down
19 changes: 12 additions & 7 deletions SiraUtil.Suite/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using IPA;
using SiraUtil.Extras;
using SiraUtil.Objects.Beatmap;
using SiraUtil.Sabers;
using SiraUtil.Suite.Installers;
using SiraUtil.Suite.Tests.Installers;
using SiraUtil.Suite.Tests.Sabers;
using SiraUtil.Suite.Tests.Web;
using SiraUtil.Zenject;
using UnityEngine;
using IPALogger = IPA.Logging.Logger;
Expand Down Expand Up @@ -32,19 +37,19 @@ public Plugin(IPALogger logger, Zenjector zenjector)
zenjector.UseLogger(logger);
zenjector.UseHttpService();

//zenjector.UseSiraSync(Web.SiraSync.SiraSyncServiceType.GitHub, "Auros", "SiraUtil");
//zenjector.Install(Location.Menu, Container => Container.BindInterfacesTo<WebTest>().AsSingle());
zenjector.UseSiraSync(Web.SiraSync.SiraSyncServiceType.GitHub, "Auros", "SiraUtil");
zenjector.Install(Location.Menu, Container => Container.BindInterfacesTo<WebTest>().AsSingle());

zenjector.Install(Location.Player | Location.Tutorial, Container =>
{
//Container.BindInterfacesTo<SpawnFullSaberTest>().AsSingle();
//Container.BindInstance(SaberModelRegistration.Create<TestSaberModelController>(100)).AsSingle();
//
//Container.RegisterRedecorator(new BasicNoteRegistration(Create2, 20));
Container.BindInterfacesTo<SpawnFullSaberTest>().AsSingle();
Container.BindInstance(SaberModelRegistration.Create<TestSaberModelController>(100)).AsSingle();
Container.RegisterRedecorator(new BasicNoteRegistration(Create2, 20));
});
zenjector.Install(Location.ConnectedPlayer, Container =>
{
//Container.RegisterRedecorator(new ConnectedPlayerNoteRegistration(Create));
Container.RegisterRedecorator(new ConnectedPlayerNoteRegistration(Create));
});
}

Expand Down
21 changes: 20 additions & 1 deletion SiraUtil.Suite/SiraUtil.Suite.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -37,6 +37,18 @@
</PropertyGroup>

<ItemGroup>
<Reference Include="BeatSaber.ViewSystem">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BGLib.AppFlow">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DataModels">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\DataModels.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GameplayCore">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\GameplayCore.dll</HintPath>
<Private>False</Private>
Expand All @@ -49,10 +61,17 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMRendering.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="netstandard">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\netstandard.dll</HintPath>
</Reference>
<Reference Include="Rendering">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Rendering.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SaberTrail">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\SaberTrail.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SemVer">
<HintPath>$(BeatSaberDir)\Libs\SemVer.dll</HintPath>
<Private>False</Private>
Expand Down
3 changes: 2 additions & 1 deletion SiraUtil.Suite/Tests/Sabers/TestSaberModelController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ internal class TestSaberModelController : SaberModelController, IColorable, IPre
[Inject]
private readonly ColorManager _colorManager = null!;

public void PreInit(Transform parent, Saber saber)
public bool PreInit(Transform parent, Saber saber)
{
Color = _colorManager.ColorForSaberType(saber.saberType);
GameObject g = GameObject.CreatePrimitive(PrimitiveType.Sphere);
g.transform.localScale *= 0.1f;
g.transform.SetParent(transform);
g.transform.localPosition = new Vector3(0f, 0f, 1f);
return true;
}
}
}
2 changes: 1 addition & 1 deletion SiraUtil/Sabers/Effects/SiraSaberClashChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void SiraSaberFactory_SaberCreated(SiraSaber siraSaber)

public bool AreSabersClashing(ref bool sabersAreClashing, ref Vector3 localClashingPoint, ref int prevGetFrameNum, out Vector3 clashingPoint)
{
if (_leftSaber.movementData.lastAddedData.time < 0.1f)
if (_leftSaber.movementDataForLogic.lastAddedData.time < 0.1f)
{
clashingPoint = localClashingPoint;
return false;
Expand Down
14 changes: 11 additions & 3 deletions SiraUtil/Sabers/SiraSaber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class SiraSaber : MonoBehaviour
private SaberTypeObject _saberTypeObject = null!;
private SaberModelProvider _saberModelProvider = null!;
private SaberModelController _saberModelController = null!;
private SaberModelContainer.InitData _saberModelContainerInitData = new SaberModelContainer.InitData();
private readonly Queue<Action> _colorProcessNextFrame = new();
private bool _constructedThisFrame = false;

Expand All @@ -35,11 +36,18 @@ public class SiraSaber : MonoBehaviour
private static readonly FieldAccessor<Saber, Transform>.Accessor SaberBladeBottomTransform = FieldAccessor<Saber, Transform>.GetAccessor("_saberBladeBottomTransform");

[Inject]
internal void Construct(NoteCutter noteCutter, ColorManager colorManager, SaberModelProvider saberModelProvider)
internal void Construct(
NoteCutter noteCutter,
ColorManager colorManager,
SaberModelProvider saberModelProvider,
[InjectOptional] SaberModelContainer.InitData saberModelContainerInitData)
{
_noteCutter = noteCutter;
_colorManager = colorManager;
_saberModelProvider = saberModelProvider;

if (saberModelContainerInitData != null)
_saberModelContainerInitData = saberModelContainerInitData;
}

internal void Setup<T>(SaberType saberType) where T : Saber
Expand All @@ -63,7 +71,7 @@ internal void Setup<T>(SaberType saberType) where T : Saber

_saberTypeObject.SetField("_saberType", saberType);
_saberModelController = _saberModelProvider.NewModel(saberType);
_saberModelController.Init(transform, Saber);
_saberModelController.Init(transform, Saber, _saberModelContainerInitData.trailTintColor);
_constructedThisFrame = true;
}

Expand All @@ -76,7 +84,7 @@ internal void Update()
Transform bottomTransform = SaberBladeBottomTransform(ref saber);
Vector3 topPosition = SaberBladeTopPosition(ref saber) = topTransform.position;
Vector3 bottomPosition = SaberBladeBottomPosition(ref saber) = bottomTransform.position;
Saber.movementData.AddNewData(topPosition, bottomPosition, TimeHelper.time);
Saber.movementDataForLogic.AddNewData(topPosition, bottomPosition, TimeHelper.time);
_noteCutter.Cut(Saber);
}

Expand Down
20 changes: 16 additions & 4 deletions SiraUtil/SiraUtil.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Init.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BeatSaber.ViewSystem">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BGLib.AppFlow">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll</HintPath>
<Publicize>True</Publicize>
Expand All @@ -83,6 +87,10 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\DataModels.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GameInit">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\GameInit.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GameplayCore">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\GameplayCore.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -114,6 +122,10 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Rendering.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SaberTrail">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\SaberTrail.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -142,10 +154,10 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.SpatialTracking">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.SpatialTracking.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.SpatialTracking">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.SpatialTracking.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
Expand Down
4 changes: 2 additions & 2 deletions SiraUtil/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"id": "SiraUtil",
"name": "SiraUtil",
"author": "Auros",
"version": "3.1.11",
"version": "3.1.12",
"icon": "SiraUtil.Resources.logo.png",
"description": "A powerful utility mod which provides more tools to Beat Saber modders.",
"gameVersion": "1.37.1",
"gameVersion": "1.37.4",
"dependsOn": {
"BSIPA": "^4.3.0"
},
Expand Down

0 comments on commit cc71aed

Please sign in to comment.