2021-04-26 16:25:52 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
2021-04-28 15:30:38 +08:00
|
|
|
|
public class LoadingPf : PFUIPanel
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
List<Sprite> sprites;
|
|
|
|
|
|
Image image;
|
|
|
|
|
|
|
2021-05-08 11:09:03 +08:00
|
|
|
|
protected override void Awake()
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
2021-05-08 11:09:03 +08:00
|
|
|
|
base.Awake();
|
2021-04-26 16:25:52 +08:00
|
|
|
|
sprites = new List<Sprite>();
|
|
|
|
|
|
for (int i = 1; i < 80; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
sprites.Add(Resources.Load<Sprite>($"Images/全屏loading/loading{i.ToString("0000")}"));
|
|
|
|
|
|
}
|
|
|
|
|
|
image = transform.GetComponent<Image>();
|
|
|
|
|
|
}
|
2021-05-08 11:09:03 +08:00
|
|
|
|
|
|
|
|
|
|
protected override void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-04-26 16:25:52 +08:00
|
|
|
|
int index = 0;
|
2021-05-08 11:09:03 +08:00
|
|
|
|
//float time = 0;
|
2021-04-28 15:30:38 +08:00
|
|
|
|
public override void Show()
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
2021-04-28 15:30:38 +08:00
|
|
|
|
base.Show();
|
|
|
|
|
|
|
2021-04-26 16:25:52 +08:00
|
|
|
|
index = 0;
|
2021-05-08 11:09:03 +08:00
|
|
|
|
//time = 0;
|
|
|
|
|
|
|
|
|
|
|
|
StartCoroutine(Animation());
|
2021-04-26 16:25:52 +08:00
|
|
|
|
}
|
2021-05-08 11:09:03 +08:00
|
|
|
|
|
|
|
|
|
|
IEnumerator Animation()
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
2021-05-08 11:09:03 +08:00
|
|
|
|
for (; ; )
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
2021-05-08 11:09:03 +08:00
|
|
|
|
if (index % 79 == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
index = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
image.sprite = sprites[index];
|
|
|
|
|
|
index++;
|
|
|
|
|
|
yield return new WaitForSeconds(0.03f);
|
2021-04-26 16:25:52 +08:00
|
|
|
|
}
|
2021-05-08 11:09:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
//time += Time.deltaTime;
|
|
|
|
|
|
//if (time < 0.03)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// return;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//time = 0;
|
|
|
|
|
|
//if (index % 79 == 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// index = 0;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//image.sprite = sprites[index];
|
|
|
|
|
|
//index++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Close()
|
|
|
|
|
|
{
|
|
|
|
|
|
StopCoroutine(Animation());
|
|
|
|
|
|
base.Close();
|
2021-04-26 16:25:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|