添加横屏页面

This commit is contained in:
2025-05-26 19:57:17 +08:00
parent 354194358b
commit 468f40351d
71 changed files with 11796 additions and 42067 deletions

View File

@@ -60,7 +60,7 @@ export class StorageManager {
public newStage(stageID: string, type: number, name: string, difficulty: string = config.DIFFICULTY_TYPE.Easy): DOStage {
this.stageID = stageID
this.stageChanged = false
this.stageChanged = true
var index
if (type == config.STAGE_TYPE.MAIN) {//主线关卡
@@ -79,14 +79,14 @@ export class StorageManager {
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)
this.stageMap.set(stageID, doStage)
return doStage
}
public loadStage(stageID: string): DOStage {
this.stageID = stageID
this.stageChanged = false
public getStage(stageID: string): DOStage {//获取指定关卡数据对象,注意判空
if (this.stageMap.has(stageID)) {
var doStage: DOStage = this.stageMap.get(stageID)
return doStage
@@ -102,25 +102,19 @@ export class StorageManager {
}
return null
}
public getStage(): DOStage {//获取当前关卡数据对象,注意判空
if (this.stageID && this.stageMap) {
return this.stageMap.get(this.stageID)
public loadStage(stageID: string): DOStage {//载入关卡
var doStage = this.getStage(stageID)
if (doStage) {
this.stageID = stageID
this.stageChanged = false
return doStage
}
console.log("载入关卡失败>>>>>", stageID)
return null
}
public cleanStage(): void {//清空当前关卡数据对象,注意判空
this.user.update_stage_done(this.stageID, 0)
if (this.stageMap.has(this.stageID)) {
this.stageMap.delete(this.stageID)
}
Laya.LocalStorage.removeItem(this.stageID)
this.stageID = ""
this.stageChanged = false
}
public cleanMainStage(): void {//清空主线关卡数据
this.stageID = config.DEFAULT_STAGE_ID
this.cleanStage()
}
public saveStage(): void {
if (this.stageChanged) {
this.stageChanged = false

View File

@@ -6,6 +6,11 @@ import { TrophyRecord } from "../types/global"
import { TrophyClaim } from "../views/dc/TrophyClaim"
import { TrophyShow } from "../views/dc/TrophyShow"
import { config } from "../constants/config"
import { TrophyRoom } from "../views/dc/TrophyRoom"
import { DOStage } from "./DOStage"
import { GamePause } from "../views/GamePause"
import { GameOver } from "../views/GameOver"
import { GameDone } from "../views/GameDone"
const { regClass, property } = Laya
@@ -33,6 +38,8 @@ export class UIManager extends Laya.Script {
}
private stage: Stage
private dc_ui: DailyChallenge
private trophyRoom: TrophyRoom
public getUIRoot(): Laya.Node {
@@ -54,15 +61,21 @@ export class UIManager extends Laya.Script {
}
public loadDCUI(): void {
Laya.loader.load(respath.dc_ui_res).then((go)=>{
Laya.loader.load(respath.dc_ui_res()).then((go)=>{
var prefab = go.create()
var dc = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
dc.loadWithMonth()
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
this.dc_ui.loadWithMonth()
})
}
public closeDCUI(): void {
if (this.dc_ui) {
this.dc_ui.owner.destroy()
this.dc_ui = null
}
}
public loadTrophyClaimUI(record: TrophyRecord): void {
Laya.loader.load(respath.trophy_claim_ui_res).then((go)=>{
Laya.loader.load(respath.trophy_claim_ui_res()).then((go)=>{
var prefab = go.create()
var obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
obj.onSetShow(record)
@@ -70,14 +83,20 @@ export class UIManager extends Laya.Script {
}
public loadTrophyUI(): void {
Laya.loader.load(respath.trophy_ui_res).then((go)=>{
Laya.loader.load(respath.trophy_ui_res()).then((go)=>{
var prefab = go.create()
this.getUIRoot().addChild(prefab)
this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom)
})
}
public closeTrophyUI(): void {
if (this.trophyRoom) {
this.trophyRoom.owner.destroy()
this.trophyRoom = null
}
}
public loadTrophyShowUI(record: TrophyRecord): void {
Laya.loader.load(respath.trophy_show_ui_res).then((go)=>{
Laya.loader.load(respath.trophy_show_ui_res()).then((go)=>{
var prefab = go.create()
var obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
obj.onSetShow(record)
@@ -103,22 +122,25 @@ export class UIManager extends Laya.Script {
}
}
public loadGamePauseUI(): void {
Laya.loader.load(respath.gamepause_ui_res).then((go)=>{
public loadGamePauseUI(doStage: DOStage): void {
Laya.loader.load(respath.gamepause_ui_res()).then((go)=>{
var prefab = go.create()
this.getUIRoot().addChild(prefab)
var ui = this.getUIRoot().addChild(prefab).getComponent(GamePause)
ui.onSetStageInfo(doStage)
})
}
public loadGameOverUI(): void {
Laya.loader.load(respath.gameover_ui_res).then((go)=>{
public loadGameOverUI(doStage: DOStage): void {
Laya.loader.load(respath.gameover_ui_res()).then((go)=>{
var prefab = go.create()
this.getUIRoot().addChild(prefab)
var ui = this.getUIRoot().addChild(prefab).getComponent(GameOver)
ui.onSetStageInfo(doStage)
})
}
public loadGameDoneUI(): void {
Laya.loader.load(respath.gamedone_ui_res).then((go)=>{
public loadGameDoneUI(isClassic: boolean, doStage: DOStage): void {
Laya.loader.load(respath.gamedone_ui_res(isClassic)).then((go)=>{
var prefab = go.create()
this.getUIRoot().addChild(prefab)
var ui = this.getUIRoot().addChild(prefab).getComponent(GameDone)
ui.onSetStageInfo(doStage)
})
}