Commit 8008a076 authored by liujiangnan's avatar liujiangnan

feat: 加锁

parent 7fdcd5bf
...@@ -79,6 +79,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -79,6 +79,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.find("Canvas/usercenter/view/content/scollpage/learning").getComponent(cc.RichText).string = `<color=#138977>当前正在学习</c> <color=#ef8d36>${gameNames[0]} - ${gameNames[1]}</color>`; cc.find("Canvas/usercenter/view/content/scollpage/learning").getComponent(cc.RichText).string = `<color=#138977>当前正在学习</c> <color=#ef8d36>${gameNames[0]} - ${gameNames[1]}</color>`;
} }
// 解锁的级别
} }
// 学习小结 // 学习小结
......
...@@ -80,6 +80,17 @@ export default class NewClass extends cc.Component { ...@@ -80,6 +80,17 @@ export default class NewClass extends cc.Component {
const node = cc.find("Canvas/learnreport"); const node = cc.find("Canvas/learnreport");
cc.find("typeLabel", node).getComponent(cc.Label).string = this.reportObj[this.reportType]; cc.find("typeLabel", node).getComponent(cc.Label).string = this.reportObj[this.reportType];
// 设置每个级别激活状态(是否显示锁头)
const levelIds = levels[this.reportType].map(item => item.id);
const unLocks = this.getUnlockSyllabuses();
for (let i = 1; i < 5; i++) {
const id = levelIds[i];
if (id && unLocks.includes(id)) {
cc.find(`level${i+1}/lock_1`, node).active = false;
} else {
cc.find(`level${i+1}/lock_1`, node).active = true;
}
}
// 激活索引为0的Level // 激活索引为0的Level
await this.drawPageItems(0); await this.drawPageItems(0);
} }
...@@ -153,6 +164,11 @@ export default class NewClass extends cc.Component { ...@@ -153,6 +164,11 @@ export default class NewClass extends cc.Component {
return; return;
} }
this.userInfo = JSON.parse(userInfo); this.userInfo = JSON.parse(userInfo);
const lockedNode = cc.find(`Canvas/learnreport/level${index+1}/lock_1`);
if (lockedNode && lockedNode.active) {
return;
}
this.activeLevelIndex(parseInt(index)); this.activeLevelIndex(parseInt(index));
await this.drawPageItems(parseInt(index)); await this.drawPageItems(parseInt(index));
......
{
"ver": "2.3.5",
"uuid": "45220650-c98e-4c32-95b5-564808f0ea73",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 35,
"height": 41,
"platformSettings": {},
"subMetas": {
"lock_1": {
"ver": "1.0.4",
"uuid": "9d2b8f92-9518-494f-a0d6-f93d4a5d25c4",
"rawTextureUuid": "45220650-c98e-4c32-95b5-564808f0ea73",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 35,
"height": 41,
"rawWidth": 35,
"rawHeight": 41,
"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