Commit b6bf2b7c authored by liujiangnan's avatar liujiangnan

feat

parent 06f00ce5
...@@ -125,7 +125,7 @@ export default class NewClass extends middleLayerBase { ...@@ -125,7 +125,7 @@ export default class NewClass extends middleLayerBase {
} }
const res: any = await this.asyncCallNetworkApiGet('/api/application/v1/checkVersion', { const res: any = await this.asyncCallNetworkApiGet('/api/application/v1/checkVersion', {
pkg_name: 'com.iplayabc.oxford', pkg_name: 'com.iplayabc.oxford.lite',
platform: platform platform: platform
}); });
return JSON.parse(res).data; return JSON.parse(res).data;
...@@ -284,188 +284,8 @@ export default class NewClass extends middleLayerBase { ...@@ -284,188 +284,8 @@ export default class NewClass extends middleLayerBase {
if (isSaveAnswer) { if (isSaveAnswer) {
await this.saveAnswer(data); await this.saveAnswer(data);
} }
// 如果不是最后一页,跳转到下一页
if (this.courseIndex == this.courses.length - 1) { this.goNextPage();
await this.pdtdFinishHandler();
} else {
// 如果不是最后一页,跳转到下一页
this.goNextPage();
}
}
async pdtdFinishHandler() {
if (!this.getData("syllabus_path") || this.getData("syllabus_path").type !== "pdtd") {
// 不是拼读天地的学习内容
return;
}
if (this.getData("syllabus_path").pdtd_type!=='game_select') {
// 不是指读学习内容
return;
}
const isLastPart = await this.isLastPart();
if (isLastPart) {
await this.playGetParterAnim();
this.unlockNextForder();
return;
}
const gameSelectData = this.getData('NJ_game_select');
const pageFirstIdx = gameSelectData.pageIdxMap.findIndex(num => num == gameSelectData.currentPageIdx);
if (gameSelectData.pageIdxMap[pageFirstIdx + gameSelectData.currentPartIdx + 1] == gameSelectData.currentPageIdx) {
console.log('if');
this.setData('NJ_game_select', {
pageIdxMap: gameSelectData.pageIdxMap,
folderId: gameSelectData.folderId,
courseId: gameSelectData.courseId,
partLength: gameSelectData.partLength,
step: gameSelectData.step,
currentPageIdx: gameSelectData.currentPageIdx,
currentPartIdx: gameSelectData.currentPartIdx + 1
});
} else {
console.log('else');
this.setData('NJ_game_select', {
pageIdxMap: gameSelectData.pageIdxMap,
folderId: gameSelectData.folderId,
courseId: gameSelectData.courseId,
partLength: gameSelectData.partLength,
step: 0,
currentPageIdx: gameSelectData.currentPageIdx + 1,
currentPartIdx: 0
});
}
this.loadOnlineCourseWare(gameSelectData.courseId);
}
async isLastPart() {
const gameSelectData = this.getData('NJ_game_select');
const pageFirstIdx = gameSelectData.pageIdxMap.findIndex(num => num == gameSelectData.currentPageIdx);
if (pageFirstIdx + gameSelectData.currentPartIdx == gameSelectData.partLength - 1) {
return true;
}
return false;
}
async playGetParterAnim() {
const animData = this.getData('NJ_game_select: partnerData');
// const animData = {
// havePic: "http://staging-teach.cdn.ireadabc.com/7a23e43f8ec4964e3feb9709ec553fd4.png",
// skeJsonData: {
// url: "http://staging-teach.cdn.ireadabc.com/5069b9316d9b69705281752f03b47901.json",
// name: "mao_ske.json"
// },
// texJsonData: {
// url: "http://staging-teach.cdn.ireadabc.com/3bbb72fd8ad3c02aa1df8d3785f4b34f.json",
// name: "mao_tex.json"
// },
// texPngData: {
// url: "http://staging-teach.cdn.ireadabc.com/c130de476dac5e9bbd71f92b2711d3ba.png",
// name: "mao_tex.png"
// },
// }
cc.assetManager.preloadAny({ url: animData.havePic });
const coolcat = cc.find('middleLayer/coolcat');
await asyncLoadDragonBoneAnime(coolcat, animData);
const animaNode = coolcat['animaNode'];
animaNode.scale = 0.6;
animaNode.getComponent(dragonBones.ArmatureDisplay).playAnimation('normal', -1);
const widget: cc.Widget = animaNode.addComponent(cc.Widget);
widget.isAlignBottom = true;
widget.isAlignRight = true;
widget.right = 750;
widget.bottom = 510;
coolcat.active = true;
const light = cc.find('middleLayer/coolcat/light');
light.active = true;
light.stopAllActions();
const lightTween = cc.tween(light)
.set({ opacity: 0 })
.by(1, { opacity: 255, angle: 60 })
.repeatForever()
.start();
// 胜利音效
this.playLocalAudio("win").then();
const star = cc.find('middleLayer/coolcat/star');
star.active = true;
star.getComponent(dragonBones.ArmatureDisplay).playAnimation('normal', 1);
cc.assetManager.loadRemote(animData.havePic, async (err, res) => {
const apple = cc.find('middleLayer/coolcat/apple');
apple.active = true;
apple.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(res);
cc.tween(apple)
.set({ scale: 0 })
.to(0.5, { scale: 1 }, { easing: 'backOut' })
.to(0.1, { angle: 20 })
.to(0.2, { angle: -20 })
.to(0.1, { angle: 0 })
.call(() => {
lightTween.stop();
cc.tween(light)
.to(0.2, { opacity: 0 })
.start();
})
.delay(0.2)
.to(1, { x: 280, y: -270, scale: 0.3 }, { easing: 'quadInOut' })
.to(0.1, { angle: 20 })
.to(0.2, { angle: -20 })
.to(0.1, { angle: 0 })
.call(() => {
this.showConfirm('还想再来一次吗?', () => {
// 识别页
this.hideGetParterAnim();
const gameSelectData = this.getData('NJ_game_select');
this.setData('NJ_game_select', {
pageIdxMap: gameSelectData.pageIdxMap,
folderId: gameSelectData.folderId,
courseId: gameSelectData.courseId,
partLength: gameSelectData.partLength,
step: 0,
currentPageIdx: 0,
currentPartIdx: 0
});
this.loadOnlineCourseWare(gameSelectData.courseId);
}, () => {
// 潜水艇页
this.hideGetParterAnim();
cc.find('middleLayer/BtnRight').active = false;
cc.find('middleLayer/BtnLeft').active = false;
cc.find('middleLayer/ExitBtn').active = false;
const idx = this.getData('NJ_menu_select_idx');
if (idx == '0') {
this.setData("NJ_game_select", {
step: 0,
currentPageIdx: 0,
currentPartIdx: 0
});
this.loadOnlineBundle('NJ_QianShuiTing');
} else if (idx == '1') {
this.loadOnlineBundle('NJ_ShaMo');
} else if (idx == '2') {
this.loadOnlineBundle('NJ_NongChang');
}
});
})
.start();
});
}
hideGetParterAnim() {
const coolcat = cc.find('middleLayer/coolcat');
coolcat.active = false;
const apple = cc.find('middleLayer/coolcat/apple');
apple.active = false;
apple.setPosition(0, 0);
const light = cc.find('middleLayer/coolcat/light');
light.active = false;
const star = cc.find('middleLayer/coolcat/star');
star.active = false;
} }
saveLastGameData(callback) { saveLastGameData(callback) {
...@@ -714,16 +534,9 @@ export default class NewClass extends middleLayerBase { ...@@ -714,16 +534,9 @@ export default class NewClass extends middleLayerBase {
this.loadOnlineBundle('NJ_MonkyTree'); this.loadOnlineBundle('NJ_MonkyTree');
} }
} }
if (this.courseItem && this.showConfirm("还没有完成哦!确定离开吗?", () => {
(this.courseItem.template_name == "NJ_game_select" || this.courseItem.template_name == "NJ_BookTable")
) {
// 如果是纸书索引页面则直接返回
exit(); exit();
} else { });
this.showConfirm("还没有完成哦!确定离开吗?", () => {
exit();
});
}
} }
initListener() { initListener() {
......
...@@ -27,6 +27,7 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -27,6 +27,7 @@ export abstract class middleLayerBase extends cc.Component {
} }
callNetworkApiPost(uri, data, callBack) { callNetworkApiPost(uri, data, callBack) {
uri = uri.replace("/oxford/", "/oxfordlite/");
this.getBaseUrl((baseUrl) => { this.getBaseUrl((baseUrl) => {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
const url = `${baseUrl}${uri}`; const url = `${baseUrl}${uri}`;
...@@ -42,6 +43,7 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -42,6 +43,7 @@ export abstract class middleLayerBase extends cc.Component {
} }
callNetworkApiGet(uri, data, callBack) { callNetworkApiGet(uri, data, callBack) {
uri = uri.replace("/oxford/", "/oxfordlite/");
this.getBaseUrl((baseUrl) => { this.getBaseUrl((baseUrl) => {
let queryStr = '?'; let queryStr = '?';
const params = []; const params = [];
...@@ -64,12 +66,15 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -64,12 +66,15 @@ export abstract class middleLayerBase extends cc.Component {
}); });
} }
ORG_ID;
async getBaseUrl(callback) { async getBaseUrl(callback) {
const engineInfo = await this.getEngineInfo(); const engineInfo = await this.getEngineInfo();
const { isDev } = JSON.parse(engineInfo); const { isDev } = JSON.parse(engineInfo);
if (isDev == 1) { if (isDev == 1) {
this.ORG_ID = 513;
callback('http://staging-openapi.iteachabc.com'); callback('http://staging-openapi.iteachabc.com');
} else { } else {
this.ORG_ID = 512;
callback('http://openapi.iteachabc.com'); callback('http://openapi.iteachabc.com');
} }
} }
......
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