Commit 4935c781 authored by 李维's avatar 李维

增加家长验证

parent ec0811ad
...@@ -169,18 +169,21 @@ export default class NewClass extends middleLayerBase { ...@@ -169,18 +169,21 @@ export default class NewClass extends middleLayerBase {
// 家长验证 // 家长验证
parentProtect(callback) { parentProtect(callback) {
const parentProtectNode = cc.find(`middleLayer/iosActiveLayer/parent_protect`); const parentProtectNode = cc.find(`middleLayer/iosActiveLayer/parent_protect`);
const num1Node = cc.find("/num1", parentProtectNode); const num1Node = cc.find("/num_1", parentProtectNode);
const num2Node = cc.find("/num2", parentProtectNode); const num2Node = cc.find("/num_2", parentProtectNode);
const okBtn = cc.find("/active", parentProtectNode); const okBtn = cc.find("/active", parentProtectNode);
const input = cc.find("/result", parentProtectNode).getComponent(cc.EditBox); const input = cc.find("/result", parentProtectNode).getComponent(cc.EditBox);
const num1 = Math.ceil(Math.random() * 10); const num1 = Math.floor(Math.random() * 10);
const num2 = Math.ceil(Math.random() * 10); const num2 = Math.floor(Math.random() * 10);
const res = num1 * num2; const res = num1 * num2;
parentProtectNode.active = true;
cc.find(`num_${num1}`, num1Node).active = true; cc.find(`num_${num1}`, num1Node).active = true;
cc.find(`num_${num2}`, num2Node).active = true; cc.find(`num_${num2}`, num2Node).active = true;
okBtn.off("click");
okBtn.on("click", ()=>{ okBtn.on("click", ()=>{
const activeCode = input.textLabel.string; const activeCode = input.textLabel.string;
if(activeCode == res + "") { if(activeCode == res + "") {
......
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