Commit c1901bd5 authored by wildfirecode13's avatar wildfirecode13

update

parent 1ba45eac
......@@ -159,6 +159,8 @@ export default class PanelCtrl {
}
}
get current(){return this._current}
destroy() {
PanelCtrl._instance = null;
this.stacks = null;
......
import { changeScene } from "../../module/ctrls";
import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel";
import getObject from "../getObject";
import { IndexScene } from "../template/IndexScene";
import { Tools } from "../Tools";
import { getWebData, sendWebNet, WebNetName } from "../WebNet";
export class ShareFailPanel extends Panel {
initUi() {
super.initUi();
var skin = RES.getSkinDataByName(this.skinName);
this.position.set(skin.x, skin.y);
}
get groupNames() { return ["share_fail"] }
get skinName() { return "share_fail" }
//两个按钮都是关闭作用
get closeBtns() {
return [getObject(this, 'share_fail_closebtn'), getObject(this, 'share_fail_okbtn')];
}
async start(data) {
super.start();
}
hidePanel(){
super.hidePanel();
// changeScene(IndexScene);
}
}
\ No newline at end of file
import { changeScene } from "../../module/ctrls";
import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel";
import getObject from "../getObject";
import { IndexScene } from "../template/IndexScene";
import { Tools } from "../Tools";
import { getWebData, sendWebNet, WebNetName } from "../WebNet";
export class ShareSuccessPanel extends Panel {
initUi() {
super.initUi();
var skin = RES.getSkinDataByName(this.skinName);
this.position.set(skin.x, skin.y);
}
get groupNames() { return ["share_success"] }
get skinName() { return "share_success" }
//两个按钮都是关闭作用
get closeBtns() {
return [getObject(this, 'share_success_closebtn'), getObject(this, 'share_success_okbtn')];
}
async start(data) {
super.start();
}
hidePanel(){
super.hidePanel();
// changeScene(IndexScene);
}
}
\ No newline at end of file
import { unwatchPageVisibility, watchPageVisibility } from '@spark/utils';
import { changeScene, showPanel } from "../../module/ctrls";
import { closeCurrentPanel, showPanel } from "../../module/ctrls";
import PanelCtrl from '../../module/ctrls/panelCtrl';
import { Scene } from "../../module/views/Scene";
import { PrizePanel } from "../panels/prize";
import { ShareFailPanel } from '../panels/share_fail';
import { ShareSuccessPanel } from '../panels/share_success';
import { sendWebNet, WebNetName } from '../WebNet';
import { NewbieScene } from './NewbieScene';
export class IndexScene extends Scene {
get groupNames() { return ["index"] }
get skinName() { return "index" }
......@@ -14,24 +15,29 @@ export class IndexScene extends Scene {
async start(data) {
super.start();
console.log(this);
// console.log(this);
// setTimeout(() => {
// changeScene(NewbieScene)
// }, 1000);
}
async onPageVisibilityChange(visible) {
onPageVisibilityChange = async (visible) => {
console.log('页面' + visible ? '可见' : '不可见');
if (visible) {
var res = await sendWebNet(WebNetName.index)
const current = PanelCtrl.instance.current;
if (visible && !current) {
var res = await sendWebNet(WebNetName.canshare)
if (res && res.success && res.data) {
// showPanel(PrizePanel);
}else{
// showPanel(PrizePanel);
showPanel(ShareSuccessPanel);
setTimeout(() => {
showPanel(ShareFailPanel);
}, 3000);
} else {
showPanel(ShareFailPanel);
}
}
}
initEvents() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment