Skip to content

Commit

Permalink
Merge pull request #554 from Caeden117/dev
Browse files Browse the repository at this point in the history
Stable (CM 0.11.793)
  • Loading branch information
XAce1337manX authored Dec 15, 2024
2 parents 5fd3ac6 + fd7d148 commit ec328b3
Show file tree
Hide file tree
Showing 196 changed files with 5,646 additions and 6,129 deletions.
68 changes: 52 additions & 16 deletions Assets/Tests/ArcTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ public void CreateArc()
var root = notesContainer.transform.root;
var notePlacement = root.GetComponentInChildren<NotePlacement>();

BaseNote baseNoteA = new V3ColorNote(2f, (int)GridX.Left, (int)GridY.Base, (int)NoteType.Red,
(int)NoteCutDirection.Down);
BaseNote baseNoteB = new V3ColorNote(3f, (int)GridX.Left, (int)GridY.Upper, (int)NoteType.Red,
(int)NoteCutDirection.Up);
BaseNote baseNoteA = new BaseNote
{
JsonTime = 2f, PosX = (int)GridX.Left, PosY = (int)GridY.Base, Type = (int)NoteType.Red,
CutDirection = (int)NoteCutDirection.Down
};
BaseNote baseNoteB = new BaseNote
{
JsonTime = 3f, PosX = (int)GridX.Left, PosY = (int)GridY.Upper, Type = (int)NoteType.Red,
CutDirection = (int)NoteCutDirection.Up
};
PlaceUtils.PlaceNote(notePlacement, baseNoteA);
PlaceUtils.PlaceNote(notePlacement, baseNoteB);

Expand Down Expand Up @@ -87,7 +93,7 @@ public void CreateArcWithCoordinates()
var headCustomData = new JSONObject { ["coordinates"] = headCoordinates };
var tailCustomData = new JSONObject { ["coordinates"] = tailCoordinates };

var arcCustomData = new JSONObject
var expectedArcCustomData = new JSONObject
{
["coordinates"] = headCoordinates,
["tailCoordinates"] = tailCoordinates
Expand All @@ -99,11 +105,17 @@ public void CreateArcWithCoordinates()
var root = notesContainer.transform.root;
var notePlacement = root.GetComponentInChildren<NotePlacement>();

BaseNote baseNoteA = new V3ColorNote(2f, (int)GridX.Left, (int)GridY.Base, (int)NoteType.Red,
(int)NoteCutDirection.Down, headCustomData);
BaseNote baseNoteA = new BaseNote
{
JsonTime = 2f, PosX = (int)GridX.Left, PosY = (int)GridY.Base, Type = (int)NoteType.Red,
CutDirection = (int)NoteCutDirection.Down, CustomData = headCustomData
};

BaseNote baseNoteB = new V3ColorNote(3f, (int)GridX.Left, (int)GridY.Upper, (int)NoteType.Red,
(int)NoteCutDirection.Up, tailCustomData);
BaseNote baseNoteB = new BaseNote
{
JsonTime = 3f, PosX = (int)GridX.Left, PosY = (int)GridY.Upper, Type = (int)NoteType.Red,
CutDirection = (int)NoteCutDirection.Up, CustomData = tailCustomData
};

PlaceUtils.PlaceNote(notePlacement, baseNoteA);
PlaceUtils.PlaceNote(notePlacement, baseNoteB);
Expand Down Expand Up @@ -132,7 +144,7 @@ public void CreateArcWithCoordinates()

CheckUtils.CheckArc("Check generated arc", arcsContainer, 0, 2f, (int)GridX.Left, (int)GridY.Base,
(int)NoteColor.Red, (int)NoteCutDirection.Down, 0, 1, 3f, (int)GridX.Left, (int)GridY.Upper,
(int)NoteCutDirection.Up, 1, 0, arcCustomData);
(int)NoteCutDirection.Up, 1, 0, expectedArcCustomData);
}
}

Expand All @@ -147,9 +159,21 @@ public void InvertArc()
var arcPlacement = root.GetComponentInChildren<ArcPlacement>();
var inputController = root.GetComponentInChildren<BeatmapArcInputController>();

BaseArc baseArc = new V3Arc(2f, (int)GridX.Left, (int)GridY.Base, (int)NoteColor.Red,
(int)NoteCutDirection.Left, 0, 1f, 3f, (int)GridX.Left, (int)GridY.Base, (int)NoteCutDirection.Left,
1f, 0);
BaseArc baseArc = new BaseArc
{
JsonTime = 2f,
PosX = (int)GridX.Left,
PosY = (int)GridY.Base,
Color = (int)NoteColor.Red,
CutDirection = (int)NoteCutDirection.Left,
HeadControlPointLengthMultiplier = 1f,
TailJsonTime = 3f,
TailPosX = (int)GridX.Left,
TailPosY = (int)GridY.Base,
TailCutDirection = (int)NoteCutDirection.Left,
TailControlPointLengthMultiplier = 1f,
MidAnchorMode = 0
};
PlaceUtils.PlaceArc(arcPlacement, baseArc);

if (arcsContainer.LoadedContainers[baseArc] is ArcContainer containerA)
Expand Down Expand Up @@ -179,9 +203,21 @@ public void UpdateArcMultiplier()
var arcPlacement = root.GetComponentInChildren<ArcPlacement>();
var inputController = root.GetComponentInChildren<BeatmapArcInputController>();

BaseArc baseArc = new V3Arc(2f, (int)GridX.Left, (int)GridY.Base, (int)NoteColor.Red,
(int)NoteCutDirection.Left, 0, 1f, 3f, (int)GridX.Left, (int)GridY.Base, (int)NoteCutDirection.Left,
1f, 0);
BaseArc baseArc = new BaseArc
{
JsonTime = 2f,
PosX = (int)GridX.Left,
PosY = (int)GridY.Base,
Color = (int)NoteColor.Red,
CutDirection = (int)NoteCutDirection.Left,
HeadControlPointLengthMultiplier = 1f,
TailJsonTime = 3f,
TailPosX = (int)GridX.Left,
TailPosY = (int)GridY.Base,
TailCutDirection = (int)NoteCutDirection.Left,
TailControlPointLengthMultiplier = 1f,
MidAnchorMode = 0
};
PlaceUtils.PlaceArc(arcPlacement, baseArc);

if (arcsContainer.LoadedContainers[baseArc] is ArcContainer containerA)
Expand Down
24 changes: 12 additions & 12 deletions Assets/Tests/BPMTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public void SongBpmTimes()
var bpmCollection = BeatmapObjectContainerCollection.GetCollectionForType<BPMChangeGridContainer>(ObjectType.BpmChange);

var songBpm = BeatSaberSongContainer.Instance.Song.BeatsPerMinute;
BaseBpmEvent baseBpmEvent = new V3BpmEvent(0, 111);
var baseBpmEvent = new BaseBpmEvent(0, 111);
bpmCollection.SpawnObject(baseBpmEvent);

baseBpmEvent = new V3BpmEvent(1, 222);
baseBpmEvent = new BaseBpmEvent(1, 222);
bpmCollection.SpawnObject(baseBpmEvent);

baseBpmEvent = new V3BpmEvent(2, 333);
baseBpmEvent = new BaseBpmEvent(2, 333);
bpmCollection.SpawnObject(baseBpmEvent);

baseBpmEvent = new V3BpmEvent(3, 444);
baseBpmEvent = new BaseBpmEvent(3, 444);
bpmCollection.SpawnObject(baseBpmEvent);

Assert.AreEqual(4, bpmCollection.MapObjects.Count);
Expand All @@ -69,7 +69,7 @@ public void SongBpmTimes()
CheckBPM("3rd BPM values", bpmCollection, 2, 2, 333, songBpm / 111 + songBpm / 222);
CheckBPM("4th BPM values", bpmCollection, 3, 3, 444, songBpm / 111 + songBpm / 222 + songBpm / 333);

baseBpmEvent = new V3BpmEvent(0, 1);
baseBpmEvent = new BaseBpmEvent(0, 1);
bpmCollection.SpawnObject(baseBpmEvent);

Assert.AreEqual(4, bpmCollection.MapObjects.Count);
Expand All @@ -92,10 +92,10 @@ public void ModifyEvent()
var actionContainer = Object.FindObjectOfType<BeatmapActionContainer>();
var bpmCollection = BeatmapObjectContainerCollection.GetCollectionForType<BPMChangeGridContainer>(ObjectType.BpmChange);

BaseBpmEvent baseBpmEvent = new V3BpmEvent(20, 20);
BaseBpmEvent baseBpmEvent = new BaseBpmEvent(20, 20);
bpmCollection.SpawnObject(baseBpmEvent);

baseBpmEvent = new V3BpmEvent(10, 10);
baseBpmEvent = new BaseBpmEvent(10, 10);
bpmCollection.SpawnObject(baseBpmEvent);

if (bpmCollection.LoadedContainers[baseBpmEvent] is BpmEventContainer container)
Expand Down Expand Up @@ -124,10 +124,10 @@ public void GoToBeat()
var bpmCollection = BeatmapObjectContainerCollection.GetCollectionForType<BPMChangeGridContainer>(ObjectType.BpmChange);

var songBpm = BeatSaberSongContainer.Instance.Song.BeatsPerMinute;
BaseBpmEvent baseBpmEvent = new V3BpmEvent(0, 111);
BaseBpmEvent baseBpmEvent = new BaseBpmEvent(0, 111);
bpmCollection.SpawnObject(baseBpmEvent);

baseBpmEvent = new V3BpmEvent(1, 222);
baseBpmEvent = new BaseBpmEvent(1, 222);
bpmCollection.SpawnObject(baseBpmEvent);

Assert.AreEqual(2, bpmCollection.MapObjects.Count);
Expand Down Expand Up @@ -162,13 +162,13 @@ public void UndoActionCollection()
var bpmCollection = BeatmapObjectContainerCollection.GetCollectionForType<BPMChangeGridContainer>(ObjectType.BpmChange);

var songBpm = BeatSaberSongContainer.Instance.Song.BeatsPerMinute;
var baseBpmEvent0 = new V3BpmEvent(0, 111);
var baseBpmEvent0 = new BaseBpmEvent(0, 111);
bpmCollection.SpawnObject(baseBpmEvent0, out var conflicting0);

var baseBpmEvent1 = new V3BpmEvent(1, 222);
var baseBpmEvent1 = new BaseBpmEvent(1, 222);
bpmCollection.SpawnObject(baseBpmEvent1, out var conflicting1);

var baseBpmEvent2 = new V3BpmEvent(2, 333);
var baseBpmEvent2 = new BaseBpmEvent(2, 333);
bpmCollection.SpawnObject(baseBpmEvent2, out var conflicting2);

BeatmapActionContainer.AddAction(new ActionCollectionAction(new List<BeatmapAction>{
Expand Down
10 changes: 5 additions & 5 deletions Assets/Tests/BeatmapActionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void ModifiedAction()
var notesContainer = BeatmapObjectContainerCollection.GetCollectionForType<NoteGridContainer>(ObjectType.Note);
var root = notesContainer.transform.root;

BaseNote baseNoteA = new V3ColorNote
BaseNote baseNoteA = new BaseNote
{
JsonTime = 2,
Type = (int)NoteType.Red
Expand Down Expand Up @@ -70,12 +70,12 @@ public void CompositeTest()
var selectionController = root.GetComponentInChildren<SelectionController>();
var notePlacement = root.GetComponentInChildren<NotePlacement>();

BaseNote baseNoteA = new V3ColorNote
BaseNote baseNoteA = new BaseNote
{
JsonTime = 2,
Type = (int)NoteType.Red
};
BaseNote baseNoteB = new V3ColorNote
BaseNote baseNoteB = new BaseNote
{
JsonTime = 2,
Type = (int)NoteType.Blue,
Expand Down Expand Up @@ -185,12 +185,12 @@ public void ModifiedWithConflictingAction()
var root = notesContainer.transform.root;
var notePlacement = root.GetComponentInChildren<NotePlacement>();

PlaceUtils.PlaceNote(notePlacement, new V3ColorNote
PlaceUtils.PlaceNote(notePlacement, new BaseNote
{
JsonTime = 2,
Type = (int)NoteType.Red
});
PlaceUtils.PlaceNote(notePlacement, new V3ColorNote
PlaceUtils.PlaceNote(notePlacement, new BaseNote
{
JsonTime = 2,
Type = (int)NoteType.Blue
Expand Down
Loading

0 comments on commit ec328b3

Please sign in to comment.