48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ProcessUISwitch : UISwitch
|
|
{
|
|
protected GameObject processMask;
|
|
protected int processTime;
|
|
public List<Action> actions = new List<Action>();
|
|
// Start is called before the first frame update
|
|
|
|
|
|
public void OnEnable()
|
|
{
|
|
base.OnEnable();
|
|
processMask = transform.Find("processMask").gameObject;
|
|
processTime = processMask.transform.childCount;
|
|
nextBtn.gameObject.SetActive(false);
|
|
for (int i = 0; i < processTime; i++)
|
|
{
|
|
processMask.transform.GetChild(i).gameObject.SetActive(true);
|
|
}
|
|
StartCoroutine(startProcess());
|
|
}
|
|
|
|
IEnumerator startProcess()
|
|
{
|
|
foreach (Action action in actions)
|
|
{
|
|
action.Invoke();
|
|
|
|
}
|
|
for (int i = 0;i < processTime; i++)
|
|
{
|
|
yield return new WaitForSeconds(1.0f);
|
|
processMask.transform.GetChild(i).gameObject.SetActive(false);
|
|
}
|
|
nextBtn.gameObject.SetActive(true);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|