game pause

This commit is contained in:
2025-05-22 19:12:00 +08:00
parent 4df55f9031
commit 4626e98717
30 changed files with 439 additions and 70 deletions

View File

@@ -3,6 +3,7 @@
export const EVENT_TYPES = {
NOT_UPDATE_MISTAKE: "NOT_UPDATE_MISTAKE",//更新分数
NOT_UPDATE_PAUSE: "NOT_UPDATE_PAUSE",//更新暂停状态
}

View File

@@ -153,4 +153,5 @@ export class LevelManager {
}
return ""
}
}

View File

@@ -4,6 +4,7 @@ import { config } from "../constants/config"
import { DataStage, createDataStage } from "../types/global"
import { DOStage } from "./DOStage"
import { DOUser } from "./DOUser"
import { LevelManager } from "./LevelManager"
export class StorageManager {
@@ -57,9 +58,27 @@ export class StorageManager {
this.userChanged = true
}
public newStage(stageID: string, type: number, name: string, difficulty: string, index: number): DOStage {
public newStage(stageID: string, type: number, name: string, difficulty: string = config.DIFFICULTY_TYPE.Easy): DOStage {
this.stageID = stageID
this.stageChanged = false
var index
if (type == config.STAGE_TYPE.MAIN) {//主线关卡
index = this.user.get_progress(difficulty)
var levelStr = LevelManager.getInstance().getLevelStr(difficulty, index)
if (!levelStr || levelStr.length <= 0) {//说明当前难度已经打通了,所以给他从头开始
index = 0
this.user.update_progress(difficulty, index)
}
}
else if (type == config.STAGE_TYPE.DC) {
var random = Math.random()
difficulty = config.DIFFICULTY_LIST[Math.floor(random*config.DIFFICULTY_LIST.length)]
var list = LevelManager.getInstance().getLevelList(difficulty)
random = Math.random()
index = Math.floor(random*list.length)
console.log("每日挑战随机一个关卡", difficulty, index)
}
var dataStage: DataStage = createDataStage(stageID, type, name, difficulty, index)
var doStage: DOStage = new DOStage(dataStage)
this.stageMap.set(stageID, doStage)

View File

@@ -5,7 +5,6 @@ import { DailyChallenge } from "../views/DailyChallenge"
import { TrophyRecord } from "../types/global"
import { TrophyClaim } from "../views/TrophyClaim"
import { TrophyShow } from "../views/TrophyShow"
import { config } from "../constants/config"
const { regClass, property } = Laya
@@ -91,6 +90,12 @@ export class UIManager extends Laya.Script {
}
}
public loadGamePauseUI(): void {
Laya.loader.load(respath.gamepause_ui_res).then((go)=>{
var prefab = go.create()
this.getUIRoot().addChild(prefab)
})
}
public loadGameOverUI(): void {
Laya.loader.load(respath.gameover_ui_res).then((go)=>{
var prefab = go.create()