添加序列帧动画

This commit is contained in:
2025-06-09 20:00:33 +08:00
parent ea0084b8c6
commit 62a69f1596
321 changed files with 1124 additions and 528 deletions

View File

@@ -49,11 +49,12 @@ export const respath = {
},
// ===============================
bg_done: "images/bg_done.png",
home_top_dc_bg_normal: "images/bg_dc_top1.png",
home_top_dc_bg_finish: "images/bg_dc_top2.png",
dc_top_bg_normal: "images/img_dc_bg2.png",
dc_top_bg_finish: "images/img_dc_finished.png",
dc_render_texture: "effect/dc_render_texture.rendertexture",
trophy_bg_light_gold: "trophys/img_trophy_bg_light_gold.png",
trophy_bg_light_grey: "trophys/img_trophy_bg_light_gray.png",

View File

@@ -33,11 +33,12 @@ export class ResourceManager {
this.resources.push({ url: respath.difficulty_ui_res })
}
this.resources.push({ url: respath.bg_done, type: Laya.Loader.IMAGE })
this.resources.push({ url: respath.home_top_dc_bg_normal, type: Laya.Loader.IMAGE })
this.resources.push({ url: respath.home_top_dc_bg_finish, type: Laya.Loader.IMAGE })
this.resources.push({ url: respath.dc_top_bg_normal, type: Laya.Loader.IMAGE })
this.resources.push({ url: respath.dc_top_bg_finish, type: Laya.Loader.IMAGE })
this.resources.push({ url: respath.dc_render_texture })
this.resources.push({ url: respath.trophy_bg_light_gold, type: Laya.Loader.IMAGE })
this.resources.push({ url: respath.trophy_bg_light_grey, type: Laya.Loader.IMAGE })

View File

@@ -13,6 +13,9 @@ const { regClass, property } = Laya
export class GameDone extends Laya.Script {
declare owner: Laya.Box
@property(Laya.Image)
public bg: Laya.Image
@property(Laya.Image)
public obj_light: Laya.Image
@@ -50,6 +53,9 @@ export class GameDone extends Laya.Script {
public btn_continue: Laya.Box
onAwake(): void {
ResourceManager.getInstance().loadTexture(respath.bg_done, this.bg)
this.owner.x = 0
this.owner.y = 0

View File

@@ -0,0 +1,62 @@
import { ResourceManager } from "../../models/ResourceManager";
const { regClass, property } = Laya;
@regClass()
export class UISequenceAnimation extends Laya.Script {
declare owner : Laya.Image;
@property(String)
public prefix: string;
@property(Number)
public beginIndex: number = 0
@property(Number)
public endIndex: number
@property(Boolean)
public playOnAwake: boolean = true
@property(Boolean)
public loop: boolean = false
private running: boolean = false
private currentIndex: number = 0
onAwake(): void {
if (this.playOnAwake) {
this.running = true
} else {
this.running = false
}
this.currentIndex = this.beginIndex
}
onLateUpdate(): void {
if (this.running) {
if (this.currentIndex > this.endIndex) {
this.currentIndex = this.beginIndex
if (this.loop === false) {
this.running = false
this.owner.visible = false
}
}
let endStr = this.currentIndex.toString()
if (this.currentIndex < 10) {
endStr = "00" + this.currentIndex
} else if (this.currentIndex < 100) {
endStr = "0" + this.currentIndex
}
let path = this.prefix + endStr + '.png'
// ResourceManager.getInstance().loadTexture(path, this.image)
this.owner.skin = path
this.currentIndex ++
}
}
onSetRunning(running: boolean): void {
this.running = running
}
}

View File

@@ -0,0 +1,3 @@
{
"uuid": "ca60d5cb-d801-434b-9e6a-7b0c738cb0e9"
}

View File

@@ -190,7 +190,6 @@ export class DailyChallenge extends Laya.Script {
const nowDay = new Date().getDate()
ResourceManager.getInstance().loadTexture(info.icon_res, this.trophy_icon)
ResourceManager.getInstance().loadTexture(respath.dc_render_texture, this.trophy_light)
// 设置背景
if (user.get_trophyRecord(info.year, info.month)) {
ResourceManager.getInstance().loadTexture(respath.dc_top_bg_finish, this.bg_dc)

View File

@@ -3,6 +3,7 @@ import { config } from "../../constants/config"
import { MONTH_LIST } from "../../models/DCManager"
import { ResourceManager } from "../../models/ResourceManager"
import { Utility_EaseOut_2 } from "../../utils/utility"
import { UISequenceAnimation } from "../common/UISequenceAnimation"
const { regClass, property } = Laya
@@ -28,9 +29,21 @@ export class TrophyClaim extends Laya.Script {
Laya.Tween.to(this.mask, {alpha: 0.8}, 600)
this.center = this.owner.getChildByName("center") as Laya.Box
this.center.scaleX = 0
this.center.scaleY = 0
Laya.Tween.to(this.center, {scaleX: 1, scaleY: 1}, 200, Utility_EaseOut_2, null, 200)
const light = this.center.getChildByName("light") as Laya.Image
light.scaleX = 0
light.scaleY = 0
Laya.Tween.to(light, {scaleX: 1, scaleY: 1}, 200, Utility_EaseOut_2, null, 200)
const trophy = this.center.getChildByName("trophy") as Laya.Image
trophy.scaleX = 0
trophy.scaleY = 0
Laya.Tween.to(trophy, {scaleX: 1, scaleY: 1}, 200, Utility_EaseOut_2, null, 200)
const blossom = trophy.getChildByName("blossom").getComponent(UISequenceAnimation)
Laya.timer.once(400, this, ()=>{
blossom.onSetRunning(true)
})
const label_titlle = this.center.getChildByName("label_titlle") as Laya.Label
label_titlle.alpha = 0