[add] 熱更新
This commit is contained in:
13
assets/Prefab.meta
Normal file
13
assets/Prefab.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "a0181a7b-9c3d-4126-a012-acf5a1e095a2",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
3027
assets/Prefab/UpdatePanel.prefab
Normal file
3027
assets/Prefab/UpdatePanel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
9
assets/Prefab/UpdatePanel.prefab.meta
Normal file
9
assets/Prefab/UpdatePanel.prefab.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "9d9ca13a-071d-47f4-836c-a69d1045dc14",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
13
assets/Script/HUD.meta
Normal file
13
assets/Script/HUD.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "b4db1c37-7356-4f88-ba5c-9ea4e86a85b7",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
456
assets/Script/HUD/AssetBundleMamager.ts
Normal file
456
assets/Script/HUD/AssetBundleMamager.ts
Normal file
@@ -0,0 +1,456 @@
|
||||
// import BusinessTypeSetting from "../../_BusinessTypeSetting/BusinessTypeSetting";
|
||||
// import LocalStorageData from "../Data/LocalStorageData";
|
||||
// import Enum_Loading from "../HUDV2/Enum_Loading";
|
||||
// import HUDM from "./HUDM";
|
||||
|
||||
// export default class AssetBundleMamager {
|
||||
// //#region static 屬性
|
||||
|
||||
// private static _instance: AssetBundleMamager = null;
|
||||
// public static get Instance(): AssetBundleMamager { return AssetBundleMamager._instance; }
|
||||
|
||||
// //#endregion
|
||||
|
||||
// //#region public 屬性
|
||||
|
||||
// public HUGroup: Map<string, HUDM> = new Map<string, HUDM>();
|
||||
|
||||
// /** 本地VerList */
|
||||
// public LocalVerList: Enum_Loading.VerListObj = null;
|
||||
|
||||
// /** 遠端VerList */
|
||||
// public RemoteVerList: Enum_Loading.VerListObj = null;
|
||||
|
||||
// public DownloadList_Preview: Object = {};
|
||||
|
||||
// /** IsChangeBundleUrl */
|
||||
// public IsChangeBundleUrl: boolean = false;
|
||||
|
||||
// //#endregion
|
||||
|
||||
// //#region Lifecycle
|
||||
|
||||
// constructor() {
|
||||
// AssetBundleMamager._instance = this;
|
||||
// CC_PREVIEW && this._initdownloadList_Preview();
|
||||
// }
|
||||
|
||||
// //#endregion
|
||||
|
||||
// //#region Custom Function
|
||||
|
||||
// /**
|
||||
// * 取得Bundle
|
||||
// * @param {string} BundleName Bundle名稱
|
||||
// * @param {string} Version 版號
|
||||
// * @return {cc.AssetManager.Bundle} Bundle
|
||||
// */
|
||||
// public *GetBundle(BundleName: string, Version: string = ""): IterableIterator<cc.AssetManager.Bundle> {
|
||||
// let bundle: cc.AssetManager.Bundle = cc.assetManager.getBundle(BundleName);
|
||||
// if (bundle) {
|
||||
// return bundle;
|
||||
// }
|
||||
|
||||
// // options是可选参数,引擎会根据保留字段 进行对应的操作,这里添加了version和onFileProgress,可用来记录热更资源版本和下载进度
|
||||
// let options: any = null;
|
||||
|
||||
// let BundleUrl: string = BundleName;
|
||||
// if (cc.sys.isNative && !this.LocalVerList[BundleName].UseLocal) {
|
||||
// BundleUrl = `${(jsb.fileUtils ? jsb.fileUtils.getWritablePath() : "/")}Bundle/${BundleName}/remote/${BundleName}`;
|
||||
// options = {
|
||||
// version: Version
|
||||
// };
|
||||
// }
|
||||
|
||||
// cc.assetManager.loadBundle(BundleUrl, options, (err: Error, resp: cc.AssetManager.Bundle) => {
|
||||
// if (err) {
|
||||
// cc.error(err);
|
||||
// bundle = null;
|
||||
// }
|
||||
// bundle = resp;
|
||||
// });
|
||||
// while (typeof bundle === "undefined") {
|
||||
// yield null;
|
||||
// }
|
||||
|
||||
// return bundle;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 更新Bundle
|
||||
// * @param {HUDM} HUDName HUD
|
||||
// */
|
||||
// public *UpdateBundle(HUDName: HUDM | string, onFileProgress?: (finish: number, total: number, item: string) => void): IterableIterator<any> {
|
||||
// let HUD: HUDM;
|
||||
// if (HUDName instanceof HUDM) {
|
||||
// HUD = HUDName;
|
||||
// } else {
|
||||
// HUD = this.GetHUD(HUDName);
|
||||
// }
|
||||
// let UpdateingData: Enum_Loading.UpdateingDataObj = yield* HUD.HUD(onFileProgress);
|
||||
// if (UpdateingData.IsUpdatecomplete) {
|
||||
// this.LocalVerList[HUD.BundleName] = this.RemoteVerList[HUD.BundleName];
|
||||
// this.LocalVerList[HUD.BundleName]["UseLocal"] = false;
|
||||
// LocalStorageData.Instance.LocalVerList = JSON.stringify(this.LocalVerList);
|
||||
// }
|
||||
// return UpdateingData;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 更新Bundle
|
||||
// * @param {HUDM} HUDName HUD
|
||||
// */
|
||||
// public *RetryUpdateBundle(HUDName: HUDM | string, onFileProgress?: (finish: number, total: number, item: string) => void): IterableIterator<any> {
|
||||
// let HUD: HUDM;
|
||||
// if (HUDName instanceof HUDM) {
|
||||
// HUD = HUDName;
|
||||
// } else {
|
||||
// HUD = this.GetHUD(HUDName);
|
||||
// }
|
||||
// let UpdateingData: Enum_Loading.UpdateingDataObj = yield* HUD.RetryDownLoadFailedAssets();
|
||||
// return UpdateingData;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 從Bundle取得資源
|
||||
// * @param {cc.AssetManager.Bundle | string} BundleName Bundle名稱
|
||||
// * @param {string} SourceName 資源名稱
|
||||
// * @param {string} type 資源型別
|
||||
// * @return {any} Source
|
||||
// */
|
||||
// public *GetBundleSource(BundleName: cc.AssetManager.Bundle | string, SourceName: string, type?: string | Bundle_Source_Type, onFileProgress?: (finish: number, total: number, item: cc.AssetManager.RequestItem) => void): IterableIterator<any> {
|
||||
// let bundle: cc.AssetManager.Bundle;
|
||||
// let source: any;
|
||||
// if (BundleName instanceof cc.AssetManager.Bundle) {
|
||||
// bundle = BundleName;
|
||||
// } else {
|
||||
// bundle = cc.assetManager.getBundle(BundleName);
|
||||
// if (!bundle) {
|
||||
// cc.error(`GetBundleSource Error BundleName: ${BundleName}`);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// switch (type) {
|
||||
// case Bundle_Source_Type.Scene: {
|
||||
// bundle.loadScene(SourceName, onFileProgress, function (err: Error, scene: cc.SceneAsset): void {
|
||||
// if (err) {
|
||||
// cc.error(err);
|
||||
// return null;
|
||||
// }
|
||||
// // cc.director.runScene(scene);
|
||||
// source = scene;
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
|
||||
// case Bundle_Source_Type.Json: {
|
||||
// bundle.load(SourceName, onFileProgress, function (err: Error, json: cc.JsonAsset): void {
|
||||
// if (err) {
|
||||
// cc.error(err);
|
||||
// return null;
|
||||
// }
|
||||
// // source = JSON.parse(json["_nativeAsset"]);
|
||||
// source = json;
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
|
||||
// case Bundle_Source_Type.Prefab: {
|
||||
// bundle.load(SourceName, cc.Prefab, onFileProgress, function (err: Error, prefab: cc.Asset): void {
|
||||
// if (err) {
|
||||
// cc.error(err);
|
||||
// return null;
|
||||
// }
|
||||
// // source = JSON.parse(json["_nativeAsset"]);
|
||||
// source = prefab;
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
|
||||
// default:
|
||||
// bundle.load(SourceName, function (err: Error, any: any): void {
|
||||
// if (err) {
|
||||
// cc.error(err);
|
||||
// return null;
|
||||
// }
|
||||
// source = any;
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
|
||||
// while (typeof source === "undefined") {
|
||||
// yield null;
|
||||
// }
|
||||
// return source;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 釋放Bundle
|
||||
// * @param {string} slotID slotID
|
||||
// */
|
||||
// public *BundleRelease(slotID: number): IterableIterator<any> {
|
||||
// let gameName: string = `Game_${slotID}`;
|
||||
// let sceneName: string = `Slot${slotID}`;
|
||||
// let bundle: cc.AssetManager.Bundle = cc.assetManager.getBundle(gameName);
|
||||
// if (!bundle) {
|
||||
// cc.log(`BundleRelease Error BundleName: ${gameName}`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // let bundles: cc.AssetManager.Cache<cc.AssetManager.Bundle> = cc.assetManager.bundles;
|
||||
// // let cacheDir: string = cc.assetManager.cacheManager.cacheDir;
|
||||
// // let cachedFiles: Object = cc.assetManager.cacheManager.cachedFiles;
|
||||
|
||||
// yield* this.DelBundleCache(bundle);
|
||||
// yield* this.DelOthersCache(slotID);
|
||||
// bundle.release(sceneName, cc.SceneAsset);
|
||||
// cc.assetManager.removeBundle(bundle);
|
||||
// cc.sys.garbageCollect();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 從Bundle刪除暫存資源
|
||||
// * @param {string} BundleName Bundle名稱
|
||||
// */
|
||||
// public *DelBundleCache(BundleName: cc.AssetManager.Bundle | string): IterableIterator<any> {
|
||||
// if (!CC_JSB) {
|
||||
// return;
|
||||
// }
|
||||
// let bundle: cc.AssetManager.Bundle;
|
||||
// let source: any;
|
||||
// if (BundleName instanceof cc.AssetManager.Bundle) {
|
||||
// bundle = BundleName;
|
||||
// } else {
|
||||
// bundle = cc.assetManager.getBundle(BundleName);
|
||||
// if (!bundle) {
|
||||
// // cc.error(`GetBundleSource Error BundleName: ${BundleName}`);
|
||||
// // return;
|
||||
// bundle = yield* AssetBundleMamager.Instance.GetBundle(BundleName, this.RemoteVerList[BundleName].Version);
|
||||
// }
|
||||
// }
|
||||
|
||||
// let _map: Object = bundle["_config"].assetInfos._map;
|
||||
// for (let map of Object.keys(_map)) {
|
||||
// let path: string = _map[map].path;
|
||||
// if (!path) {
|
||||
// break;
|
||||
// }
|
||||
// source = yield* AssetBundleMamager.Instance.GetBundleSource(bundle, path);
|
||||
// cc.assetManager.cacheManager.removeCache(source.nativeUrl);
|
||||
// bundle.release(path);
|
||||
// // return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 從cachedFiles刪除暫存資源
|
||||
// * @param {number} slotID slotID
|
||||
// */
|
||||
// public *DelOthersCache(slotID: number): IterableIterator<any> {
|
||||
// if (!CC_JSB) {
|
||||
// return;
|
||||
// }
|
||||
// let cachedFiles: Object = cc.assetManager.cacheManager.cachedFiles["_map"];
|
||||
// let delcache_group: string[] = [`shared/jsons`, `Slot/Slot${slotID}`, "sounds/Slot/Default", `${BusinessTypeSetting.FolderUrlBundle}project.manifest`, "submit.txt"];
|
||||
// for (let cached of Object.keys(cachedFiles)) {
|
||||
// for (var i: number = 0; i < delcache_group.length; ++i) {
|
||||
// let delcache: string = delcache_group[i];
|
||||
// if (cached.includes(delcache)) {
|
||||
// cc.assetManager.cacheManager.removeCache(cached);
|
||||
// // console.log(`removeCache: ${cached}`);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public GetHUD(BundleName: HUDM | string): HUDM {
|
||||
// let HUD: HUDM;
|
||||
// if (BundleName instanceof HUDM) {
|
||||
// HUD = BundleName;
|
||||
// } else {
|
||||
// if (!this.HUGroup.has(BundleName)) {
|
||||
// HUD = new HUDM(BundleName);
|
||||
// this.HUGroup.set(BundleName, HUD);
|
||||
// } else {
|
||||
// HUD = this.HUGroup.get(BundleName);
|
||||
// }
|
||||
// HUD = this.HUGroup.get(BundleName);
|
||||
// }
|
||||
// return HUD;
|
||||
// }
|
||||
|
||||
// /** 刪除全部暫存資源 */
|
||||
// public ClearAllCache(): void {
|
||||
// cc.assetManager.cacheManager.clearCache();
|
||||
// cc.game.restart();
|
||||
// }
|
||||
|
||||
|
||||
// public *CheckBundleNeedHUD(BundleName: HUDM | string): IterableIterator<Enum_Loading.NeedUpdateDataObj> {
|
||||
// let HUD: HUDM;
|
||||
// if (BundleName instanceof HUDM) {
|
||||
// HUD = BundleName;
|
||||
// } else {
|
||||
// HUD = this.GetHUD(BundleName);
|
||||
// }
|
||||
// if (!this.LocalVerList[HUD.BundleName]) {
|
||||
// this.LocalVerList[HUD.BundleName] = new Enum_Loading.BundleDataObj();
|
||||
// let apkVersion: string = this.RemoteVerList[HUD.BundleName].ApkVersion;
|
||||
// if (apkVersion && apkVersion !== "0") {
|
||||
// this.LocalVerList[HUD.BundleName].UseLocal = true;
|
||||
// this.LocalVerList[HUD.BundleName].Version = apkVersion;
|
||||
// }
|
||||
// LocalStorageData.Instance.LocalVerList = JSON.stringify(this.LocalVerList);
|
||||
// } else {
|
||||
// if (this.RemoteVerList[HUD.BundleName].Version === this.RemoteVerList[HUD.BundleName].ApkVersion) {
|
||||
// this.LocalVerList[HUD.BundleName] = this.RemoteVerList[HUD.BundleName];
|
||||
// this.LocalVerList[HUD.BundleName].UseLocal = true;
|
||||
// }
|
||||
// }
|
||||
// let UpdateData: Enum_Loading.NeedUpdateDataObj = new Enum_Loading.NeedUpdateDataObj();
|
||||
// if (this.LocalVerList[HUD.BundleName].UseLocal) {
|
||||
// UpdateData.IsNeedUpdate = AssetBundleMamager.Instance.versionCompareHandle(this.LocalVerList[HUD.BundleName].Version, this.RemoteVerList[HUD.BundleName].Version) < 0 ? true : false;
|
||||
// if (UpdateData.IsNeedUpdate) {
|
||||
// UpdateData = yield* HUD.CheckUpdate();
|
||||
// }
|
||||
// } else {
|
||||
// UpdateData = yield* HUD.CheckUpdate();
|
||||
// }
|
||||
// return UpdateData;
|
||||
// }
|
||||
|
||||
// // public *CheckBundleNeedHUD(BundleName: string): IterableIterator<boolean> {
|
||||
// // if (!this.LocalVerList[BundleName]) {
|
||||
// // this.LocalVerList[BundleName] = new Enum_Loading.BundleDataObj();
|
||||
// // let apkVersion: string = this.RemoteVerList[BundleName].ApkVersion;
|
||||
// // if (apkVersion && apkVersion !== "0") {
|
||||
// // this.LocalVerList[BundleName].UseLocal = true;
|
||||
// // this.LocalVerList[BundleName].Version = apkVersion;
|
||||
// // }
|
||||
// // LocalStorageData.Instance.LocalVerList = JSON.stringify(this.LocalVerList);
|
||||
// // }
|
||||
// // let IsUpdate: boolean = AssetBundleMamager.Instance.versionCompareHandle(this.LocalVerList[BundleName].Version, this.RemoteVerList[BundleName].Version) < 0 ? true : false;
|
||||
// // return IsUpdate;
|
||||
// // }
|
||||
|
||||
// public CheckGameNeedUpdate(GameID: number): boolean {
|
||||
// let IsUpdate: boolean = false;
|
||||
// let bundleName: string = `Game_${GameID}`;
|
||||
// if (!this.RemoteVerList[bundleName]) {
|
||||
// this.RemoteVerList[bundleName] = new Enum_Loading.BundleDataObj();
|
||||
// this.RemoteVerList[bundleName].HasBundle = false;
|
||||
// LocalStorageData.Instance.RemoteVerList = JSON.stringify(this.RemoteVerList);
|
||||
// IsUpdate = true;
|
||||
// }
|
||||
// if (!this.LocalVerList[bundleName]) {
|
||||
// this.LocalVerList[bundleName] = new Enum_Loading.BundleDataObj();
|
||||
// let apkVersion: string = this.RemoteVerList[bundleName].ApkVersion;
|
||||
// if (apkVersion && apkVersion !== "0") {
|
||||
// this.LocalVerList[bundleName].UseLocal = true;
|
||||
// this.LocalVerList[bundleName].Version = apkVersion;
|
||||
// }
|
||||
// LocalStorageData.Instance.LocalVerList = JSON.stringify(this.LocalVerList);
|
||||
// }
|
||||
// if (CC_PREVIEW) {
|
||||
// return this._getIsDownload_Preview(GameID);
|
||||
// }
|
||||
// if (IsUpdate) {
|
||||
// return IsUpdate;
|
||||
// }
|
||||
// IsUpdate = AssetBundleMamager.Instance.versionCompareHandle(this.LocalVerList[bundleName].Version, this.RemoteVerList[bundleName].Version) < 0 ? true : false;
|
||||
// return IsUpdate;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 比對版號(熱更能從1.0.0更新到2.0.0,從2.0.0回退到1.0.0)
|
||||
// * 官方提供的版本比較函數,只有服務端版本>客戶端版本時,才會進行更新。所以不能從2.0.0回退到1.0.0版本。
|
||||
// * @param {string} versionA 本地版號
|
||||
// * @param {string} versionB 遠程版號
|
||||
// * @return {number} num = -1 須更新
|
||||
// * @return {number} num = 0 不須更新
|
||||
// */
|
||||
// public versionCompareHandle(versionA: string, versionB: string): number {
|
||||
// // console.log("Ver A " + versionA + "VerB " + versionB);
|
||||
// var vA: string[] = versionA.split(".");
|
||||
// var vB: string[] = versionB.split(".");
|
||||
|
||||
// // 長度不相等,則進行更新
|
||||
// if (vA.length !== vB.length) {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
// for (var i: number = 0; i < vA.length; ++i) {
|
||||
// var a: number = +vA[i];
|
||||
// var b: number = +vB[i] || 0;
|
||||
// if (a === b) {
|
||||
// // 數字相同,則跳過
|
||||
// continue;
|
||||
// } else {
|
||||
// // 數字不同,則進行更新
|
||||
// return -1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 長度相等且數字相等,則不更新
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// //#endregion
|
||||
|
||||
// //#region DownloadList_Preview
|
||||
|
||||
// private _initdownloadList_Preview(): void {
|
||||
// this.DownloadList_Preview = JSON.parse(LocalStorageData.Instance.DownloadList_Preview);
|
||||
// this.DownloadList_Preview = this.DownloadList_Preview ? this.DownloadList_Preview : {};
|
||||
// }
|
||||
|
||||
// private _getIsDownload_Preview(slotID: number): boolean {
|
||||
// if (!this.DownloadList_Preview[slotID]) {
|
||||
// this.SetIsDownload_Preview(slotID, false);
|
||||
// }
|
||||
// return !this.DownloadList_Preview[slotID];
|
||||
// }
|
||||
|
||||
// public SetIsDownload_Preview(slotID: number, isDownload: boolean = true): void {
|
||||
// this.DownloadList_Preview[slotID] = isDownload;
|
||||
// LocalStorageData.Instance.DownloadList_Preview = JSON.stringify(this.DownloadList_Preview);
|
||||
// }
|
||||
|
||||
// //#endregion
|
||||
// }
|
||||
|
||||
// //#region enum
|
||||
|
||||
// /** Bundle資源類型 */
|
||||
// export enum Bundle_Source_Type {
|
||||
// /** Json */
|
||||
// Json = "json",
|
||||
|
||||
// /** Scene */
|
||||
// Scene = "scene",
|
||||
|
||||
// /** Prefab */
|
||||
// Prefab = "prefab"
|
||||
// }
|
||||
|
||||
// //#endregion
|
||||
|
||||
// //#region 廢棄 Function
|
||||
|
||||
// // /**
|
||||
// // * 從Bundle刪除暫存資源
|
||||
// // * @param {string} BundleName Bundle名稱
|
||||
// // */
|
||||
// // public *DelBundleCache(BundleName: cc.AssetManager.Bundle | string): IterableIterator<any> {
|
||||
// // if (!CC_JSB) {
|
||||
// // return;
|
||||
// // }
|
||||
// // let WritablePath: string = `${jsb.fileUtils.getWritablePath()}gamecaches/${BundleName}`;
|
||||
// // if (jsb.fileUtils.isDirectoryExist(WritablePath)) {
|
||||
// // jsb.fileUtils.removeDirectory(WritablePath);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// //#endregion
|
10
assets/Script/HUD/AssetBundleMamager.ts.meta
Normal file
10
assets/Script/HUD/AssetBundleMamager.ts.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "97a0b2c9-72f8-4797-874a-263e4558f765",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
72
assets/Script/HUD/Enum_HUDM.ts
Normal file
72
assets/Script/HUD/Enum_HUDM.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
export module Enum_HUDM {
|
||||
|
||||
//#region Enum
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Class
|
||||
|
||||
// /** BaseBundle資料 */
|
||||
// @ccclass("BaseBundleObj")
|
||||
// export class BaseBundleObj {
|
||||
// @property({ displayName: "Bundle名稱", tooltip: "Bundle名稱" })
|
||||
// public BundleName: string = "";
|
||||
|
||||
// @property({ displayName: "優先度", tooltip: "優先度", type: cc.Integer })
|
||||
// public Priority: number = 1;
|
||||
// }
|
||||
|
||||
class BundleDictionary<T> {
|
||||
[x: string]: T;
|
||||
}
|
||||
|
||||
/** VerList資料 */
|
||||
@ccclass("VerListObj")
|
||||
export class VerListObj extends BundleDictionary<BundleDataObj> {
|
||||
}
|
||||
|
||||
/** Bundle資料 */
|
||||
@ccclass("BundleDataObj")
|
||||
export class BundleDataObj {
|
||||
public Version: string = "0";
|
||||
|
||||
public ApkVersion: string = "0";
|
||||
|
||||
public UseLocal: boolean = false;
|
||||
|
||||
/** 有沒有包到Bundle */
|
||||
public HasBundle: boolean = true;
|
||||
}
|
||||
|
||||
/** Bundle資料 */
|
||||
@ccclass("NeedUpdateDataObj")
|
||||
export class NeedUpdateDataObj {
|
||||
|
||||
/** 是否需要更新 */
|
||||
public IsNeedUpdate: boolean;
|
||||
|
||||
/** 更新大小 */
|
||||
public TotalBytes: string;
|
||||
|
||||
constructor(...params: any[]) {
|
||||
this.IsNeedUpdate = params[0];
|
||||
this.TotalBytes = params[1] ? params[1] : null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Bundle資料 */
|
||||
@ccclass("UpdateingDataObj")
|
||||
export class UpdateingDataObj {
|
||||
|
||||
/** 是否更新完成 */
|
||||
public IsUpdatecomplete: boolean;
|
||||
|
||||
constructor(...params: any[]) {
|
||||
this.IsUpdatecomplete = params[0];
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
export default Enum_HUDM;
|
10
assets/Script/HUD/Enum_HUDM.ts.meta
Normal file
10
assets/Script/HUD/Enum_HUDM.ts.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "7217469f-9c06-46fd-be21-69020675c24d",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
353
assets/Script/HUD/HUDM.ts
Normal file
353
assets/Script/HUD/HUDM.ts
Normal file
@@ -0,0 +1,353 @@
|
||||
import { CoroutineV2 } from "../Engine/CatanEngine/CoroutineV2/CoroutineV2";
|
||||
import UpdatePanel from "../UpdatePanel";
|
||||
import Enum_HUDM from "./Enum_HUDM";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
/** HUDManager */
|
||||
@ccclass
|
||||
export default class HUDM extends cc.Component {
|
||||
|
||||
//#region static 屬性
|
||||
|
||||
private static _instance: HUDM = null;
|
||||
public static get Instance(): HUDM { return HUDM._instance; }
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region private 屬性
|
||||
|
||||
private _updatePanel: UpdatePanel;
|
||||
private _am: jsb.AssetsManager;
|
||||
private _onFileProgress: (finish: number, total: number, item: string) => void;
|
||||
private _updateListener: any;
|
||||
private _checkListener: any;
|
||||
private _versionCompareHandle: any = null;
|
||||
private _needUpdateData: Enum_HUDM.NeedUpdateDataObj = null;
|
||||
private _updateingData: Enum_HUDM.UpdateingDataObj = null;
|
||||
private _updating: boolean = false;
|
||||
private _canRetry: boolean = false;
|
||||
private _isChangeUrl: boolean = false;
|
||||
private _path: string = "Bundle";
|
||||
private _customManifest: string = "";
|
||||
private _storagePath: string = "";
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Lifecycle
|
||||
|
||||
constructor(...params: any[]) {
|
||||
super();
|
||||
|
||||
if (!cc.sys.isNative) {
|
||||
return;
|
||||
}
|
||||
HUDM._instance = this;
|
||||
this._updatePanel = params[0];
|
||||
|
||||
// let packageUrl: string = params[1];
|
||||
// let BundleData: Enum_Loading.BundleDataObj = AssetBundleMamager.Instance.RemoteVerList[this.BundleName];
|
||||
// let packageUrl: string = BundleData.BundleUrl;
|
||||
let packageUrl: string = `https://jianmiau.tk/Resources/App/JMKA/update/remote-assets`;
|
||||
|
||||
this._customManifest = JSON.stringify({
|
||||
"packageUrl": packageUrl,
|
||||
"remoteManifestUrl": `${packageUrl}/project.manifest`,
|
||||
"remoteVersionUrl": `${packageUrl}/version.json`,
|
||||
"version": "1.0.0",
|
||||
});
|
||||
|
||||
this._storagePath = `${(jsb.fileUtils ? jsb.fileUtils.getWritablePath() : "./")}${this._path}`;
|
||||
|
||||
this._versionCompareHandle = function (versionA: string, versionB: string): number {
|
||||
// console.log("Ver A " + versionA + "VerB " + versionB);
|
||||
let vA: string[] = versionA.split(".");
|
||||
let vB: string[] = versionB.split(".");
|
||||
|
||||
// 長度不相等,則進行更新
|
||||
if (vA.length !== vB.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (let i: number = 0; i < vA.length; ++i) {
|
||||
let a: number = +vA[i];
|
||||
let b: number = +vB[i] || 0;
|
||||
if (a === b) {
|
||||
// 數字相同,則跳過
|
||||
continue;
|
||||
} else {
|
||||
// 數字不同,則進行更新
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// 長度相等且數字相等,則不更新
|
||||
return 0;
|
||||
};
|
||||
this._initAssetManaget();
|
||||
}
|
||||
private _initAssetManaget(): void {
|
||||
let self: this = this;
|
||||
//
|
||||
this._am = new jsb.AssetsManager("", this._storagePath, this._versionCompareHandle);
|
||||
|
||||
// Setup the verification callback, but we don't have md5 check function yet, so only print some message
|
||||
// Return true if the verification passed, otherwise return false
|
||||
this._am.setVerifyCallback(function (path: any, asset: { compressed: any; md5: any; path: any; size: any; }): boolean {
|
||||
// When asset is compressed, we don't need to check its md5, because zip file have been deleted.
|
||||
let compressed: any = asset.compressed;
|
||||
// Retrieve the correct md5 value.
|
||||
let expectedMD5: string = asset.md5;
|
||||
// asset.path is relative path and path is absolute.
|
||||
let relativePath: string = asset.path;
|
||||
// The size of asset file, but this value could be absent.
|
||||
let size: any = asset.size;
|
||||
if (compressed) {
|
||||
self._updatePanel.info.string = "Verification passed : " + relativePath;
|
||||
// console.log("onLoad -> Verification passed : " + relativePath);
|
||||
return true;
|
||||
} else {
|
||||
self._updatePanel.info.string = "Verification passed : " + relativePath + " (" + expectedMD5 + ")";
|
||||
// console.log("onLoad -> setVerifyCallbackVerification passed : " + relativePath + " (" + expectedMD5 + ")");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (cc.sys.os === cc.sys.OS_ANDROID) {
|
||||
// Some Android device may slow down the download process when concurrent tasks is too much.
|
||||
// The value may not be accurate, please do more test and find what's most suitable for your game.
|
||||
// this._am.setMaxConcurrentTask(10);
|
||||
this._am["setMaxConcurrentTask"](10);
|
||||
// this._updatePanel.info.string = "Max concurrent tasks count have been limited to 2";
|
||||
// console.log("onLoad -> Max concurrent tasks count have been limited to 10");
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
public *CheckUpdate(): IterableIterator<any> {
|
||||
this._needUpdateData = null;
|
||||
if (this._updating) {
|
||||
this._updatePanel.info.string = "Checking or updating ...";
|
||||
console.error("checkUpdate -> Checking or updating ...");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._am.getState() === jsb.AssetsManager.State.UNINITED) {
|
||||
let manifest: jsb.Manifest = new jsb.Manifest(this._customManifest, this._storagePath);
|
||||
this._am.loadLocalManifest(manifest, this._storagePath);
|
||||
}
|
||||
if (!this._am.getLocalManifest() || !this._am.getLocalManifest().isLoaded()) {
|
||||
// this.tipsLabel.string = "Failed to load local manifest ...";
|
||||
console.error("checkUpdate -> Failed to load local manifest ...");
|
||||
return;
|
||||
}
|
||||
this._am.setEventCallback(this.checkCb.bind(this));
|
||||
|
||||
this._am.checkUpdate();
|
||||
this._updating = true;
|
||||
|
||||
while (this._needUpdateData === null) {
|
||||
yield null;
|
||||
}
|
||||
|
||||
return this._needUpdateData;
|
||||
}
|
||||
|
||||
private checkCb(event: jsb.EventAssetsManager): void {
|
||||
let failed: boolean = false;
|
||||
switch (event.getEventCode()) {
|
||||
case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST:
|
||||
console.error("checkCb -> No local manifest file found, HUD skipped.");
|
||||
failed = true;
|
||||
break;
|
||||
case jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST:
|
||||
case jsb.EventAssetsManager.ERROR_PARSE_MANIFEST:
|
||||
console.error("checkCb -> Fail to download manifest file, HUD skipped.");
|
||||
failed = true;
|
||||
break;
|
||||
case jsb.EventAssetsManager.ALREADY_UP_TO_DATE:
|
||||
console.log("checkCb -> Already up to date with the latest remote version.");
|
||||
this._needUpdateData = new Enum_HUDM.NeedUpdateDataObj(false);
|
||||
break;
|
||||
case jsb.EventAssetsManager.NEW_VERSION_FOUND:
|
||||
this._updatePanel.checkBtn.active = false;
|
||||
this._updatePanel.fileProgress.progress = 0;
|
||||
this._updatePanel.byteProgress.progress = 0;
|
||||
this._updatePanel.info.string = "發現新版本,請嘗試更新。 " + this._bytesToSize(event.getTotalBytes());
|
||||
console.log("checkCb -> New version found, please try to update." + event.getTotalBytes());
|
||||
this._needUpdateData = new Enum_HUDM.NeedUpdateDataObj(true, this._bytesToSize(event.getTotalBytes()));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
this._am.setEventCallback(null);
|
||||
this._checkListener = null;
|
||||
this._updating = false;
|
||||
|
||||
if (failed) {
|
||||
this._needUpdateData = new Enum_HUDM.NeedUpdateDataObj(false, null);
|
||||
}
|
||||
}
|
||||
|
||||
public *HUD(onFileProgress?: (finish: number, total: number, item: string) => void): IterableIterator<any> {
|
||||
this._updateingData = null;
|
||||
if (this._am && !this._updating) {
|
||||
this._am.setEventCallback(this._updateCb.bind(this));
|
||||
|
||||
if (this._am.getState() === jsb.AssetsManager.State.UNINITED) {
|
||||
let manifest: jsb.Manifest = new jsb.Manifest(this._customManifest, this._storagePath);
|
||||
this._am.loadLocalManifest(manifest, this._storagePath);
|
||||
}
|
||||
|
||||
this._onFileProgress = onFileProgress ? onFileProgress : null;
|
||||
this._am.update();
|
||||
this._updating = true;
|
||||
|
||||
while (this._updateingData === null) {
|
||||
yield null;
|
||||
}
|
||||
|
||||
return this._updateingData;
|
||||
} else {
|
||||
return new Enum_HUDM.UpdateingDataObj(false);
|
||||
}
|
||||
}
|
||||
|
||||
private _updateCb(event: jsb.EventAssetsManager): void {
|
||||
let self: this = this;
|
||||
let needRestart: boolean = false;
|
||||
let failed: boolean = false;
|
||||
switch (event.getEventCode()) {
|
||||
case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST:
|
||||
this._updatePanel.info.string = "No local manifest file found, HUD skipped.";
|
||||
console.log("updateCb -> No local manifest file found, HUD skipped.");
|
||||
failed = true;
|
||||
break;
|
||||
case jsb.EventAssetsManager.UPDATE_PROGRESSION:
|
||||
this._updatePanel.byteProgress.progress = event.getPercent();
|
||||
this._updatePanel.fileProgress.progress = event.getPercentByFile();
|
||||
this._updatePanel.fileLabel.string = event.getDownloadedFiles() + " / " + event.getTotalFiles();
|
||||
// this.tipsLabel.string = event.getDownloadedBytes() + " / " + event.getTotalBytes();
|
||||
|
||||
// console.log("updateCb -> " + event.getDownloadedBytes() + " / " + event.getTotalBytes());
|
||||
// let msg: string = event.getMessage();
|
||||
// if (msg) {
|
||||
// this._updatePanel.info.string = 'Updated file: ' + msg;
|
||||
// console.log("updateCb -> Updated file: " + msg);
|
||||
// console.log("updateCb -> " + event.getPercent() / 100 + "% : " + msg);
|
||||
// }
|
||||
|
||||
let msg: string = event.getMessage();
|
||||
if (this._onFileProgress) {
|
||||
this._onFileProgress(event.getDownloadedBytes(), event.getTotalBytes(), msg ? msg : "");
|
||||
}
|
||||
break;
|
||||
case jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST:
|
||||
case jsb.EventAssetsManager.ERROR_PARSE_MANIFEST:
|
||||
this._updatePanel.info.string = "Fail to download manifest file, HUD skipped.";
|
||||
console.error("updateCb -> Fail to download manifest file, HUD skipped.");
|
||||
failed = true;
|
||||
break;
|
||||
case jsb.EventAssetsManager.ALREADY_UP_TO_DATE:
|
||||
this._updatePanel.info.string = "Already up to date with the latest remote version.";
|
||||
console.error("updateCb -> Already up to date with the latest remote version.");
|
||||
failed = true;
|
||||
break;
|
||||
case jsb.EventAssetsManager.UPDATE_FINISHED:
|
||||
// this.tipsLabel.string = "更新完成. " + event.getMessage();
|
||||
console.log("updateCb -> 更新完成. " + event.getMessage());
|
||||
this._updateingData = new Enum_HUDM.UpdateingDataObj(true);
|
||||
needRestart = true;
|
||||
break;
|
||||
case jsb.EventAssetsManager.UPDATE_FAILED:
|
||||
this._updatePanel.info.string = "Update failed. " + event.getMessage();
|
||||
console.error("updateCb -> Update failed. " + event.getMessage());
|
||||
this._updatePanel.retryBtn.active = true;
|
||||
this._canRetry = true;
|
||||
this._updateingData = new Enum_HUDM.UpdateingDataObj(false);
|
||||
this._updating = false;
|
||||
break;
|
||||
case jsb.EventAssetsManager.ERROR_UPDATING:
|
||||
this._updatePanel.info.string = "Asset update error: " + event.getAssetId() + ", " + event.getMessage();
|
||||
console.error("updateCb -> Asset update error: " + event.getAssetId() + ", " + event.getMessage());
|
||||
break;
|
||||
case jsb.EventAssetsManager.ERROR_DECOMPRESS:
|
||||
this._updatePanel.info.string = event.getMessage();
|
||||
console.error("updateCb -> " + event.getMessage());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
this._am.setEventCallback(null);
|
||||
this._updateListener = null;
|
||||
this._updating = false;
|
||||
}
|
||||
|
||||
if (needRestart) {
|
||||
let AsyncFunction: () => IterableIterator<any> = function* (): IterableIterator<any> {
|
||||
self._updatePanel.info.string = "更新完成 即將重啟";
|
||||
// 卡個一幀不然都看不到100%的畫面
|
||||
yield CoroutineV2.WaitTime(5 / cc.game.getFrameRate()).Start();
|
||||
|
||||
self._am.setEventCallback(null);
|
||||
self._updateListener = null;
|
||||
// Prepend the manifest's search path
|
||||
let searchPaths: string[] = jsb.fileUtils.getSearchPaths();
|
||||
let newPaths: [string] = self._am.getLocalManifest().getSearchPaths();
|
||||
console.log(JSON.stringify(newPaths));
|
||||
Array.prototype.unshift.apply(searchPaths, newPaths);
|
||||
// This value will be retrieved and appended to the default search path during game startup,
|
||||
// please refer to samples/js-tests/main.js for detailed usage.
|
||||
// !!! Re-add the search paths in main.js is very important, otherwise, new scripts won't take effect.
|
||||
cc.sys.localStorage.setItem("HotUpdateSearchPaths", JSON.stringify(searchPaths));
|
||||
jsb.fileUtils.setSearchPaths(searchPaths);
|
||||
|
||||
cc.audioEngine.stopAll();
|
||||
cc.game.restart();
|
||||
};
|
||||
CoroutineV2.Single(AsyncFunction()).Start();
|
||||
}
|
||||
}
|
||||
|
||||
public *RetryDownLoadFailedAssets(): IterableIterator<any> {
|
||||
if (!this._updating && this._canRetry) {
|
||||
this._updateingData = null;
|
||||
this._updatePanel.retryBtn.active = false;
|
||||
this._canRetry = false;
|
||||
|
||||
this._updatePanel.info.string = "Retry failed Assets...";
|
||||
console.log("retry -> Retry failed Assets...");
|
||||
this._am.downloadFailedAssets();
|
||||
|
||||
while (this._updateingData === null) {
|
||||
yield null;
|
||||
}
|
||||
|
||||
return this._updateingData;
|
||||
} else {
|
||||
console.error(`retry -> error updating: ${this._updating}, canRetry: ${this._canRetry}`);
|
||||
this._updateingData = new Enum_HUDM.UpdateingDataObj(false);
|
||||
}
|
||||
}
|
||||
|
||||
private _bytesToSize(bytes: number): string {
|
||||
if (bytes === 0) {
|
||||
return "0 B";
|
||||
}
|
||||
let k: number = 1024;
|
||||
let sizes: string[] = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||
let i: number = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
if (this._updateListener) {
|
||||
this._am.setEventCallback(null);
|
||||
this._updateListener = null;
|
||||
}
|
||||
}
|
||||
}
|
10
assets/Script/HUD/HUDM.ts.meta
Normal file
10
assets/Script/HUD/HUDM.ts.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "dd9501f7-957a-4e62-8630-d43f62d171d1",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -1,6 +1,15 @@
|
||||
/*
|
||||
|
||||
node version_generator.js -v 1.0.0 -u https://jianmiau.tk/Resources/App/JMKA/update/remote-assets/ -s build/jsb-default/remote-assets -d remote-assets
|
||||
|
||||
*/
|
||||
|
||||
import { CoroutineV2 } from "./Engine/CatanEngine/CoroutineV2/CoroutineV2";
|
||||
import { System_Eevent } from "./Engine/CatanEngine/CSharp/System/System_Eevent";
|
||||
import { Enum_HUDM } from "./HUD/Enum_HUDM";
|
||||
import HUDM from "./HUD/HUDM";
|
||||
import NativeClass from "./NativeClass";
|
||||
import UpdatePanel from "./UpdatePanel";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@@ -14,23 +23,35 @@ export default class Manager extends cc.Component {
|
||||
@property({ type: cc.Node })
|
||||
public BG: cc.Node = null;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region private
|
||||
|
||||
// private _text_to_Speech: Text_to_Speech;
|
||||
@property({ type: cc.Node })
|
||||
public UpdatePanel: cc.Node = null;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Lifecycle
|
||||
|
||||
protected onLoad(): void {
|
||||
CoroutineV2.Single(this._init()).Start();
|
||||
}
|
||||
|
||||
private *_init(): IterableIterator<any> {
|
||||
console.log(`2022/08/30 16:26`);
|
||||
cc.debug.setDisplayStats(false);
|
||||
if (CC_DEBUG) {
|
||||
console.log("Debug");
|
||||
}
|
||||
|
||||
new NativeClass(this.webview);
|
||||
if (cc.sys.isNative) {
|
||||
new HUDM(this.UpdatePanel.getComponentInChildren(UpdatePanel));
|
||||
let needUpdateData: Enum_HUDM.NeedUpdateDataObj = yield* HUDM.Instance.CheckUpdate();
|
||||
if (needUpdateData.IsNeedUpdate) {
|
||||
this.UpdatePanel.active = true;
|
||||
return;
|
||||
} else {
|
||||
this.UpdatePanel.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
let self: this = this;
|
||||
// this._text_to_Speech = new Text_to_Speech();
|
||||
@@ -115,7 +136,7 @@ export default class Manager extends cc.Component {
|
||||
|
||||
public *GetFCMToken(): IterableIterator<any> {
|
||||
const FCMToken: string = NativeClass.Instance.GetFCMToken();
|
||||
if (!FCMToken) {
|
||||
if (cc.sys.os === cc.sys.OS_IOS && !FCMToken) {
|
||||
yield CoroutineV2.WaitTime(1);
|
||||
yield this.GetFCMToken();
|
||||
return;
|
||||
|
73
assets/Script/UpdatePanel.ts
Normal file
73
assets/Script/UpdatePanel.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { CoroutineV2 } from "./Engine/CatanEngine/CoroutineV2/CoroutineV2";
|
||||
import { Enum_HUDM } from "./HUD/Enum_HUDM";
|
||||
import HUDM from "./HUD/HUDM";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class UpdatePanel extends cc.Component {
|
||||
//#region 外調參數
|
||||
|
||||
@property({ type: cc.Label })
|
||||
public info: cc.Label = null;
|
||||
|
||||
@property({ type: cc.ProgressBar })
|
||||
public fileProgress: cc.ProgressBar = null;
|
||||
|
||||
@property({ type: cc.Label })
|
||||
public fileLabel: cc.Label = null;
|
||||
|
||||
@property({ type: cc.ProgressBar })
|
||||
public byteProgress: cc.ProgressBar = null;
|
||||
|
||||
@property({ type: cc.Label })
|
||||
public byteLabel: cc.Label = null;
|
||||
|
||||
@property({ type: cc.Node })
|
||||
public close: cc.Node = null;
|
||||
|
||||
@property({ type: cc.Node })
|
||||
public checkBtn: cc.Node = null;
|
||||
|
||||
@property({ type: cc.Node })
|
||||
public retryBtn: cc.Node = null;
|
||||
|
||||
@property({ type: cc.Node })
|
||||
public updateBtn: cc.Node = null;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Lifecycle
|
||||
|
||||
protected onLoad(): void {
|
||||
let self: this = this;
|
||||
this.close.on(cc.Node.EventType.TOUCH_END, () => {
|
||||
self.node.active = false;
|
||||
}, this);
|
||||
|
||||
this.node.getChildByName("update_btn").on("click", () => { CoroutineV2.Single(this.OnClickUpdate()).Start(); }, this);
|
||||
this.node.getChildByName("check_btn").on("click", () => { CoroutineV2.Single(this.OnClickCheck()).Start(); }, this);
|
||||
this.node.getChildByName("retry_btn").on("click", () => { CoroutineV2.Single(this.OnClickRetry()).Start(); }, this);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region OnClick
|
||||
|
||||
public *OnClickUpdate(): IterableIterator<any> {
|
||||
let updateingData: Enum_HUDM.UpdateingDataObj = yield* HUDM.Instance.HUD();
|
||||
return;
|
||||
}
|
||||
|
||||
public *OnClickCheck(): IterableIterator<any> {
|
||||
let needUpdateData: Enum_HUDM.NeedUpdateDataObj = yield* HUDM.Instance.CheckUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
public *OnClickRetry(): IterableIterator<any> {
|
||||
let updateingData: Enum_HUDM.UpdateingDataObj = yield* HUDM.Instance.RetryDownLoadFailedAssets();
|
||||
return;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
10
assets/Script/UpdatePanel.ts.meta
Normal file
10
assets/Script/UpdatePanel.ts.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "86711b47-13f6-4a4e-8a9d-0e24e7fca6e7",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Texture/UI.meta
Normal file
13
assets/Texture/UI.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "e47b98da-e2c8-4c74-9530-0f718d04b512",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Texture/UI/chat.meta
Normal file
13
assets/Texture/UI/chat.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "72d8bf4e-9f48-4cdc-9121-eb140ee30407",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/Texture/UI/chat/button_orange.png
Normal file
BIN
assets/Texture/UI/chat/button_orange.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
38
assets/Texture/UI/chat/button_orange.png.meta
Normal file
38
assets/Texture/UI/chat/button_orange.png.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "3459ab36-782c-4c4e-8aef-7280aff8b272",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 240,
|
||||
"height": 95,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"button_orange": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "c01466ea-7283-4fce-b615-4ee78c774af0",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "3459ab36-782c-4c4e-8aef-7280aff8b272",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 240,
|
||||
"height": 95,
|
||||
"rawWidth": 240,
|
||||
"rawHeight": 95,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Texture/UI/chat/gb_inputbox.png
Normal file
BIN
assets/Texture/UI/chat/gb_inputbox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
38
assets/Texture/UI/chat/gb_inputbox.png.meta
Normal file
38
assets/Texture/UI/chat/gb_inputbox.png.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "c39ea496-96eb-4dc5-945a-e7c919b77c21",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 54,
|
||||
"height": 81,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"gb_inputbox": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "7d1d4e60-aba2-48e8-85f8-8e328f34e7cc",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "c39ea496-96eb-4dc5-945a-e7c919b77c21",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 54,
|
||||
"height": 81,
|
||||
"rawWidth": 54,
|
||||
"rawHeight": 81,
|
||||
"borderTop": 11,
|
||||
"borderBottom": 11,
|
||||
"borderLeft": 12,
|
||||
"borderRight": 12,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
13
assets/Texture/UI/new.meta
Normal file
13
assets/Texture/UI/new.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "d695c8b9-c7e7-4290-84e5-c10e9988e966",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/Texture/UI/new/bg_rankinglist.png
Normal file
BIN
assets/Texture/UI/new/bg_rankinglist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
38
assets/Texture/UI/new/bg_rankinglist.png.meta
Normal file
38
assets/Texture/UI/new/bg_rankinglist.png.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "700faa17-11a6-46cd-aeb5-d6900bc264f8",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 504,
|
||||
"height": 144,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"bg_rankinglist": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "ca7dd73d-526a-4c85-9702-eb51e93b9d99",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "700faa17-11a6-46cd-aeb5-d6900bc264f8",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 504,
|
||||
"height": 144,
|
||||
"rawWidth": 504,
|
||||
"rawHeight": 144,
|
||||
"borderTop": 69,
|
||||
"borderBottom": 36,
|
||||
"borderLeft": 36,
|
||||
"borderRight": 36,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Texture/UI/new/icon_back.png
Normal file
BIN
assets/Texture/UI/new/icon_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
38
assets/Texture/UI/new/icon_back.png.meta
Normal file
38
assets/Texture/UI/new/icon_back.png.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "2ddfe005-2129-41d8-aeec-2b1f51f02962",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 33,
|
||||
"height": 48,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"icon_back": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "6035fac6-5208-4e0b-bea7-62ff9fb1338b",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "2ddfe005-2129-41d8-aeec-2b1f51f02962",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 33,
|
||||
"height": 48,
|
||||
"rawWidth": 33,
|
||||
"rawHeight": 48,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
13
assets/Texture/UI/table.meta
Normal file
13
assets/Texture/UI/table.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "7e51bdf1-1b2e-4de4-9e05-b9c9715f6229",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/Texture/UI/table/bg_jinbishu.png
Normal file
BIN
assets/Texture/UI/table/bg_jinbishu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
38
assets/Texture/UI/table/bg_jinbishu.png.meta
Normal file
38
assets/Texture/UI/table/bg_jinbishu.png.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "caaaf9ff-5036-4232-a8a7-88b80b2e4c88",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 40,
|
||||
"height": 30,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"bg_jinbishu": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "022a80ab-4cde-42ca-9e04-8a23745cf138",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "caaaf9ff-5036-4232-a8a7-88b80b2e4c88",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 40,
|
||||
"height": 30,
|
||||
"rawWidth": 40,
|
||||
"rawHeight": 30,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 11,
|
||||
"borderRight": 12,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user