添加横屏页面

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

@@ -16,8 +16,11 @@ const { regClass, property } = Laya;
export class Stage extends Laya.Script {
declare owner : Laya.Box;
@property(Laya.Button)
public btn_back: Laya.Button
@property(Laya.Box)
public btn_back: Laya.Box
@property(Laya.Box)
public btn_new: Laya.Box
@property(Laya.Button)
public btn_pause: Laya.Button
@property(Laya.Label)
@@ -63,6 +66,7 @@ export class Stage extends Laya.Script {
private static _instance: Stage
onAwake(): void {
Stage._instance = this
this.btn_back.on(Laya.Event.CLICK, this, ()=>{
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {
UIManager.getInstance().loadHomeUI();
@@ -73,8 +77,19 @@ export class Stage extends Laya.Script {
UIManager.getInstance().closeStageUI();
}
})
if (this.btn_new) {
this.btn_new.on(Laya.Event.CLICK, this, ()=>{
var user = StorageManager.getInstance().getUser()
user.update_progress(this.data.get_difficulty(), this.data.get_stageIndex()+1)//主线关卡更新难度进度
StorageManager.getInstance().newStage(config.DEFAULT_STAGE_ID, config.STAGE_TYPE.MAIN, this.data.get_difficulty(), this.data.get_difficulty())
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
})
}
this.btn_pause.on(Laya.Event.CLICK, this, ()=>{
UIManager.getInstance().loadGamePauseUI();
UIManager.getInstance().loadGamePauseUI(this.data);
})
for (var i=0; i<this.obj_blocks.numChildren; i++) {
var hbox = this.obj_blocks.getChildAt(i);
@@ -142,11 +157,19 @@ export class Stage extends Laya.Script {
this.data = doStage
this.paused = false
if (config.H_SCREEN) {
this.btn_back.visible = this.data.get_stageType() == config.STAGE_TYPE.DC
this.btn_new.visible = this.data.get_stageType() == config.STAGE_TYPE.MAIN
}
this.onUpdateScore()
this.label_name.text = this.data.get_stageName()
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN && config.H_SCREEN)
this.label_name.text = ""
this.onUpdateMistake()
this.label_time.text = Utility_ConvertSecondToString(this.data.get_duration())
Laya.timer.clearAll(this)
Laya.timer.loop(1000, this, ()=>{
if (this.paused) {
return
@@ -348,7 +371,7 @@ export class Stage extends Laya.Script {
var show = this.selectedBlock.getData().get_show()
var notes = this.selectedBlock.getData().get_notes()
if (this.selectedBlock.getData().get_checked() == false) {
if (this.data.get_note_open()) {
if (this.data.get_note_open() && hint == false) {
var relateds = this.findRelatedBlocks(this.selectedBlock)
var find = false
for (var i=0; i<relateds.length; i++) {
@@ -408,6 +431,7 @@ export class Stage extends Laya.Script {
this.data.set_score(score)
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {//主线关卡更新难度进度
user.update_progress(this.data.get_difficulty(), this.data.get_stageIndex()+1)
UIManager.getInstance().loadGameDoneUI(true, this.data)
}
else if (this.data.get_stageType() == config.STAGE_TYPE.DC) {//dc
if (progress >= 1) {//完成每日挑战关卡检查是否或者当月奖杯
@@ -424,8 +448,8 @@ export class Stage extends Laya.Script {
user.add_trophy_record(nowYear, nowMonth, now.getDate())
}
}
UIManager.getInstance().loadGameDoneUI(false, this.data)
}
UIManager.getInstance().loadGameDoneUI()
}
}
else {//失败
@@ -434,7 +458,7 @@ export class Stage extends Laya.Script {
if (this.data.get_mistake() >= config.MISTAKE_MAX) {
console.log("关卡失败")
this.paused = true
UIManager.getInstance().loadGameOverUI()
UIManager.getInstance().loadGameOverUI(this.data)
}
}
}