整理代码格式
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -10,13 +10,13 @@
|
|||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"lint": "eslint . --fix"
|
"lint": "eslint . --fix"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"bezier-easing": "^2.1.0",
|
||||||
|
"lottie-web": "^5.13.0"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^4.13.0",
|
"@antfu/eslint-config": "^4.13.0",
|
||||||
"eslint": "^9.26.0",
|
"eslint": "^9.26.0",
|
||||||
"eslint-plugin-format": "^1.0.1"
|
"eslint-plugin-format": "^1.0.1"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"bezier-easing": "^2.1.0",
|
|
||||||
"lottie-web": "^5.13.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,10 +70,9 @@ export class ResourceManager {
|
|||||||
console.log("预加载资源进度>>>>", resProg)
|
console.log("预加载资源进度>>>>", resProg)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
Laya.timer.frameLoop(1, this, () => {
|
||||||
Laya.timer.frameLoop(1, this, ()=>{
|
const removes: Array<any> = []
|
||||||
let removes: Array<any> = []
|
this.prefabReqs.forEach((list: Array<any>, path: string) => {
|
||||||
this.prefabReqs.forEach((list: Array<any>, path: string)=>{
|
|
||||||
const obj = Laya.loader.getRes(path)
|
const obj = Laya.loader.getRes(path)
|
||||||
if (obj) {
|
if (obj) {
|
||||||
removes.push(path)
|
removes.push(path)
|
||||||
@@ -157,5 +156,4 @@ export class ResourceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ import { GameOver } from "../views/GameOver"
|
|||||||
import { GamePause } from "../views/GamePause"
|
import { GamePause } from "../views/GamePause"
|
||||||
import { Stage } from "../views/Stage"
|
import { Stage } from "../views/Stage"
|
||||||
import { TopBar } from "../views/TopBar"
|
import { TopBar } from "../views/TopBar"
|
||||||
import { StorageManager } from "./StorageManager"
|
|
||||||
import { ResourceManager } from "./ResourceManager"
|
import { ResourceManager } from "./ResourceManager"
|
||||||
import Lottie from "lottie-web"
|
import { StorageManager } from "./StorageManager"
|
||||||
|
|
||||||
const { regClass, property } = Laya
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
@@ -82,14 +81,14 @@ export class UIManager extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public loadHomeUI(): void {
|
public loadHomeUI(): void {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.home_ui_res, (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.home_ui_res, (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
this.getUIRoot().addChild(prefab)
|
this.getUIRoot().addChild(prefab)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadTopBarUI(): void {
|
public loadTopBarUI(): void {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.topbar_ui_res, (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.topbar_ui_res, (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
this.topbar = this.getUIRoot().addChild(prefab).getComponent(TopBar)
|
this.topbar = this.getUIRoot().addChild(prefab).getComponent(TopBar)
|
||||||
})
|
})
|
||||||
@@ -109,7 +108,7 @@ export class UIManager extends Laya.Script {
|
|||||||
|
|
||||||
public loadDCUI(): void {
|
public loadDCUI(): void {
|
||||||
this.mask.visible = true
|
this.mask.visible = true
|
||||||
ResourceManager.getInstance().loadPrefab(respath.dc_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.dc_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
|
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
|
||||||
if (this.dc_year <= 0 || this.dc_month <= 0) {
|
if (this.dc_year <= 0 || this.dc_month <= 0) {
|
||||||
@@ -137,7 +136,7 @@ export class UIManager extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public loadTrophyClaimUI(record: TrophyRecord): void {
|
public loadTrophyClaimUI(record: TrophyRecord): void {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.trophy_claim_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.trophy_claim_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
|
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
|
||||||
obj.onSetShow(record)
|
obj.onSetShow(record)
|
||||||
@@ -146,7 +145,7 @@ export class UIManager extends Laya.Script {
|
|||||||
|
|
||||||
public loadTrophyUI(): void {
|
public loadTrophyUI(): void {
|
||||||
this.mask.visible = true
|
this.mask.visible = true
|
||||||
ResourceManager.getInstance().loadPrefab(respath.trophy_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.trophy_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom)
|
this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom)
|
||||||
this.mask.visible = false
|
this.mask.visible = false
|
||||||
@@ -162,7 +161,7 @@ export class UIManager extends Laya.Script {
|
|||||||
|
|
||||||
public loadTrophyShowUI(record: TrophyRecord): void {
|
public loadTrophyShowUI(record: TrophyRecord): void {
|
||||||
this.mask.visible = true
|
this.mask.visible = true
|
||||||
ResourceManager.getInstance().loadPrefab(respath.trophy_show_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.trophy_show_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
|
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
|
||||||
obj.onSetShow(record)
|
obj.onSetShow(record)
|
||||||
@@ -174,7 +173,7 @@ export class UIManager extends Laya.Script {
|
|||||||
if (this.stage) {
|
if (this.stage) {
|
||||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||||
} else {
|
} else {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.stage_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.stage_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
this.stage = this.getUIRoot().addChild(prefab).getComponent(Stage)
|
this.stage = this.getUIRoot().addChild(prefab).getComponent(Stage)
|
||||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||||
@@ -191,7 +190,7 @@ export class UIManager extends Laya.Script {
|
|||||||
|
|
||||||
public loadGamePauseUI(doStage: DOStage): void {
|
public loadGamePauseUI(doStage: DOStage): void {
|
||||||
this.mask.visible = true
|
this.mask.visible = true
|
||||||
ResourceManager.getInstance().loadPrefab(respath.gamepause_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.gamepause_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const ui = this.getUIRoot().addChild(prefab).getComponent(GamePause)
|
const ui = this.getUIRoot().addChild(prefab).getComponent(GamePause)
|
||||||
ui.onSetStageInfo(doStage)
|
ui.onSetStageInfo(doStage)
|
||||||
@@ -201,7 +200,7 @@ export class UIManager extends Laya.Script {
|
|||||||
|
|
||||||
public loadGameOverUI(doStage: DOStage): void {
|
public loadGameOverUI(doStage: DOStage): void {
|
||||||
this.mask.visible = true
|
this.mask.visible = true
|
||||||
ResourceManager.getInstance().loadPrefab(respath.gameover_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.gameover_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const ui = this.getUIRoot().addChild(prefab).getComponent(GameOver)
|
const ui = this.getUIRoot().addChild(prefab).getComponent(GameOver)
|
||||||
ui.onSetStageInfo(doStage)
|
ui.onSetStageInfo(doStage)
|
||||||
@@ -211,7 +210,7 @@ export class UIManager extends Laya.Script {
|
|||||||
|
|
||||||
public loadGameDoneUI(isClassic: boolean, doStage: DOStage): void {
|
public loadGameDoneUI(isClassic: boolean, doStage: DOStage): void {
|
||||||
this.mask.visible = true
|
this.mask.visible = true
|
||||||
ResourceManager.getInstance().loadPrefab(respath.gamedone_ui_res(isClassic), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.gamedone_ui_res(isClassic), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const ui = this.getUIRoot().addChild(prefab).getComponent(GameDone)
|
const ui = this.getUIRoot().addChild(prefab).getComponent(GameDone)
|
||||||
ui.onSetStageInfo(doStage)
|
ui.onSetStageInfo(doStage)
|
||||||
|
|||||||
@@ -43,4 +43,4 @@ const bezier_ease_out_2 = BezierEasing(0.25, 0.1, 0.3, 1)
|
|||||||
export function Utility_EaseOut_2(t: number, b: number, c: number, d: number) {
|
export function Utility_EaseOut_2(t: number, b: number, c: number, d: number) {
|
||||||
const p = bezier_ease_out_2(t / d)
|
const p = bezier_ease_out_2(t / d)
|
||||||
return c * p + b
|
return c * p + b
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,10 @@ import { ResourceManager } from "../models/ResourceManager"
|
|||||||
import { UIManager } from "../models/UIManager"
|
import { UIManager } from "../models/UIManager"
|
||||||
import { Utility_EaseOut, Utility_EaseOut_2 } from "../utils/utility"
|
import { Utility_EaseOut, Utility_EaseOut_2 } from "../utils/utility"
|
||||||
|
|
||||||
|
|
||||||
const { regClass, property } = Laya
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
export function G_ShowCommonTips(title: string, content: string, showToggle: boolean, func: any): void {
|
export function G_ShowCommonTips(title: string, content: string, showToggle: boolean, func: any): void {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.common_tips_ui_res, (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.common_tips_ui_res, (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const obj = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(CommonTips)
|
const obj = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(CommonTips)
|
||||||
obj.showCommonTips(title, content, showToggle, func)
|
obj.showCommonTips(title, content, showToggle, func)
|
||||||
@@ -44,20 +43,20 @@ export class CommonTips extends Laya.Script {
|
|||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
||||||
this.mask.alpha = 0
|
this.mask.alpha = 0
|
||||||
Laya.Tween.to(this.mask, {alpha: 0.6}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.mask, { alpha: 0.6 }, 400, Utility_EaseOut)
|
||||||
|
|
||||||
this.center = this.owner.getChildByName("center") as Laya.Box
|
this.center = this.owner.getChildByName("center") as Laya.Box
|
||||||
this.center.scaleX = 0.8
|
this.center.scaleX = 0.8
|
||||||
this.center.scaleY = 0.8
|
this.center.scaleY = 0.8
|
||||||
Laya.Tween.to(this.center, {scaleX: 1, scaleY: 1}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.center, { scaleX: 1, scaleY: 1 }, 400, Utility_EaseOut)
|
||||||
this.center.alpha = 0
|
this.center.alpha = 0
|
||||||
Laya.Tween.to(this.center, {alpha: 1}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.center, { alpha: 1 }, 400, Utility_EaseOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
destroyUI(): void {
|
destroyUI(): void {
|
||||||
Laya.Tween.to(this.mask, {alpha: 0}, 400, Utility_EaseOut_2)
|
Laya.Tween.to(this.mask, { alpha: 0 }, 400, Utility_EaseOut_2)
|
||||||
Laya.Tween.to(this.center, {scaleX: 0.8, scaleY: 0.8}, 400, Utility_EaseOut_2)
|
Laya.Tween.to(this.center, { scaleX: 0.8, scaleY: 0.8 }, 400, Utility_EaseOut_2)
|
||||||
Laya.Tween.to(this.center, {alpha: 0}, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
Laya.Tween.to(this.center, { alpha: 0 }, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import type { DOStage } from "../models/DOStage"
|
import type { DOStage } from "../models/DOStage"
|
||||||
import { config } from "../constants/config"
|
import { config } from "../constants/config"
|
||||||
import { respath } from "../constants/respath"
|
import { respath } from "../constants/respath"
|
||||||
|
import { ResourceManager } from "../models/ResourceManager"
|
||||||
import { StorageManager } from "../models/StorageManager"
|
import { StorageManager } from "../models/StorageManager"
|
||||||
import { UIManager } from "../models/UIManager"
|
import { UIManager } from "../models/UIManager"
|
||||||
import { Utility_ConvertSecondToString } from "../utils/utility"
|
import { Utility_ConvertSecondToString } from "../utils/utility"
|
||||||
import { Difficulty } from "./Difficulty"
|
import { Difficulty } from "./Difficulty"
|
||||||
import { ResourceManager } from "../models/ResourceManager"
|
|
||||||
|
|
||||||
const { regClass, property } = Laya
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
@@ -53,9 +53,8 @@ export class GameDone extends Laya.Script {
|
|||||||
public btn_continue: Laya.Box
|
public btn_continue: Laya.Box
|
||||||
|
|
||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
|
|
||||||
ResourceManager.getInstance().loadTexture(respath.bg_done, this.bg)
|
ResourceManager.getInstance().loadTexture(respath.bg_done, this.bg)
|
||||||
|
|
||||||
this.owner.x = 0
|
this.owner.x = 0
|
||||||
this.owner.y = 0
|
this.owner.y = 0
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ export class GameDone extends Laya.Script {
|
|||||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
|
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
} else {
|
} else {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||||
d.onInit((value: string) => {
|
d.onInit((value: string) => {
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import type { DOStage } from "../models/DOStage"
|
|||||||
import { config } from "../constants/config"
|
import { config } from "../constants/config"
|
||||||
import { respath } from "../constants/respath"
|
import { respath } from "../constants/respath"
|
||||||
import { EVENT_TYPES, EventManager } from "../models/EventManager"
|
import { EVENT_TYPES, EventManager } from "../models/EventManager"
|
||||||
|
import { ResourceManager } from "../models/ResourceManager"
|
||||||
import { StorageManager } from "../models/StorageManager"
|
import { StorageManager } from "../models/StorageManager"
|
||||||
import { UIManager } from "../models/UIManager"
|
import { UIManager } from "../models/UIManager"
|
||||||
import { Difficulty } from "./Difficulty"
|
|
||||||
import { ResourceManager } from "../models/ResourceManager"
|
|
||||||
import { Utility_EaseOut, Utility_EaseOut_2 } from "../utils/utility"
|
import { Utility_EaseOut, Utility_EaseOut_2 } from "../utils/utility"
|
||||||
|
import { Difficulty } from "./Difficulty"
|
||||||
|
|
||||||
const { regClass, property } = Laya
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
@@ -32,25 +32,24 @@ export class GameOver extends Laya.Script {
|
|||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
||||||
this.mask.alpha = 0
|
this.mask.alpha = 0
|
||||||
Laya.Tween.to(this.mask, {alpha: 0.6}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.mask, { alpha: 0.6 }, 400, Utility_EaseOut)
|
||||||
|
|
||||||
this.center = this.owner.getChildByName("center") as Laya.Box
|
this.center = this.owner.getChildByName("center") as Laya.Box
|
||||||
this.center.scaleX = 0.8
|
this.center.scaleX = 0.8
|
||||||
this.center.scaleY = 0.8
|
this.center.scaleY = 0.8
|
||||||
Laya.Tween.to(this.center, {scaleX: 1, scaleY: 1}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.center, { scaleX: 1, scaleY: 1 }, 400, Utility_EaseOut)
|
||||||
this.center.alpha = 0
|
this.center.alpha = 0
|
||||||
Laya.Tween.to(this.center, {alpha: 1}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.center, { alpha: 1 }, 400, Utility_EaseOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
destroyUI(): void {
|
destroyUI(): void {
|
||||||
Laya.Tween.to(this.mask, {alpha: 0}, 400, Utility_EaseOut_2)
|
Laya.Tween.to(this.mask, { alpha: 0 }, 400, Utility_EaseOut_2)
|
||||||
Laya.Tween.to(this.center, {scaleX: 0.8, scaleY: 0.8}, 400, Utility_EaseOut_2)
|
Laya.Tween.to(this.center, { scaleX: 0.8, scaleY: 0.8 }, 400, Utility_EaseOut_2)
|
||||||
Laya.Tween.to(this.center, {alpha: 0}, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
Laya.Tween.to(this.center, { alpha: 0 }, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public onSetStageInfo(doStage: DOStage): void {
|
public onSetStageInfo(doStage: DOStage): void {
|
||||||
this.btn_second.on(Laya.Event.CLICK, this, () => {
|
this.btn_second.on(Laya.Event.CLICK, this, () => {
|
||||||
doStage.set_mistake(doStage.get_mistake() - 1)
|
doStage.set_mistake(doStage.get_mistake() - 1)
|
||||||
@@ -79,7 +78,7 @@ export class GameOver extends Laya.Script {
|
|||||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
|
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
|
||||||
this.destroyUI()
|
this.destroyUI()
|
||||||
} else {
|
} else {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||||
d.onInit((value: string) => {
|
d.onInit((value: string) => {
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ export class GamePause extends Laya.Script {
|
|||||||
|
|
||||||
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
||||||
this.mask.alpha = 0
|
this.mask.alpha = 0
|
||||||
Laya.Tween.to(this.mask, {alpha: 0.6}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.mask, { alpha: 0.6 }, 400, Utility_EaseOut)
|
||||||
|
|
||||||
this.center = this.owner.getChildByName("center") as Laya.Box
|
this.center = this.owner.getChildByName("center") as Laya.Box
|
||||||
this.center.scaleX = 0.8
|
this.center.scaleX = 0.8
|
||||||
this.center.scaleY = 0.8
|
this.center.scaleY = 0.8
|
||||||
Laya.Tween.to(this.center, {scaleX: 1, scaleY: 1}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.center, { scaleX: 1, scaleY: 1 }, 400, Utility_EaseOut)
|
||||||
this.center.alpha = 0
|
this.center.alpha = 0
|
||||||
Laya.Tween.to(this.center, {alpha: 1}, 400, Utility_EaseOut)
|
Laya.Tween.to(this.center, { alpha: 1 }, 400, Utility_EaseOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(): void {
|
onDestroy(): void {
|
||||||
@@ -45,9 +45,9 @@ export class GamePause extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroyUI(): void {
|
destroyUI(): void {
|
||||||
Laya.Tween.to(this.mask, {alpha: 0}, 400, Utility_EaseOut_2)
|
Laya.Tween.to(this.mask, { alpha: 0 }, 400, Utility_EaseOut_2)
|
||||||
Laya.Tween.to(this.center, {scaleX: 0.8, scaleY: 0.8}, 400, Utility_EaseOut_2)
|
Laya.Tween.to(this.center, { scaleX: 0.8, scaleY: 0.8 }, 400, Utility_EaseOut_2)
|
||||||
Laya.Tween.to(this.center, {alpha: 0}, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
Laya.Tween.to(this.center, { alpha: 0 }, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ export class GamePause extends Laya.Script {
|
|||||||
public onSetStageInfo(doStage: DOStage): void {
|
public onSetStageInfo(doStage: DOStage): void {
|
||||||
this.label_time.text = Utility_ConvertSecondToString(doStage.get_duration())
|
this.label_time.text = Utility_ConvertSecondToString(doStage.get_duration())
|
||||||
this.label_diffucuty.text = doStage.get_difficulty()
|
this.label_diffucuty.text = doStage.get_difficulty()
|
||||||
|
|
||||||
this.mask.on(Laya.Event.CLICK, this, () => {
|
this.mask.on(Laya.Event.CLICK, this, () => {
|
||||||
this.destroyUI()
|
this.destroyUI()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export class Home extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onClickNew(_evt: Laya.Event): void {
|
public onClickNew(_evt: Laya.Event): void {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.difficulty_ui_res, (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
const d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||||
d.onInit((value: string) => {
|
d.onInit((value: string) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Utility_EaseOut } from "../utils/utility";
|
import BezierEasing from "bezier-easing"
|
||||||
|
import { Utility_EaseOut } from "../utils/utility"
|
||||||
import { AutoDestroy } from "./common/AutoDestroy"
|
import { AutoDestroy } from "./common/AutoDestroy"
|
||||||
import BezierEasing from 'bezier-easing';
|
|
||||||
|
|
||||||
const { regClass, property } = Laya
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
@@ -25,10 +25,9 @@ export class ScoreAdd extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onStart(): void {
|
onStart(): void {
|
||||||
|
|
||||||
// const filter: Laya.GlowFilter = new Laya.GlowFilter("#000000", 5, 0, 0);
|
// const filter: Laya.GlowFilter = new Laya.GlowFilter("#000000", 5, 0, 0);
|
||||||
// this.label.filters = [filter];
|
// this.label.filters = [filter];
|
||||||
|
|
||||||
function bezierEaseLaya1(t: number, b: number, c: number, d: number) {
|
function bezierEaseLaya1(t: number, b: number, c: number, d: number) {
|
||||||
const bezier = BezierEasing(0.55, 1.8, 0.8, 0.95)
|
const bezier = BezierEasing(0.55, 1.8, 0.8, 0.95)
|
||||||
const p = bezier(t / d)
|
const p = bezier(t / d)
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ export class Stage extends Laya.Script {
|
|||||||
Stage._instance.onUpdatePaused(arg)
|
Stage._instance.onUpdatePaused(arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public onUpdatePaused(paused: boolean): void {
|
public onUpdatePaused(paused: boolean): void {
|
||||||
this.paused = paused
|
this.paused = paused
|
||||||
Stage._instance.obj_mask.visible = paused
|
Stage._instance.obj_mask.visible = paused
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ResourceManager } from "../../models/ResourceManager"
|
|||||||
import { ScoreAdd } from "../ScoreAdd"
|
import { ScoreAdd } from "../ScoreAdd"
|
||||||
|
|
||||||
export function G_ShowScoreTips(text: string, parent: any): void {
|
export function G_ShowScoreTips(text: string, parent: any): void {
|
||||||
ResourceManager.getInstance().loadPrefab(respath.score_add_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.score_add_ui_res(), (go: any) => {
|
||||||
const prefab = go.create()
|
const prefab = go.create()
|
||||||
const score = parent.addChild(prefab).getComponent(ScoreAdd)
|
const score = parent.addChild(prefab).getComponent(ScoreAdd)
|
||||||
score.onSetText(text)
|
score.onSetText(text)
|
||||||
|
|||||||
@@ -1,62 +1,60 @@
|
|||||||
import { ResourceManager } from "../../models/ResourceManager";
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
const { regClass, property } = Laya;
|
|
||||||
|
|
||||||
@regClass()
|
@regClass()
|
||||||
export class UISequenceAnimation extends Laya.Script {
|
export class UISequenceAnimation extends Laya.Script {
|
||||||
declare owner : Laya.Image;
|
declare owner: Laya.Image
|
||||||
|
|
||||||
@property(String)
|
@property(String)
|
||||||
public prefix: string;
|
public prefix: string
|
||||||
|
|
||||||
@property(Number)
|
@property(Number)
|
||||||
public beginIndex: number = 0
|
public beginIndex: number = 0
|
||||||
|
|
||||||
@property(Number)
|
@property(Number)
|
||||||
public endIndex: number
|
public endIndex: number
|
||||||
|
|
||||||
@property(Boolean)
|
@property(Boolean)
|
||||||
public playOnAwake: boolean = true
|
public playOnAwake: boolean = true
|
||||||
|
|
||||||
@property(Boolean)
|
@property(Boolean)
|
||||||
public loop: boolean = false
|
public loop: boolean = false
|
||||||
|
|
||||||
private running: boolean = false
|
private running: boolean = false
|
||||||
private currentIndex: number = 0
|
private currentIndex: number = 0
|
||||||
|
|
||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
if (this.playOnAwake) {
|
if (this.playOnAwake) {
|
||||||
this.running = true
|
this.running = true
|
||||||
} else {
|
} else {
|
||||||
this.running = false
|
this.running = false
|
||||||
}
|
}
|
||||||
|
this.currentIndex = this.beginIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
onLateUpdate(): void {
|
||||||
|
if (this.running) {
|
||||||
|
if (this.currentIndex > this.endIndex) {
|
||||||
this.currentIndex = this.beginIndex
|
this.currentIndex = this.beginIndex
|
||||||
}
|
if (this.loop === false) {
|
||||||
|
this.running = false
|
||||||
onLateUpdate(): void {
|
this.owner.visible = false
|
||||||
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 ++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let endStr = this.currentIndex.toString()
|
||||||
|
if (this.currentIndex < 10) {
|
||||||
|
endStr = `00${this.currentIndex}`
|
||||||
|
} else if (this.currentIndex < 100) {
|
||||||
|
endStr = `0${this.currentIndex}`
|
||||||
|
}
|
||||||
|
const path = `${this.prefix + endStr}.png`
|
||||||
|
// ResourceManager.getInstance().loadTexture(path, this.image)
|
||||||
|
this.owner.skin = path
|
||||||
|
|
||||||
onSetRunning(running: boolean): void {
|
this.currentIndex++
|
||||||
this.running = running
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSetRunning(running: boolean): void {
|
||||||
|
this.running = running
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,32 +26,32 @@ export class TrophyClaim extends Laya.Script {
|
|||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
||||||
this.mask.alpha = 0
|
this.mask.alpha = 0
|
||||||
Laya.Tween.to(this.mask, {alpha: 0.8}, 600)
|
Laya.Tween.to(this.mask, { alpha: 0.8 }, 600)
|
||||||
|
|
||||||
this.center = this.owner.getChildByName("center") as Laya.Box
|
this.center = this.owner.getChildByName("center") as Laya.Box
|
||||||
|
|
||||||
const light = this.center.getChildByName("light") as Laya.Image
|
const light = this.center.getChildByName("light") as Laya.Image
|
||||||
light.scaleX = 0
|
light.scaleX = 0
|
||||||
light.scaleY = 0
|
light.scaleY = 0
|
||||||
Laya.Tween.to(light, {scaleX: 1, scaleY: 1}, 200, Utility_EaseOut_2, null, 200)
|
Laya.Tween.to(light, { scaleX: 1, scaleY: 1 }, 200, Utility_EaseOut_2, null, 200)
|
||||||
|
|
||||||
const trophy = this.center.getChildByName("trophy") as Laya.Image
|
const trophy = this.center.getChildByName("trophy") as Laya.Image
|
||||||
trophy.scaleX = 0
|
trophy.scaleX = 0
|
||||||
trophy.scaleY = 0
|
trophy.scaleY = 0
|
||||||
Laya.Tween.to(trophy, {scaleX: 1, scaleY: 1}, 200, Utility_EaseOut_2, null, 200)
|
Laya.Tween.to(trophy, { scaleX: 1, scaleY: 1 }, 200, Utility_EaseOut_2, null, 200)
|
||||||
|
|
||||||
const blossom = trophy.getChildByName("blossom").getComponent(UISequenceAnimation)
|
const blossom = trophy.getChildByName("blossom").getComponent(UISequenceAnimation)
|
||||||
Laya.timer.once(400, this, ()=>{
|
Laya.timer.once(400, this, () => {
|
||||||
blossom.onSetRunning(true)
|
blossom.onSetRunning(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
const label_titlle = this.center.getChildByName("label_titlle") as Laya.Label
|
const label_titlle = this.center.getChildByName("label_titlle") as Laya.Label
|
||||||
label_titlle.alpha = 0
|
label_titlle.alpha = 0
|
||||||
Laya.Tween.to(label_titlle, {alpha: 1}, 600, Laya.Ease.linearNone, null, 600)
|
Laya.Tween.to(label_titlle, { alpha: 1 }, 600, Laya.Ease.linearNone, null, 600)
|
||||||
|
|
||||||
const btn_close = this.center.getChildByName("btn_close") as Laya.Box
|
const btn_close = this.center.getChildByName("btn_close") as Laya.Box
|
||||||
btn_close.alpha = 0
|
btn_close.alpha = 0
|
||||||
Laya.Tween.to(btn_close, {alpha: 1}, 600, Laya.Ease.linearNone, null, 800)
|
Laya.Tween.to(btn_close, { alpha: 1 }, 600, Laya.Ease.linearNone, null, 800)
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSetShow(record: TrophyRecord): void {
|
public onSetShow(record: TrophyRecord): void {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class TrophyRoom extends Laya.Script {
|
|||||||
list.push(obj)
|
list.push(obj)
|
||||||
}
|
}
|
||||||
console.log(">>>>>>>>>>>>years=", years)
|
console.log(">>>>>>>>>>>>years=", years)
|
||||||
ResourceManager.getInstance().loadPrefab(respath.trophy_year_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.trophy_year_ui_res(), (go: any) => {
|
||||||
for (let i = 1; i < years.length; i++) {
|
for (let i = 1; i < years.length; i++) {
|
||||||
const obj_year = this.obj_items.getChildAt(i)
|
const obj_year = this.obj_items.getChildAt(i)
|
||||||
if (!obj_year) {
|
if (!obj_year) {
|
||||||
@@ -65,7 +65,7 @@ export class TrophyRoom extends Laya.Script {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceManager.getInstance().loadPrefab(respath.trophy_cell_ui_res(), (go: any)=> {
|
ResourceManager.getInstance().loadPrefab(respath.trophy_cell_ui_res(), (go: any) => {
|
||||||
let itemsHeight = 0
|
let itemsHeight = 0
|
||||||
for (let i = 0; i < years.length; i++) {
|
for (let i = 0; i < years.length; i++) {
|
||||||
const list = monthMap.get(years[i])
|
const list = monthMap.get(years[i])
|
||||||
|
|||||||
Reference in New Issue
Block a user