LaboratoryProtection/Assets/UnityTest/ZXL/Scripts/UI/ChapterUI.cs

42 lines
946 B
C#
Raw Normal View History

2023-09-13 15:04:19 +08:00
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
namespace UnityTest.ZXL
{
//章节
2023-09-13 15:31:44 +08:00
public class ChapterUI : UI
2023-09-13 15:04:19 +08:00
{
public List<GameObject> images = new List<GameObject>();
public Image blackImage;
private void ShowChapter(int index)
{
HideAll();
images[index].SetActive(true);
blackImage.color = new Color(1, 1, 1, 0);
}
private void HideAll()
{
foreach (var image in images)
{
image.SetActive(false);
}
}
public IEnumerator Transit(int index)
{
ShowChapter(index);
yield return new WaitForSeconds(1);
blackImage.DOColor(new Color(1, 1, 1, 1), 1);
yield return new WaitForSeconds(1);
// 加载后面的内容
}
}
}