2025-04-24 17:03:28 +08:00

52 lines
655 B
JavaScript

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();
},
});