Commit 2fe97c16 authored by liujiangnan's avatar liujiangnan

feat: 翻页

parent 8d91f55b
import { initAir } from "./air";
import { middleLayerBase } from "./middleLayerBase";
import { buttonOnceClick } from "./util";
import { buttonOnceClick, buttonOnClick } from "./util";
const { ccclass, property } = cc._decorator;
......@@ -129,8 +129,30 @@ export default class NewClass extends middleLayerBase {
} else {
this.loadOnlineBundle('NJ_login');
}
this.initListener();
}
initListener() {
const exitBtn = cc.find('middleLayer/ExitBtn');
buttonOnClick(exitBtn, () => {
cc.find('middleLayer/BtnRight').active = false;
cc.find('middleLayer/BtnLeft').active = false;
exitBtn.active = false;
cc.audioEngine.stopAll();
(<any>window).courseware.freeAllOcMethod();
this.loadOnlineBundle('NJ_QianShuiTing');
});
buttonOnClick(cc.find('middleLayer/BtnRight'), () => {
this.goNextPage();
});
buttonOnClick(cc.find('middleLayer/BtnLeft'), () => {
this.goPrePage();
});
};
role = 'student';
protected onLoad(): void {
initAir(this);
......
......@@ -105,7 +105,7 @@ export abstract class middleLayerBase extends cc.Component {
this.loadBundle(sceneName, version, bondleUrl);
}
loadBundle(sceneName, version, bondleUrl) {
loadBundle(sceneName, version, bondleUrl, callback = null) {
this.currentBundleInfo = { sceneName, version, bondleUrl };
this.showMask();
this.showWaitingLetters();
......@@ -120,6 +120,7 @@ export abstract class middleLayerBase extends cc.Component {
this.hideMask();
canvas.getComponent(cc.Widget).updateAlignment();
middleLayer.scale = canvas.width / middleLayer.width;
callback && callback();
// this.showLog('middleLayer.scale = ' + middleLayer.scale);
});
});
......@@ -150,11 +151,13 @@ export abstract class middleLayerBase extends cc.Component {
cc.find('middleLayer/BtnLeft').active = false;
}
this.reWriteAir();
this.loadPageBundle();
this.loadPageBundle(() => {
cc.find('middleLayer/ExitBtn').active = true;
});
});
}
loadPageBundle() {
loadPageBundle(callback = null) {
let sceneName, version, bondleUrl = "";
if (cc.sys.os == cc.sys.OS_IOS) {
sceneName = this.courseItem.conf.ios.sceneName;
......@@ -170,8 +173,9 @@ export abstract class middleLayerBase extends cc.Component {
bondleUrl = this.courseItem.conf.web_desktop.bondleUrl;
}
this.loadBundle(sceneName, version, bondleUrl);
this.loadBundle(sceneName, version, bondleUrl, callback);
}
goPrePage() {
this.goTarIndexPage(this.courseIndex - 1);
}
......
{
"ver": "2.3.5",
"uuid": "581e9073-8bf2-454d-a651-28d2b8436b84",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 171,
"height": 146,
"platformSettings": {},
"subMetas": {
"Btn": {
"ver": "1.0.4",
"uuid": "7adb35f3-75de-4ecb-8542-f187f1b9fadf",
"rawTextureUuid": "581e9073-8bf2-454d-a651-28d2b8436b84",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 171,
"height": 146,
"rawWidth": 171,
"rawHeight": 146,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a35000bb-0e08-4a42-93f5-5fd08c740236",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"platformSettings": {},
"subMetas": {
"btnLeft": {
"ver": "1.0.4",
"uuid": "1b62c9c3-fabc-4f29-abaf-b446ebdb5571",
"rawTextureUuid": "a35000bb-0e08-4a42-93f5-5fd08c740236",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 61,
"height": 67,
"rawWidth": 61,
"rawHeight": 67,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d12a2294-3ae5-46b1-848d-6ae7f6e6777e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 209,
"height": 146,
"platformSettings": {},
"subMetas": {
"btnRight": {
"ver": "1.0.4",
"uuid": "164fd569-a9be-4a1d-8e9c-fc852550fbe1",
"rawTextureUuid": "d12a2294-3ae5-46b1-848d-6ae7f6e6777e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 209,
"height": 146,
"rawWidth": 209,
"rawHeight": 146,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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