Skip to content

Commit

Permalink
Updated for Beat Saber 0.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
taz030485 committed Aug 19, 2018
1 parent ad72266 commit accc555
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ If the Random button is disabled, you have no songs in the current shown list th

# Changes
1.2
Updated for Beat Saber 0.11.2
Added Autoplay option
Fixed No Fail and No Obstacles

Expand Down
19 changes: 12 additions & 7 deletions RandomSong/RandomSongManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
difficultyViewController = flowController.GetPrivateField<StandardLevelDifficultyViewController>("_levelDifficultyViewController");
listTableView = listViewController.GetPrivateField<StandardLevelListTableView>("_levelListTableView");
tableView = listTableView.GetPrivateField<TableView>("_tableView");
//tableView.didSelectRowEvent += didSelectRowEvent;
detailViewController = flowController.GetPrivateField<StandardLevelDetailViewController>("_levelDetailViewController");
player = Resources.FindObjectsOfTypeAll<SongPreviewPlayer>().FirstOrDefault();

Expand Down Expand Up @@ -338,8 +337,11 @@ IEnumerator SelectAndLoadSong(IStandardLevel level)
if (autoPlay)
{
// Fade screen away to not spoil song
var fade = Resources.FindObjectsOfTypeAll<FadeOutOnGameEvent>().FirstOrDefault();
fade.HandleGameEvent(0.7f);
var gameSceneManager = Resources.FindObjectsOfTypeAll<GameScenesManager>().FirstOrDefault();
gameSceneManager.HandleExecutorTransitionDidStart(0.7f);

//var fade = Resources.FindObjectsOfTypeAll<FadeOutOnGameEvent>().FirstOrDefault();
//fade.HandleGameEvent(0.7f);
// Turn preview down
player.volume = 0;
yield return new WaitForSeconds(1.0f);
Expand Down Expand Up @@ -378,18 +380,21 @@ private void PlayRandomSong()
}
}

public static void LogComponents(Transform t, string prefix)
public static void LogComponents(Transform t, string prefix = "=", bool includeScipts = false)
{
Console.WriteLine(prefix + ">" + t.name);

foreach (var comp in t.GetComponents<MonoBehaviour>())
if (includeScipts)
{
Console.WriteLine(prefix + "-->" + comp.GetType());
foreach (var comp in t.GetComponents<MonoBehaviour>())
{
Console.WriteLine(prefix + "-->" + comp.GetType());
}
}

foreach (Transform child in t)
{
LogComponents(child, prefix + "=");
LogComponents(child, prefix + "=", includeScipts);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion RandomSong/UIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void Awake()
public static Button CreateUIButton(RectTransform parent, string buttonTemplate)
{
Button btn = Instantiate(Resources.FindObjectsOfTypeAll<Button>().Last(x => (x.name == buttonTemplate)), parent, false);
DestroyImmediate(btn.GetComponent<GameEventOnUIButtonClick>());
DestroyImmediate(btn.GetComponent<SignalOnUIButtonClick>());
btn.onClick = new Button.ButtonClickedEvent();
btn.name = "CustomUIButton";
return btn;
Expand Down

0 comments on commit accc555

Please sign in to comment.