添加广播逻辑

This commit is contained in:
2025-05-19 20:58:15 +08:00
parent ce53eda29c
commit b6c1e58f35
5 changed files with 342 additions and 83 deletions

View File

@@ -3,6 +3,7 @@ import { config } from "../constants/config";
import { UIManager } from "../models/UIManager";
import { StorageManager } from "../models/StorageManager";
import { LevelManager } from "../models/LevelManager";
import { EventManager, EVENT_TYPES } from "../models/EventManager";
import { Difficulty } from "./Difficulty";
const { regClass, property } = Laya;
@@ -12,14 +13,25 @@ export class GameOver extends Laya.Script {
declare owner : Laya.Box;
@property(Laya.Button)
public btn_restart: Laya.Button
@property(Laya.Sprite)
public btn_second: Laya.Sprite
@property(Laya.Button)
public btn_new: Laya.Button
@property(Laya.Sprite)
public btn_restart: Laya.Sprite
@property(Laya.Sprite)
public btn_new: Laya.Sprite
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
onAwake(): void {
this.btn_second.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
var doStage = StorageManager.getInstance().loadStage(config.DEFAULT_STAGE_ID)
doStage.set_mistake(doStage.get_mistake()-1)
EventManager.getInstance().DispatchEvent(EVENT_TYPES.NOT_UPDATE_MISTAKE, "adsf")
this.owner.destroy()
})
this.btn_restart.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
var doStage = StorageManager.getInstance().loadStage(config.DEFAULT_STAGE_ID)
var difficulty = doStage.get_difficulty()