JM_KA/assets/Script/UpdatePanel.ts
2022-08-31 09:48:48 +08:00

74 lines
1.9 KiB
TypeScript

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
}