Commit db813c4d authored by hex's avatar hex

fix superpre cards download

parent e4c4c727
Pipeline #39963 failed
using UnityEngine;
using System.Collections;
public class YGO1superShower : MonoBehaviour {
public class YGO1superShower : MonoBehaviour
{
public UITexture card;
public UITexture closeup;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
......@@ -193,7 +193,7 @@ public class Menu : WindowServantSP
// 2. 使用 DownloadFileWithHeadCheck 下载文件
bool downloadCompleted = false;
bool fileExistedBefore = File.Exists(ypkFilePath);
bool newVersionDownloaded = false;
int lastReportedProgress = 0; // 用于控制进度报告的频率
yield return Program.I().StartCoroutine(UnityFileDownloader.DownloadFileWithHeadCheck(
......@@ -205,6 +205,11 @@ public class Menu : WindowServantSP
},
(progress) =>
{
if (!newVersionDownloaded)
{
newVersionDownloaded = true;
Program.PrintToChat("发现新版本,开始下载...");
}
int currentProgress = Mathf.FloorToInt(progress * 100);
if (currentProgress >= lastReportedProgress + 10)
{
......@@ -218,14 +223,13 @@ public class Menu : WindowServantSP
if (!downloadCompleted)
{
Program.PrintToChat("超先行卡更新失败,请检查网络连接或稍后再试。");
isDownloadingSuperPre = false;
yield break; // 提前退出协程
}
bool fileExistsAfter = File.Exists(ypkFilePath);
if (!fileExistedBefore && fileExistsAfter)
if (newVersionDownloaded)
{
Program.PrintToChat("发现新版本,下载完成,开始解压。");
Program.PrintToChat("下载完成,开始解压。");
yield return null;
try
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment