mirror of https://github.com/tuyoogame/YooAsset
update space shooter
parent
f2e6da649b
commit
10750a0123
|
@ -1,4 +1,5 @@
|
||||||
using UniFramework.Event;
|
using UniFramework.Event;
|
||||||
|
using YooAsset;
|
||||||
|
|
||||||
public class PatchEventDefine
|
public class PatchEventDefine
|
||||||
{
|
{
|
||||||
|
@ -36,7 +37,7 @@ public class PatchEventDefine
|
||||||
{
|
{
|
||||||
public int TotalCount;
|
public int TotalCount;
|
||||||
public long TotalSizeBytes;
|
public long TotalSizeBytes;
|
||||||
|
|
||||||
public static void SendEventMessage(int totalCount, long totalSizeBytes)
|
public static void SendEventMessage(int totalCount, long totalSizeBytes)
|
||||||
{
|
{
|
||||||
var msg = new FoundUpdateFiles();
|
var msg = new FoundUpdateFiles();
|
||||||
|
@ -55,14 +56,14 @@ public class PatchEventDefine
|
||||||
public int CurrentDownloadCount;
|
public int CurrentDownloadCount;
|
||||||
public long TotalDownloadSizeBytes;
|
public long TotalDownloadSizeBytes;
|
||||||
public long CurrentDownloadSizeBytes;
|
public long CurrentDownloadSizeBytes;
|
||||||
|
|
||||||
public static void SendEventMessage(int totalDownloadCount, int currentDownloadCount, long totalDownloadSizeBytes, long currentDownloadSizeBytes)
|
public static void SendEventMessage(DownloadUpdateData updateData)
|
||||||
{
|
{
|
||||||
var msg = new DownloadProgressUpdate();
|
var msg = new DownloadProgressUpdate();
|
||||||
msg.TotalDownloadCount = totalDownloadCount;
|
msg.TotalDownloadCount = updateData.TotalDownloadCount;
|
||||||
msg.CurrentDownloadCount = currentDownloadCount;
|
msg.CurrentDownloadCount = updateData.CurrentDownloadCount;
|
||||||
msg.TotalDownloadSizeBytes = totalDownloadSizeBytes;
|
msg.TotalDownloadSizeBytes = updateData.TotalDownloadBytes;
|
||||||
msg.CurrentDownloadSizeBytes = currentDownloadSizeBytes;
|
msg.CurrentDownloadSizeBytes = updateData.CurrentDownloadBytes;
|
||||||
UniEvent.SendMessage(msg);
|
UniEvent.SendMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,11 +100,11 @@ public class PatchEventDefine
|
||||||
public string FileName;
|
public string FileName;
|
||||||
public string Error;
|
public string Error;
|
||||||
|
|
||||||
public static void SendEventMessage(string fileName, string error)
|
public static void SendEventMessage(DownloadErrorData errorData)
|
||||||
{
|
{
|
||||||
var msg = new WebFileDownloadFailed();
|
var msg = new WebFileDownloadFailed();
|
||||||
msg.FileName = fileName;
|
msg.FileName = errorData.FileName;
|
||||||
msg.Error = error;
|
msg.Error = errorData.ErrorInfo;
|
||||||
UniEvent.SendMessage(msg);
|
UniEvent.SendMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ public class FsmDownloadPackageFiles : IStateNode
|
||||||
private IEnumerator BeginDownload()
|
private IEnumerator BeginDownload()
|
||||||
{
|
{
|
||||||
var downloader = (ResourceDownloaderOperation)_machine.GetBlackboardValue("Downloader");
|
var downloader = (ResourceDownloaderOperation)_machine.GetBlackboardValue("Downloader");
|
||||||
downloader.OnDownloadErrorCallback = PatchEventDefine.WebFileDownloadFailed.SendEventMessage;
|
downloader.DownloadErrorCallback = PatchEventDefine.WebFileDownloadFailed.SendEventMessage;
|
||||||
downloader.OnDownloadProgressCallback = PatchEventDefine.DownloadProgressUpdate.SendEventMessage;
|
downloader.DownloadUpdateCallback = PatchEventDefine.DownloadProgressUpdate.SendEventMessage;
|
||||||
downloader.BeginDownload();
|
downloader.BeginDownload();
|
||||||
yield return downloader;
|
yield return downloader;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue