补充关卡功能
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { G_ShowScoreTips } from "../views/GUITips";
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@regClass()
|
||||
@@ -14,10 +16,12 @@ export class Block extends Laya.Script {
|
||||
public YGroup: number = 0;
|
||||
|
||||
private selected: boolean = false
|
||||
private newSelect: boolean = false
|
||||
private preset: boolean = false//预设格子
|
||||
private checked: boolean = false//正确格子
|
||||
private showNumber: number = 0;
|
||||
private correctNumber: number = 0;
|
||||
private score: number = 0
|
||||
private note_numbers: Array<number> = new Array()
|
||||
|
||||
private label_show: Laya.Label;
|
||||
@@ -46,6 +50,8 @@ export class Block extends Laya.Script {
|
||||
|
||||
public setSelected(selected: boolean): void {
|
||||
this.selected = selected
|
||||
if (selected)
|
||||
this.newSelect = true
|
||||
this.updateBlock()
|
||||
}
|
||||
|
||||
@@ -67,6 +73,7 @@ export class Block extends Laya.Script {
|
||||
this.checked = preset;
|
||||
this.showNumber = showNumber;
|
||||
this.correctNumber = correctNumber;
|
||||
this.score = 0
|
||||
this.updateBlock();
|
||||
}
|
||||
|
||||
@@ -82,22 +89,35 @@ export class Block extends Laya.Script {
|
||||
return this.showNumber;
|
||||
}
|
||||
|
||||
public getCorrectNumber(): number {
|
||||
return this.correctNumber;
|
||||
}
|
||||
|
||||
public setShowNumber(showNumber: number): boolean {
|
||||
if (this.checked == false) {
|
||||
if (showNumber == this.correctNumber)
|
||||
this.checked = true;
|
||||
this.showNumber = showNumber;
|
||||
if (this.checked || showNumber == 0)//正确或者擦除
|
||||
if (this.checked || showNumber == 0) {//正确或者擦除
|
||||
this.note_numbers = new Array()
|
||||
}
|
||||
this.score = 0
|
||||
if (this.newSelect) {
|
||||
this.newSelect = false
|
||||
if (this.checked) {
|
||||
this.score = 150
|
||||
G_ShowScoreTips(this.score.toString(), this.owner)
|
||||
}
|
||||
}
|
||||
this.updateBlock();
|
||||
}
|
||||
return this.checked
|
||||
}
|
||||
|
||||
public getCorrectNumber(): number {
|
||||
return this.correctNumber;
|
||||
}
|
||||
|
||||
public getScore(): number {
|
||||
return this.score
|
||||
}
|
||||
|
||||
public addNoteNumber(noteNumber: number): void {
|
||||
if (this.note_numbers.indexOf(noteNumber) < 0) {
|
||||
this.note_numbers.push(noteNumber)
|
||||
|
||||
Reference in New Issue
Block a user