格式化代码
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
import { respath } from "../constants/respath"
|
||||
import { StorageManager } from "./StorageManager"
|
||||
import { Stage } from "../views/Stage"
|
||||
import { DailyChallenge } from "../views/dc/DailyChallenge"
|
||||
import { TrophyRecord } from "../types/global"
|
||||
import { TrophyClaim } from "../views/dc/TrophyClaim"
|
||||
import { TrophyShow } from "../views/dc/TrophyShow"
|
||||
import type { TrophyRecord } from "../types/global"
|
||||
import type { DOStage } from "./DOStage"
|
||||
import { config } from "../constants/config"
|
||||
import { respath } from "../constants/respath"
|
||||
import { DailyChallenge } from "../views/dc/DailyChallenge"
|
||||
import { TrophyClaim } from "../views/dc/TrophyClaim"
|
||||
import { TrophyRoom } from "../views/dc/TrophyRoom"
|
||||
import { DOStage } from "./DOStage"
|
||||
import { GamePause } from "../views/GamePause"
|
||||
import { GameOver } from "../views/GameOver"
|
||||
import { TrophyShow } from "../views/dc/TrophyShow"
|
||||
import { GameDone } from "../views/GameDone"
|
||||
import { GameOver } from "../views/GameOver"
|
||||
import { GamePause } from "../views/GamePause"
|
||||
import { Stage } from "../views/Stage"
|
||||
import { TopBar } from "../views/TopBar"
|
||||
|
||||
import { StorageManager } from "./StorageManager"
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -36,8 +35,7 @@ export class UIManager extends Laya.Script {
|
||||
if (config.H_SCREEN) {
|
||||
this.UIRoot.width = config.DESIGN_HEIGHT
|
||||
this.UIRoot.height = config.DESIGN_WIDTH
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.UIRoot.width = config.DESIGN_WIDTH
|
||||
this.UIRoot.height = config.DESIGN_HEIGHT
|
||||
}
|
||||
@@ -45,48 +43,47 @@ export class UIManager extends Laya.Script {
|
||||
return this.UIRoot
|
||||
}
|
||||
|
||||
private topbar : TopBar
|
||||
private topbar: TopBar
|
||||
private stage: Stage
|
||||
private dc_ui: DailyChallenge
|
||||
private trophyRoom: TrophyRoom
|
||||
|
||||
|
||||
onStart(): void {
|
||||
if (config.H_SCREEN) {
|
||||
this.loadTopBarUI()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.loadHomeUI()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public loadHomeUI(): void {
|
||||
Laya.loader.load(respath.home_ui_res).then((go)=>{
|
||||
var prefab = go.create()
|
||||
Laya.loader.load(respath.home_ui_res).then((go) => {
|
||||
const prefab = go.create()
|
||||
this.getUIRoot().addChild(prefab)
|
||||
})
|
||||
}
|
||||
|
||||
public loadTopBarUI(): void {
|
||||
Laya.loader.load(respath.topbar_ui_res).then((go)=>{
|
||||
var prefab = go.create()
|
||||
Laya.loader.load(respath.topbar_ui_res).then((go) => {
|
||||
const prefab = go.create()
|
||||
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)=>{
|
||||
var prefab = go.create()
|
||||
Laya.loader.load(respath.dc_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
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()
|
||||
@@ -95,46 +92,47 @@ export class UIManager extends Laya.Script {
|
||||
}
|
||||
|
||||
public loadTrophyClaimUI(record: TrophyRecord): void {
|
||||
Laya.loader.load(respath.trophy_claim_ui_res()).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
|
||||
Laya.loader.load(respath.trophy_claim_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
|
||||
obj.onSetShow(record)
|
||||
})
|
||||
}
|
||||
|
||||
public loadTrophyUI(): void {
|
||||
Laya.loader.load(respath.trophy_ui_res()).then((go)=>{
|
||||
var prefab = go.create()
|
||||
Laya.loader.load(respath.trophy_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
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)=>{
|
||||
var prefab = go.create()
|
||||
var obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
|
||||
Laya.loader.load(respath.trophy_show_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
const obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
|
||||
obj.onSetShow(record)
|
||||
})
|
||||
}
|
||||
|
||||
public loadStageUI(stageID: string): void {
|
||||
if (this.stage) {
|
||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||
}
|
||||
else {
|
||||
Laya.loader.load(respath.stage_ui_res()).then((go)=>{
|
||||
var prefab = go.create()
|
||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||
} else {
|
||||
Laya.loader.load(respath.stage_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
this.stage = this.getUIRoot().addChild(prefab).getComponent(Stage)
|
||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public closeStageUI(): void {
|
||||
if (this.stage) {
|
||||
this.stage.owner.destroy()
|
||||
@@ -143,25 +141,26 @@ export class UIManager extends Laya.Script {
|
||||
}
|
||||
|
||||
public loadGamePauseUI(doStage: DOStage): void {
|
||||
Laya.loader.load(respath.gamepause_ui_res()).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var ui = this.getUIRoot().addChild(prefab).getComponent(GamePause)
|
||||
ui.onSetStageInfo(doStage)
|
||||
})
|
||||
}
|
||||
public loadGameOverUI(doStage: DOStage): void {
|
||||
Laya.loader.load(respath.gameover_ui_res()).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var ui = this.getUIRoot().addChild(prefab).getComponent(GameOver)
|
||||
ui.onSetStageInfo(doStage)
|
||||
})
|
||||
}
|
||||
public loadGameDoneUI(isClassic: boolean, doStage: DOStage): void {
|
||||
Laya.loader.load(respath.gamedone_ui_res(isClassic)).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var ui = this.getUIRoot().addChild(prefab).getComponent(GameDone)
|
||||
Laya.loader.load(respath.gamepause_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
const ui = this.getUIRoot().addChild(prefab).getComponent(GamePause)
|
||||
ui.onSetStageInfo(doStage)
|
||||
})
|
||||
}
|
||||
|
||||
public loadGameOverUI(doStage: DOStage): void {
|
||||
Laya.loader.load(respath.gameover_ui_res()).then((go) => {
|
||||
const prefab = go.create()
|
||||
const ui = this.getUIRoot().addChild(prefab).getComponent(GameOver)
|
||||
ui.onSetStageInfo(doStage)
|
||||
})
|
||||
}
|
||||
|
||||
public loadGameDoneUI(isClassic: boolean, doStage: DOStage): void {
|
||||
Laya.loader.load(respath.gamedone_ui_res(isClassic)).then((go) => {
|
||||
const prefab = go.create()
|
||||
const ui = this.getUIRoot().addChild(prefab).getComponent(GameDone)
|
||||
ui.onSetStageInfo(doStage)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user