代码格式化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Stage } from "./Stage"
|
||||
import type { Stage } from "./Stage"
|
||||
|
||||
const { regClass } = Laya
|
||||
|
||||
@@ -22,26 +22,26 @@ export class Candy extends Laya.Script {
|
||||
|
||||
public onInit(handler: any): void {
|
||||
this._stage = handler
|
||||
this.owner.on(Laya.Event.CLICK, this, ()=>{
|
||||
this.owner.on(Laya.Event.CLICK, this, () => {
|
||||
if (this.available === false)
|
||||
return
|
||||
this._stage.onApplyCandy(this.show, false)
|
||||
})
|
||||
|
||||
this.owner.on(Laya.Event.MOUSE_DOWN, this, ()=>{
|
||||
this.owner.on(Laya.Event.MOUSE_DOWN, this, () => {
|
||||
if (this.available === false)
|
||||
return
|
||||
Laya.Tween.to(this.bg_sprite, { alpha: 0 }, 200)
|
||||
Laya.Tween.to(this.mask_sprite, { alpha: 0.1 }, 200)
|
||||
Laya.Tween.to(this.offset, { scaleX: 0.92, scaleY: 0.92 }, 200)
|
||||
})
|
||||
this.owner.on(Laya.Event.MOUSE_UP, this, ()=>{
|
||||
})
|
||||
this.owner.on(Laya.Event.MOUSE_UP, this, () => {
|
||||
if (this.available === false)
|
||||
return
|
||||
Laya.Tween.to(this.bg_sprite, { alpha: 0.12 }, 200)
|
||||
Laya.Tween.to(this.mask_sprite, { alpha: 0 }, 200)
|
||||
Laya.Tween.to(this.offset, { scaleX: 1, scaleY: 1 }, 200)
|
||||
})
|
||||
})
|
||||
this.owner.on(Laya.Event.MOUSE_OVER, this, () => {
|
||||
if (this.available === false)
|
||||
return
|
||||
|
||||
@@ -13,7 +13,6 @@ export class Difficulty extends Laya.Script {
|
||||
private offset: Laya.Box
|
||||
// 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||
onAwake(): void {
|
||||
|
||||
this.offset = this.owner.getChildByName("bottom").getChildByName("offset") as Laya.Box
|
||||
this.offset.y = this.offset.width
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ export class GameDone extends Laya.Script {
|
||||
|
||||
onAwake(): void {
|
||||
ResourceManager.getInstance().loadTexture(respath.bg_done, this.bg)
|
||||
ResourceManager.getInstance().loadTexture(respath.bg_done_light, this.obj_light)
|
||||
ResourceManager.getInstance().loadTexture(respath.bg_done_top, this.obj_top)
|
||||
ResourceManager.getInstance().loadTexture(respath.bg_done_light, this.obj_light)
|
||||
ResourceManager.getInstance().loadTexture(respath.bg_done_top, this.obj_top)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star2, this.star1)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star2, this.star2)
|
||||
ResourceManager.getInstance().loadTexture(respath.icon_star2, this.star3)
|
||||
|
||||
@@ -54,7 +54,6 @@ export class UISequenceAnimation extends Laya.Script {
|
||||
} else {
|
||||
this.owner.skin = path
|
||||
}
|
||||
|
||||
|
||||
this.currentIndex++
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export class CalendarUnit extends Laya.Script {
|
||||
this.sprite_pie.graphics.clear()
|
||||
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(this.obj_mask.width/2, this.obj_mask.width/2, this.obj_mask.width/2, "#1d5cdc")
|
||||
this.sprite_mask.graphics.drawCircle(this.obj_mask.width / 2, this.obj_mask.width / 2, this.obj_mask.width / 2, "#1d5cdc")
|
||||
} else {
|
||||
this.obj_pie.visible = false
|
||||
this.obj_mask.visible = false
|
||||
@@ -113,7 +113,7 @@ export class CalendarUnit extends Laya.Script {
|
||||
this.sprite_pie.graphics.clear()
|
||||
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(this.obj_mask.width/2, this.obj_mask.width/2, this.obj_mask.width/2, "#ffffff")
|
||||
this.sprite_mask.graphics.drawCircle(this.obj_mask.width / 2, this.obj_mask.width / 2, this.obj_mask.width / 2, "#ffffff")
|
||||
} else {
|
||||
this.obj_pie.visible = false
|
||||
this.obj_mask.visible = false
|
||||
|
||||
@@ -76,12 +76,12 @@ export class TrophyRoom extends Laya.Script {
|
||||
label.text = years[i].toString()
|
||||
|
||||
for (let j = 2; j < cellCount + 1; j++) {
|
||||
const prefab = go.create()
|
||||
obj_year.addChild(prefab)
|
||||
const prefab = go.create()
|
||||
obj_year.addChild(prefab)
|
||||
}
|
||||
let index = -1
|
||||
for (let j = 1; j < cellCount + 1; j++) {
|
||||
let obj_cell = obj_year.getChildAt(j)
|
||||
const obj_cell = obj_year.getChildAt(j)
|
||||
const hbox = obj_cell.getChildByName("HBox")
|
||||
for (let k = 0; k < hbox.numChildren; k++) {
|
||||
const unit = hbox.getChildAt(k).getComponent(TrophyUnit)
|
||||
|
||||
Reference in New Issue
Block a user