优化棋盘表现问题
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -21,9 +21,11 @@ export class Block extends Laya.Script {
|
|||||||
public YGroup: number = 0
|
public YGroup: number = 0
|
||||||
|
|
||||||
private sprite_show: Laya.Sprite
|
private sprite_show: Laya.Sprite
|
||||||
|
private blockSize: number
|
||||||
private label_show: Laya.Label
|
private label_show: Laya.Label
|
||||||
private tips_bgs: Array<Laya.Sprite> = []
|
private tips_bgs: Array<Laya.Sprite> = []
|
||||||
private tips_labels: Array<Laya.Label> = []
|
private tips_labels: Array<Laya.Label> = []
|
||||||
|
private tipsSize: number
|
||||||
|
|
||||||
private selected: boolean = false
|
private selected: boolean = false
|
||||||
|
|
||||||
@@ -36,6 +38,7 @@ export class Block extends Laya.Script {
|
|||||||
this.YGroup = YGroup
|
this.YGroup = YGroup
|
||||||
|
|
||||||
this.sprite_show = this.owner.getChildByName("Sprite") as Laya.Sprite
|
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
|
this.label_show = this.owner.getChildByName("label_show") as Laya.Label
|
||||||
|
|
||||||
const notes = this.owner.getChildByName("notes")
|
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
|
const Label = hbox.getChildAt(j).getChildByName("Label") as Laya.Label
|
||||||
Label.text = ""
|
Label.text = ""
|
||||||
this.tips_labels.push(Label)
|
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 {
|
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.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) {
|
if (animated) {
|
||||||
this.sprite_show.alpha = 0
|
this.sprite_show.alpha = 0
|
||||||
Laya.Tween.to(this.sprite_show, { alpha }, 200, Laya.Ease.linearIn)
|
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: 0 }, 300, Laya.Ease.linearIn, null, 200)
|
||||||
Laya.Tween.to(this.sprite_show, { alpha }, 100, Laya.Ease.linearIn, Laya.Handler.create(this, () => {
|
Laya.Tween.to(this.sprite_show, { alpha }, 100, Laya.Ease.linearIn, Laya.Handler.create(this, () => {
|
||||||
this.sprite_show.graphics.clear()
|
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
|
this.sprite_show.alpha = completedAlpha
|
||||||
}), 500)
|
}), 500)
|
||||||
} else {
|
} else {
|
||||||
@@ -94,14 +95,11 @@ export class Block extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setTipsBgColor(visible: boolean, noteNumber: number = 0, color: string = "", alpha: number = 1): void {
|
public setTipsBgColor(visible: boolean, noteNumber: number = 0, color: string = "", alpha: number = 1): void {
|
||||||
let blockSize = 37
|
|
||||||
if (config.H_SCREEN)
|
|
||||||
blockSize = 30
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
const obj = this.tips_bgs[noteNumber - 1]
|
const obj = this.tips_bgs[noteNumber - 1]
|
||||||
obj.visible = true
|
obj.visible = true
|
||||||
obj.graphics.clear()
|
obj.graphics.clear()
|
||||||
obj.graphics.drawRect(0, 0, blockSize, blockSize, color)
|
obj.graphics.drawRect(0, 0, this.tipsSize, this.tipsSize, color)
|
||||||
obj.alpha = alpha
|
obj.alpha = alpha
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < this.tips_bgs.length; i++) {
|
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()) {
|
if (this.data.get_checked()) {
|
||||||
this.data.set_score(score)
|
this.data.set_score(score)
|
||||||
if (score > 0)
|
if (score > 0)
|
||||||
G_ShowScoreTips(score.toString(), this.owner)
|
G_ShowScoreTips(`+${score}`, this.owner)
|
||||||
} else {
|
} else {
|
||||||
if (this.data.get_score() !== 0)
|
if (this.data.get_score() !== 0)
|
||||||
this.data.set_score(0)
|
this.data.set_score(0)
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ export class Candy extends Laya.Script {
|
|||||||
|
|
||||||
public onInit(handler: any, func: any): void {
|
public onInit(handler: any, func: any): void {
|
||||||
this.owner.on(Laya.Event.CLICK, handler, func)
|
this.owner.on(Laya.Event.CLICK, handler, func)
|
||||||
this.show_sprite = this.owner.getChildByName("Sprite") as Laya.Sprite
|
this.show_sprite = this.owner.getChildByName("offset").getChildByName("Sprite") as Laya.Sprite
|
||||||
this.label_show = this.show_sprite.getChildByName("label") as Laya.Label
|
this.label_show = this.owner.getChildByName("offset").getChildByName("label") as Laya.Label
|
||||||
this.label_left = this.show_sprite.getChildByName("label_left") as Laya.Label
|
this.label_left = this.owner.getChildByName("offset").getChildByName("label_left") as Laya.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
public setNoteStatus(note_open: boolean) {
|
public setNoteStatus(note_open: boolean) {
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ export class Stage extends Laya.Script {
|
|||||||
public onClickCandy(evt: Laya.Event): void {
|
public onClickCandy(evt: Laya.Event): void {
|
||||||
const candy = evt.target.getComponent(Candy)
|
const candy = evt.target.getComponent(Candy)
|
||||||
this.onApplyCandy(candy.get_show(), false)
|
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: 0.9, scaleY: 0.9 }, 100, Laya.Ease.linearIn)
|
||||||
Laya.Tween.to(sp, { scaleX: 1, scaleY: 1 }, 100, Laya.Ease.linearInOut, null, 100)
|
Laya.Tween.to(sp, { scaleX: 1, scaleY: 1 }, 100, Laya.Ease.linearInOut, null, 100)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ export class CalendarUnit extends Laya.Script {
|
|||||||
@property(Laya.Sprite)
|
@property(Laya.Sprite)
|
||||||
public sprite_pie: Laya.Sprite
|
public sprite_pie: Laya.Sprite
|
||||||
|
|
||||||
|
private pieSize: number
|
||||||
|
|
||||||
@property(Laya.Sprite)
|
@property(Laya.Sprite)
|
||||||
public obj_mask: Laya.Sprite
|
public obj_mask: Laya.Sprite
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ export class CalendarUnit extends Laya.Script {
|
|||||||
|
|
||||||
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
|
this.pieSize = this.sprite_pie.width /2
|
||||||
}
|
}
|
||||||
|
|
||||||
public onInit(label_obj: Laya.Label): void {
|
public onInit(label_obj: Laya.Label): void {
|
||||||
@@ -94,10 +96,6 @@ export class CalendarUnit extends Laya.Script {
|
|||||||
|
|
||||||
this.obj_star.visible = this.progress >= 1
|
this.obj_star.visible = this.progress >= 1
|
||||||
|
|
||||||
let blockSize = 48
|
|
||||||
if (config.H_SCREEN)
|
|
||||||
blockSize = 33
|
|
||||||
|
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
this.label_show.color = "#ffffff"
|
this.label_show.color = "#ffffff"
|
||||||
this.obj_selected.visible = true
|
this.obj_selected.visible = true
|
||||||
@@ -105,7 +103,7 @@ export class CalendarUnit extends Laya.Script {
|
|||||||
this.obj_pie.visible = true
|
this.obj_pie.visible = true
|
||||||
this.obj_mask.visible = true
|
this.obj_mask.visible = true
|
||||||
this.sprite_pie.graphics.clear()
|
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.clear()
|
||||||
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#1d5cdc")
|
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#1d5cdc")
|
||||||
} else {
|
} else {
|
||||||
@@ -119,7 +117,7 @@ export class CalendarUnit extends Laya.Script {
|
|||||||
this.obj_pie.visible = true
|
this.obj_pie.visible = true
|
||||||
this.obj_mask.visible = true
|
this.obj_mask.visible = true
|
||||||
this.sprite_pie.graphics.clear()
|
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.clear()
|
||||||
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#ffffff")
|
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#ffffff")
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user