import { G_ShowScoreTips } from "../views/GUITips"; import { DOBlock } from "./DOBlock"; const { regClass, property } = Laya; @regClass() export class Block extends Laya.Script { declare owner : Laya.Button; @property(Number) public XIndex: number = 0; @property(Number) public YIndex: number = 0; @property(Number) public XGroup: number = 0; @property(Number) public YGroup: number = 0; private label_show: Laya.Label; private tips_labels: Array = new Array(); private animator: Laya.Animator2D private selected: boolean = false private newSelect: boolean = false private data: DOBlock public onInit(XIndex: number, YIndex: number, XGroup: number, YGroup: number, label_obj: Laya.Box, handler: any, func: any): void { this.XIndex = XIndex; this.YIndex = YIndex; this.XGroup = XGroup; this.YGroup = YGroup; this.label_show = label_obj.getChildByName("label_show") as Laya.Label var VBox = label_obj.getChildByName("VBox") for (var i=0; i{ this.animator.stop() }) } } public setBlock(data: DOBlock): void { this.data = data; this.updateBlock(); } public getData(): DOBlock { return this.data } public setShowNumber(showNumber: number): boolean { if (this.data.get_checked() == false) { this.data.set_show(showNumber) var score: number = 0 if (this.newSelect) { this.newSelect = false if (this.data.get_checked()) { score = 150 this.data.set_score(score) G_ShowScoreTips(score.toString(), this.owner) } } this.updateBlock() } return this.data.get_checked() } public addNoteNumber(noteNumber: number): void { if (this.data.add_note(noteNumber)) { this.updateBlock() } } updateBlock(): void { for (var i=0; i 0) { this.label_show.text = this.data.get_show().toString() if (this.data.get_checked()) { this.label_show.color = "#000000" } else { this.label_show.color = "#ff0000" } } else { this.label_show.text = ""; var note_numbers = this.data.get_notes() for (var i=0; i