优化棋盘表现问题

This commit is contained in:
2025-05-30 11:02:53 +08:00
parent 74d686cf92
commit 6d4bb79a45
6 changed files with 9427 additions and 6083 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -21,9 +21,11 @@ export class Block extends Laya.Script {
public YGroup: number = 0
private sprite_show: Laya.Sprite
private blockSize: number
private label_show: Laya.Label
private tips_bgs: Array<Laya.Sprite> = []
private tips_labels: Array<Laya.Label> = []
private tipsSize: number
private selected: boolean = false
@@ -36,6 +38,7 @@ export class Block extends Laya.Script {
this.YGroup = YGroup
this.sprite_show = this.owner.getChildByName("Sprite") as Laya.Sprite
this.blockSize = this.sprite_show.width
this.label_show = this.owner.getChildByName("label_show") as Laya.Label
const notes = this.owner.getChildByName("notes")
@@ -47,6 +50,7 @@ export class Block extends Laya.Script {
const Label = hbox.getChildAt(j).getChildByName("Label") as Laya.Label
Label.text = ""
this.tips_labels.push(Label)
this.tipsSize = sp.width
}
}
@@ -59,18 +63,15 @@ export class Block extends Laya.Script {
}
public setBlockColor(color: string, alpha: number = 1, animated: boolean = false, completedColor: string = "", completedAlpha: number = 1): void {
let blockSize = 112
if (config.H_SCREEN)
blockSize = 90
this.sprite_show.graphics.clear()
this.sprite_show.graphics.drawRect(0, 0, blockSize, blockSize, color)
this.sprite_show.graphics.drawRect(0, 0, this.blockSize, this.blockSize, color)
if (animated) {
this.sprite_show.alpha = 0
Laya.Tween.to(this.sprite_show, { alpha }, 200, Laya.Ease.linearIn)
Laya.Tween.to(this.sprite_show, { alpha: 0 }, 300, Laya.Ease.linearIn, null, 200)
Laya.Tween.to(this.sprite_show, { alpha }, 100, Laya.Ease.linearIn, Laya.Handler.create(this, () => {
this.sprite_show.graphics.clear()
this.sprite_show.graphics.drawRect(0, 0, blockSize, blockSize, completedColor)
this.sprite_show.graphics.drawRect(0, 0, this.blockSize, this.blockSize, completedColor)
this.sprite_show.alpha = completedAlpha
}), 500)
} else {
@@ -94,14 +95,11 @@ export class Block extends Laya.Script {
}
public setTipsBgColor(visible: boolean, noteNumber: number = 0, color: string = "", alpha: number = 1): void {
let blockSize = 37
if (config.H_SCREEN)
blockSize = 30
if (visible) {
const obj = this.tips_bgs[noteNumber - 1]
obj.visible = true
obj.graphics.clear()
obj.graphics.drawRect(0, 0, blockSize, blockSize, color)
obj.graphics.drawRect(0, 0, this.tipsSize, this.tipsSize, color)
obj.alpha = alpha
} else {
for (let i = 0; i < this.tips_bgs.length; i++) {
@@ -125,7 +123,7 @@ export class Block extends Laya.Script {
if (this.data.get_checked()) {
this.data.set_score(score)
if (score > 0)
G_ShowScoreTips(score.toString(), this.owner)
G_ShowScoreTips(`+${score}`, this.owner)
} else {
if (this.data.get_score() !== 0)
this.data.set_score(0)

View File

@@ -13,9 +13,9 @@ export class Candy extends Laya.Script {
public onInit(handler: any, func: any): void {
this.owner.on(Laya.Event.CLICK, handler, func)
this.show_sprite = this.owner.getChildByName("Sprite") as Laya.Sprite
this.label_show = this.show_sprite.getChildByName("label") as Laya.Label
this.label_left = this.show_sprite.getChildByName("label_left") as Laya.Label
this.show_sprite = this.owner.getChildByName("offset").getChildByName("Sprite") as Laya.Sprite
this.label_show = this.owner.getChildByName("offset").getChildByName("label") as Laya.Label
this.label_left = this.owner.getChildByName("offset").getChildByName("label_left") as Laya.Label
}
public setNoteStatus(note_open: boolean) {

View File

@@ -499,7 +499,7 @@ export class Stage extends Laya.Script {
public onClickCandy(evt: Laya.Event): void {
const candy = evt.target.getComponent(Candy)
this.onApplyCandy(candy.get_show(), false)
const sp = evt.target.getChildByName("Sprite") as Laya.Sprite
const sp = evt.target.getChildByName("offset") as Laya.Sprite
Laya.Tween.to(sp, { scaleX: 0.9, scaleY: 0.9 }, 100, Laya.Ease.linearIn)
Laya.Tween.to(sp, { scaleX: 1, scaleY: 1 }, 100, Laya.Ease.linearInOut, null, 100)
}

View File

@@ -32,6 +32,8 @@ export class CalendarUnit extends Laya.Script {
@property(Laya.Sprite)
public sprite_pie: Laya.Sprite
private pieSize: number
@property(Laya.Sprite)
public obj_mask: Laya.Sprite
@@ -46,7 +48,7 @@ export class CalendarUnit extends Laya.Script {
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
onAwake(): void {
this.pieSize = this.sprite_pie.width /2
}
public onInit(label_obj: Laya.Label): void {
@@ -94,10 +96,6 @@ export class CalendarUnit extends Laya.Script {
this.obj_star.visible = this.progress >= 1
let blockSize = 48
if (config.H_SCREEN)
blockSize = 33
if (this.selected) {
this.label_show.color = "#ffffff"
this.obj_selected.visible = true
@@ -105,7 +103,7 @@ export class CalendarUnit extends Laya.Script {
this.obj_pie.visible = true
this.obj_mask.visible = true
this.sprite_pie.graphics.clear()
this.sprite_pie.graphics.drawPie(blockSize, blockSize, blockSize, 0, 360 * this.progress, "#ffffff")
this.sprite_pie.graphics.drawPie(this.pieSize, this.pieSize, this.pieSize, 0, 360 * this.progress, "#ffffff")
this.sprite_mask.graphics.clear()
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#1d5cdc")
} else {
@@ -119,7 +117,7 @@ export class CalendarUnit extends Laya.Script {
this.obj_pie.visible = true
this.obj_mask.visible = true
this.sprite_pie.graphics.clear()
this.sprite_pie.graphics.drawPie(blockSize, blockSize, blockSize, 0, 360 * this.progress, "#2d3138")
this.sprite_pie.graphics.drawPie(this.pieSize, this.pieSize, this.pieSize, 0, 360 * this.progress, "#2d3138")
this.sprite_mask.graphics.clear()
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#ffffff")
} else {