Commit 687d2a78 authored by unknown's avatar unknown

数独加了一个还原按钮

parent 2b156c67
......@@ -67,6 +67,10 @@ export class SudokuCtr extends Component {
this.gameStart();
}
onResetBtn(){
director.emit("resetItem");
}
onDestroy() {
director.off("sk_item_click", this.onItemClick, this);
director.off("begin_countdown_end");
......
......@@ -35,8 +35,22 @@ export class SudokuItemCtr extends Component {
}
onItemClick() {
if (this.itemType == SK_ITEM_TYPE.INVARIABLE) return;
// if (this.itemType == SK_ITEM_TYPE.INVARIABLE) return;
director.emit("sk_item_click", this);
director.on("resetItem", this.resetItem, this);
}
resetItem() {
if (this.itemType == SK_ITEM_TYPE.INVARIABLE) {
this.numLab.string = this.rightNumStr;
}
else {
this.numLab.string = "";
}
}
onDestroy() {
director.off("resetItem", this.resetItem, this);
}
getItemType() {
......@@ -60,14 +74,14 @@ export class SudokuItemCtr extends Component {
this.setNumStr(numStr);
this.rightNumStr = numStr;
this.bgSpr.color = color;
if(type == SK_ITEM_TYPE.VARIABLE){
if (type == SK_ITEM_TYPE.VARIABLE) {
this.setNumStr("");
}
this.posIfo = posIfo;
this.posIfo.target = this.node;
}
isRight(){
isRight() {
return this.numLab.string == this.rightNumStr;
}
......
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