Files
bansonic_beta_main/Assets/scripts/Songs_Select/back_toPreviousPage.cs
T
2026-06-30 21:21:30 +08:00

52 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Bansonic;
public class back_toPreviousPage : MonoBehaviour
{
public string scene_turn_to_previous_scene = "selectYourSongFirst";
[Header("homepage")]
public string homePage_sceneName_to_turn = "Main_main";
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void backto_PreviousPage()
{
StartCoroutine(LoadSceneAsync(scene_turn_to_previous_scene));
}
public void backto_homePage()
{
StartCoroutine(LoadSceneAsync(homePage_sceneName_to_turn));
}
private IEnumerator LoadSceneAsync(string sceneName)
{
if (gTransition.LoadScene(sceneName, LoadSceneMode.Single))
{
while (gTransition.IsBusy)
{
yield return null;
}
yield break;
}
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
while (asyncLoad != null && !asyncLoad.isDone)
{
yield return null;
}
}
}