继续补充横屏逻辑

This commit is contained in:
2025-05-26 21:17:05 +08:00
parent 12b16320e6
commit 4e0e536c49
5 changed files with 45 additions and 26 deletions

View File

@@ -71,14 +71,22 @@ export class StorageManager {
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)
else if (type == config.STAGE_TYPE.DC) {//每天调整如果已经创建过关卡那么就用之前的关卡配置
var value = this.getStage(stageID)
if (value) {
difficulty = value.get_difficulty()
index = value.get_stageIndex()
}
else {
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)
}
}
this.user.update_stage_done(this.stageID, 0)//重置关卡进度
var dataStage: DataStage = createDataStage(stageID, type, name, difficulty, index)
var doStage: DOStage = new DOStage(dataStage)

View File

@@ -11,6 +11,7 @@ import { DOStage } from "./DOStage"
import { GamePause } from "../views/GamePause"
import { GameOver } from "../views/GameOver"
import { GameDone } from "../views/GameDone"
import { TopBar } from "../views/TopBar"
const { regClass, property } = Laya
@@ -44,7 +45,7 @@ export class UIManager extends Laya.Script {
return this.UIRoot
}
private topbar : TopBar
private stage: Stage
private dc_ui: DailyChallenge
private trophyRoom: TrophyRoom
@@ -70,9 +71,14 @@ export class UIManager extends Laya.Script {
public loadTopBarUI(): void {
Laya.loader.load(respath.topbar_ui_res).then((go)=>{
var prefab = go.create()
this.getUIRoot().addChild(prefab)
this.topbar = this.getUIRoot().addChild(prefab).getComponent(TopBar)
})
}
public setTopbarTo(isClassic: boolean): void {
if (this.topbar) {
this.topbar.onClickTab(isClassic)
}
}
public loadDCUI(): void {
Laya.loader.load(respath.dc_ui_res()).then((go)=>{