import GameModel from "../ts/core/GameModel"; import MsgAlert from "../ts/game/msg/MsgAlert"; cc.Class({ extends: cc.Component, properties: { edit: cc.EditBox, }, onLoad () { }, start () { }, /* * 設置成功回調 */ setCallback (fun) { this.fun_ok = fun; }, /* * 輸入驗證 */ onEditEnd () { }, /* * 確定 */ onConfirmClick () { if (this.edit.string == GameModel.player.safe_password) { if (this.fun_ok) { this.fun_ok(); } this.node.destroy(); } else { MsgAlert.addMsg('輸入密碼錯誤!'); this.edit.string = ''; } }, /* * 取消 */ onCancelClick () { this.node.destroy(); }, });