Cute_demon_attacks/meng_yao/Assets/script/JumpScene/SceneGuodu.cs

52 lines
1.2 KiB
C#
Raw Normal View History

2024-10-30 01:08:16 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using DG.Tweening;
using System.Threading.Tasks;
public class SceneGuodu : MonoBehaviour
{
2024-11-07 00:06:45 +08:00
public bool is_lock = false;
2024-10-30 01:08:16 +08:00
public static SceneGuodu instance;
2024-10-30 03:45:54 +08:00
public string sceneName;
2024-10-30 01:08:16 +08:00
public float transitionTime = 1f; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
public GameObject mask;//<2F><><EFBFBD><EFBFBD>
private void Start()
{
2024-10-30 03:45:54 +08:00
if (instance == null)
{
DontDestroyOnLoad(this);
instance = this;
}
SceneManager.sceneLoaded += loadEnd;
2024-10-30 01:08:16 +08:00
2024-10-30 03:45:54 +08:00
}
2024-10-30 01:08:16 +08:00
2024-10-30 03:45:54 +08:00
void loadEnd(Scene scene, LoadSceneMode mode)
{
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>" + scene.name);
2024-10-31 13:27:31 +08:00
if (mask != null )
{
mask.transform.GetComponent<CircleDissolveEffect>().isTransitioning = true;
}
2024-11-07 00:06:45 +08:00
is_lock = false;
2024-10-30 03:45:54 +08:00
}
2024-10-30 01:08:16 +08:00
public async void SlideInAndLoadScene(string sceneName)
{
2024-11-07 00:06:45 +08:00
if (!is_lock)
{
is_lock = true;
2024-10-30 03:45:54 +08:00
this.sceneName = sceneName;
mask.transform.GetComponent<CircleDissolveEffect>().isTransitioning = false;
2024-10-30 05:06:41 +08:00
await Task.Delay(1000);
2024-10-30 01:08:16 +08:00
SceneManager.LoadScene(sceneName);
2024-11-07 00:06:45 +08:00
}
2024-10-30 03:45:54 +08:00
2024-10-30 01:08:16 +08:00
}
}