Init
This commit is contained in:
45
Assets/Scripts/HotUpdate/Preload/PatchWindow.cs
Normal file
45
Assets/Scripts/HotUpdate/Preload/PatchWindow.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Video;
|
||||
using YooAsset;
|
||||
|
||||
public class PatchWindow : MonoBehaviour
|
||||
{
|
||||
public Text statusText;
|
||||
public Slider progressBar;
|
||||
public Text downloadSizeText;
|
||||
public VideoPlayer video;
|
||||
private void Awake()
|
||||
{
|
||||
video.targetCamera = GameManager.Inst.UICamera;
|
||||
}
|
||||
IEnumerator Start()
|
||||
{
|
||||
GameManager.Inst.MainUICanvas.transform.Find("InitBg").gameObject.SetActive(false);
|
||||
//更新Main
|
||||
var operation = new PatchOperation(PatchManager.Inst.MainData(Boot.Inst.PlayMode, (data) =>
|
||||
{
|
||||
progressBar.value = data.Progress;
|
||||
downloadSizeText.text = $"{data.CurrentDownloadBytes / 1024f / 1024f:F1}MB/{data.TotalDownloadBytes / 1024f / 1024f:F1}MB";
|
||||
}));
|
||||
YooAssets.StartOperation(operation);
|
||||
yield return operation;
|
||||
|
||||
if(operation.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
statusText.text = "更新完成";
|
||||
YooAssets.SetDefaultPackage(YooAssets.GetPackage("Main"));
|
||||
GameManager.Inst.LoadDll(YooAssets.GetPackage("Main"), "Main");
|
||||
AssetHandle gameStartHandle = YooAssets.GetPackage("Main").LoadAssetAsync<GameObject>("GameStart");
|
||||
gameStartHandle.InstantiateAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
statusText.text = "更新失败";
|
||||
}
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/HotUpdate/Preload/PatchWindow.cs.meta
Normal file
11
Assets/Scripts/HotUpdate/Preload/PatchWindow.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3ea340f8e2ac8b4697e13772a6a4df5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Scripts/HotUpdate/Preload/Preload.asmdef
Normal file
20
Assets/Scripts/HotUpdate/Preload/Preload.asmdef
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Preload",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:e34a5702dd353724aa315fb8011f08c3",
|
||||
"GUID:f22fac247a56d2d41b687bb0d900e54e",
|
||||
"GUID:c55575a9f1747c240822f4b7e0400716",
|
||||
"GUID:1ea6b676786131e4095182b742bb64ec",
|
||||
"GUID:8804cd4b3fef1e041ad4f6c94ec49e0c"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/Scripts/HotUpdate/Preload/Preload.asmdef.meta
Normal file
7
Assets/Scripts/HotUpdate/Preload/Preload.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90f60af8868b92c498beb9f677f8731a
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user