更新修复金字塔
This commit is contained in:
@@ -130,12 +130,25 @@ export default class PyramidView extends cc.Component {
|
||||
});
|
||||
}
|
||||
private async open(reminder?: PyramidDailyReminder): Promise<void> {
|
||||
if (this.overlay || this.opening || this.settlementQueued) return; this.opening = true;
|
||||
console.log("openPyramid");
|
||||
console.log("open1");
|
||||
console.log(this.node);
|
||||
const alive = () => cc.isValid(this, true) && cc.isValid(this.node, true);
|
||||
console.log(alive());
|
||||
console.log(this.overlay);
|
||||
console.log(this.opening);
|
||||
console.log(this.settlementQueued);
|
||||
if (!alive() || this.overlay || this.opening || this.settlementQueued) return; this.opening = true;
|
||||
// Prepare automatic reminders silently; only an explicit click shows Loading.
|
||||
const stopLoading = reminder ? () => {} : this.startLoading();
|
||||
console.log("openLoading");
|
||||
const stopLoading = reminder ? () => { } : this.startLoading();
|
||||
try {
|
||||
this.releaseResources = await Service.acquireResources();
|
||||
console.log("try");
|
||||
const release = await Service.acquireResources();
|
||||
if (!alive()) { release(); return; }
|
||||
this.releaseResources = release;
|
||||
const [synced, prefab] = await Promise.all([Service.sync(), Service.prefab()]);
|
||||
if (!alive()) return;
|
||||
const state = Service.data();
|
||||
if (!synced && !reminder && typeof window !== "undefined" && (window as any).wx)
|
||||
(window as any).wx.showToast({ title: Service.error || "活动信息暂时无法获取", icon: "none" });
|
||||
@@ -145,23 +158,33 @@ export default class PyramidView extends cc.Component {
|
||||
this.node.addChild(this.overlay); this.overlay.zIndex = 2000;
|
||||
const panel: any = this.overlay.getComponent("PyramidPanel");
|
||||
await panel.initialize(this.closeOverlay);
|
||||
if (!alive()) return;
|
||||
if (!cc.isValid(panel, true) || !cc.isValid(this.overlay, true)) { this.closeOverlay(); return; }
|
||||
if (reminder && !this.reminderCurrent(reminder)) { this.closeOverlay(); return; }
|
||||
if (this.overlay && cc.isValid(this.overlay, true)) {
|
||||
this.overlay.active = true;
|
||||
if (reminder) ActivityScheduleService.markPyramidReminderShown(reminder);
|
||||
}
|
||||
} catch (error) {
|
||||
cc.warn("[Pyramid] 界面加载失败", error);
|
||||
this.closeOverlay();
|
||||
console.log("catch");
|
||||
console.log(error);
|
||||
if (alive()) {
|
||||
cc.warn("[Pyramid] 界面加载失败", error);
|
||||
this.closeOverlay();
|
||||
}
|
||||
} finally {
|
||||
stopLoading(); this.opening = false; this.syncPaymentLoading();
|
||||
if (!this.overlay && this.releaseResources) { this.releaseResources(); this.releaseResources = null; }
|
||||
if (!this.overlay && this.finishReminder) this.closeOverlay();
|
||||
console.log("finally");
|
||||
stopLoading();
|
||||
if (alive()) {
|
||||
this.opening = false; this.syncPaymentLoading();
|
||||
if (!this.overlay && this.releaseResources) { this.releaseResources(); this.releaseResources = null; }
|
||||
if (!this.overlay && this.finishReminder) this.closeOverlay();
|
||||
}
|
||||
}
|
||||
}
|
||||
private startLoading(): () => void {
|
||||
const template = this.node.getChildByName("Loading");
|
||||
if (!template || !template.parent) return () => {};
|
||||
if (!template || !template.parent) return () => { };
|
||||
const parent = template.parent, size = parent.getContentSize();
|
||||
const factor = Math.min(1, size.width / 1080, size.height / 1920);
|
||||
const viewport = new cc.Node("PyramidLoading");
|
||||
|
||||
@@ -771,7 +771,7 @@ export class GameConfig {
|
||||
vibrateOpen: true, //震动
|
||||
coinnum: 0, //每局的金币数
|
||||
paid_user: false, //是否是付费用户
|
||||
version: "1.0.84", //版本号
|
||||
version: "1.0.85", //版本号
|
||||
shushu_DistinctId: "", //数数访客ID
|
||||
shushu_AccountId: "", //数数账号ID
|
||||
uid: "", //用户和后端唯一id
|
||||
|
||||
Reference in New Issue
Block a user