Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f79f231
commit 618284c
Showing
5 changed files
with
162 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using SongCore.Utilities; | ||
using UnityEngine; | ||
namespace SongCore.OverrideClasses | ||
{ | ||
public class SongCoreBeatmapLevelPackCollectionSO : BeatmapLevelPackCollectionSO | ||
{ | ||
internal List<CustomBeatmapLevelPack> _customBeatmapLevelPacks = new List<CustomBeatmapLevelPack>(); | ||
|
||
public static SongCoreBeatmapLevelPackCollectionSO ReplaceOriginal(BeatmapLevelPackCollectionSO original) | ||
{ | ||
var newCollection = CreateInstance<SongCoreBeatmapLevelPackCollectionSO>(); | ||
// newCollection._allBeatmapLevelPacks.AddRange((BeatmapLevelPackSO[])original.GetField("_beatmapLevelPacks")); | ||
//Figure out how to properly add the preview song packs | ||
List<IBeatmapLevelPack> levelPacks = new List<IBeatmapLevelPack>(); | ||
levelPacks.AddRange((BeatmapLevelPackSO[])original.GetField("_beatmapLevelPacks")); | ||
levelPacks.AddRange((PreviewBeatmapLevelPackSO[])original.GetField("_previewBeatmapLevelPack")); | ||
newCollection._allBeatmapLevelPacks = levelPacks.ToArray(); | ||
|
||
|
||
newCollection.UpdateArray(); | ||
newCollection.ReplaceReferences(); | ||
return newCollection; | ||
} | ||
|
||
public void ReplaceReferences() | ||
{ | ||
|
||
var soloFreePlay = Resources.FindObjectsOfTypeAll<SoloFreePlayFlowCoordinator>().FirstOrDefault(); | ||
if (soloFreePlay != null) | ||
{ | ||
soloFreePlay.SetPrivateField("_levelPackCollection", this); | ||
} | ||
|
||
var partyFreePlay = Resources.FindObjectsOfTypeAll<PartyFreePlayFlowCoordinator>().FirstOrDefault(); | ||
if (partyFreePlay != null) | ||
{ | ||
partyFreePlay.SetPrivateField("_levelPackCollection", this); | ||
} | ||
|
||
} | ||
|
||
public void AddLevelPack(CustomBeatmapLevelPack pack) | ||
{ | ||
_customBeatmapLevelPacks.Add(pack); | ||
UpdateArray(); | ||
ReplaceReferences(); | ||
} | ||
|
||
private void UpdateArray() | ||
{ | ||
var packs = _allBeatmapLevelPacks.ToList(); | ||
foreach (var c in _customBeatmapLevelPacks) | ||
if (!packs.Contains(c)) | ||
packs.Add(c); | ||
_allBeatmapLevelPacks = packs.ToArray(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SongCore.OverrideClasses | ||
{ | ||
public class SongCoreCustomBeatmapLevelPack : CustomBeatmapLevelPack | ||
{ | ||
public SongCoreCustomBeatmapLevelPack(string packID, string packName, UnityEngine.Sprite coverImage, CustomBeatmapLevelCollection customBeatmapLevelCollection) : base(packID, packName, coverImage, customBeatmapLevelCollection) | ||
{ | ||
|
||
} | ||
|
||
public void UpdateLevelCollection(CustomBeatmapLevelCollection newLevelCollection) | ||
{ | ||
_customBeatmapLevelCollection = newLevelCollection; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SongCore.OverrideClasses | ||
{ | ||
public class SongCoreCustomLevelCollection : CustomBeatmapLevelCollection | ||
{ | ||
// public readonly List<CustomPreviewBeatmapLevel> _levels = new List<CustomPreviewBeatmapLevel>(); | ||
public SongCoreCustomLevelCollection(CustomPreviewBeatmapLevel[] customPreviewBeatmapLevels) : base(customPreviewBeatmapLevels) | ||
{ | ||
} | ||
|
||
public void UpdatePreviewLevels(CustomPreviewBeatmapLevel[] levels) | ||
{ | ||
_customPreviewBeatmapLevels = levels; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters