123456789101112131415161718 |
- {
- "code": "import { WindowManager, WindowType } from \"./WindowManager\";\r\nimport { ui } from \"../ui/layaMaxUI\";\r\nimport { GameManager } from \"../Main/GameManager\";\r\nimport { GameState } from \"../Main/DataMaker\";\r\nimport { Player } from \"../Main/Player\";\r\nimport { TtSdk } from \"../Util/TtSdk\";\r\nexport class ReviveWindow extends ui.Window.ReviveWindowUI {\r\n constructor() {\r\n super();\r\n this.counttime = 5;\r\n this.play = true;\r\n ReviveWindow.instance = this;\r\n }\r\n static get Instance() {\r\n return ReviveWindow.instance;\r\n }\r\n InitSize() {\r\n this.height = Laya.stage.height;\r\n Laya.stage.on(Laya.Event.RESIZE, this, () => { this.height = Laya.stage.height; });\r\n this.Btn.y = Laya.stage.height / 1280 * this.Btn.y;\r\n this.pan.y = Laya.stage.height / 1280 * this.pan.y;\r\n }\r\n OnOpen(_win = false) {\r\n this.InitSize();\r\n this.RegButton();\r\n Laya.timer.loop(1000, this, this.OnCountTime);\r\n TtSdk.Showbanner();\r\n }\r\n RegButton() {\r\n this.passbtn.clickHandler = Laya.Handler.create(this, this.OnPass, null, false);\r\n this.closebtn.clickHandler = Laya.Handler.create(this, this.OnClose, null, false);\r\n }\r\n OnHide() {\r\n Laya.timer.clear(this, this.OnCountTime);\r\n }\r\n OnCountTime() {\r\n if (!this.play)\r\n return;\r\n if (this.counttime > 0) {\r\n this.counttime -= 1;\r\n }\r\n else {\r\n Laya.timer.clear(this, this.OnCountTime);\r\n this.counttime = 0;\r\n this.OnClose();\r\n }\r\n this.timetex.text = this.counttime.toString();\r\n }\r\n OnPass() {\r\n if (Laya.Browser.onMobile) {\r\n this.play = false;\r\n TtSdk.ShowVideo((flag) => {\r\n if (flag) {\r\n Player.mainpalyer.Revive();\r\n GameManager.Instance.ChangeGameState(GameState.Playing);\r\n }\r\n else {\r\n this.play = true;\r\n }\r\n });\r\n }\r\n else {\r\n Player.mainpalyer.Revive();\r\n GameManager.Instance.ChangeGameState(GameState.Playing);\r\n }\r\n }\r\n OnClose() {\r\n WindowManager.Instance.ShowWindow(WindowType.SettlementWindow, false);\r\n }\r\n}\r\n",
- "references": [
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Window/Component/IWindow.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Window/WindowManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/PoolManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/LevelMaker.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/ui/layaMaxUI.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/SceneManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/RigObj.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/GameManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/DataMaker.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/Player.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Network/PlayerAccount.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/TtSdk.ts"
- ]
- }
|