|
@@ -10,12 +10,14 @@ const {ccclass, property} = cc._decorator
|
|
|
export class VerifyUI extends BaseUI {
|
|
|
verifyNum1: number
|
|
|
verifyNum2: number
|
|
|
+ verifyNum3: number
|
|
|
editBox: cc.EditBox
|
|
|
onShow(args, fromUI: number) {
|
|
|
- this.verifyNum1 = Math.randomRangeInt(1, 3)
|
|
|
+ this.verifyNum1 = Math.randomRangeInt(2, 4)
|
|
|
this.verifyNum2 = Math.randomRangeInt(10, 20)
|
|
|
- ccUtils.setLabel(this.verifyNum1.toString(), this.node, 'num1')
|
|
|
- ccUtils.setLabel(this.verifyNum2.toString(), this.node, 'num2')
|
|
|
+ this.verifyNum3 = this.verifyNum1 * this.verifyNum2
|
|
|
+ ccUtils.setLabel(this.verifyNum3.toString(), this.node, 'num1')
|
|
|
+ ccUtils.setLabel(this.verifyNum1.toString(), this.node, 'num2')
|
|
|
this.editBox = cc.find('editBox', this.node).getComponent(cc.EditBox)
|
|
|
this.editBox.string = ''
|
|
|
}
|
|
@@ -24,7 +26,7 @@ export class VerifyUI extends BaseUI {
|
|
|
}
|
|
|
onVerifyEdit() {
|
|
|
let answer = parseInt(this.editBox.string)
|
|
|
- if (answer == this.verifyNum1 * this.verifyNum2) {
|
|
|
+ if (answer == this.verifyNum2) {
|
|
|
Mgr.ui.tip('回答正确')
|
|
|
Mgr.ui.show(UI.RoleSetUI)
|
|
|
Mgr.ui.hideBaseUI(this)
|