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-04-28 15:30:38 +08:00
|
|
|
|
protected override void Start()
|
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>();
|
|
|
|
|
|
}
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
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;
|
|
|
|
|
|
time = 0;
|
|
|
|
|
|
}
|
2021-04-28 15:30:38 +08:00
|
|
|
|
|
2021-04-26 16:25:52 +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++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|