eecc52a9241ceda8542a33489cb04ec10121b4f1 4.6 KB

1234567891011121314151617
  1. {
  2. "code": "import { ui } from \"../ui/layaMaxUI\";\r\nimport { LevelManager } from \"../Main/LevelManager\";\r\nimport { GameManager } from \"../Main/GameManager\";\r\nimport { PlayerAccount } from \"../Network/PlayerAccount\";\r\nimport { NetworkManager, PROTOCOLS } from \"../Network/NetworkManager\";\r\nimport { GameUtils } from \"../Util/GameUtils\";\r\nimport { GameState } from \"../Main/DataMaker\";\r\nimport { WindowManager, WindowType } from \"./WindowManager\";\r\nimport { TtSdk } from \"../Util/TtSdk\";\r\nexport class SettlementWindow extends ui.Window.SettlementWindowUI {\r\n constructor() {\r\n super();\r\n this.curwin = false;\r\n this.settment = false;\r\n SettlementWindow.instance = this;\r\n }\r\n static get Instance() {\r\n return SettlementWindow.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.pan.y = Laya.stage.height / 1280 * this.pan.y;\r\n this.moneypan.y = Laya.stage.height / 1280 * this.moneypan.y;\r\n this.Btn.y = Laya.stage.height / 1280 * this.Btn.y;\r\n }\r\n OnOpen(_win = false) {\r\n this.curwin = _win;\r\n this.curlevel = LevelManager.Instance.curlevel;\r\n var money = this.curwin ? this.curlevel.leveldata.missiondata.win : this.curlevel.leveldata.missiondata.lose;\r\n money += GameManager.Instance.goldnum;\r\n this.moneyclip.text = money.toString();\r\n this.InitSize();\r\n this.RegButton();\r\n TtSdk.Instance.RecordStop();\r\n WindowManager.Instance.OpenPopView(WindowType.ShareVideoWindow);\r\n this.winshow.visible = this.curwin;\r\n this.loseshow.visible = !this.curwin;\r\n }\r\n RegButton() {\r\n this.nomalaward.clickHandler = Laya.Handler.create(this, this.OnClickNomalAward, null, false);\r\n this.awardbtn.clickHandler = Laya.Handler.create(this, this.OnGetAward, null, false);\r\n }\r\n OnHide() {\r\n }\r\n GetSettment(_cb, double = false) {\r\n if (this.settment) {\r\n _cb();\r\n }\r\n this.settment = true;\r\n var money = this.curwin ? this.curlevel.leveldata.missiondata.win : this.curlevel.leveldata.missiondata.lose;\r\n money += GameManager.Instance.goldnum;\r\n if (double)\r\n money *= 3;\r\n var goldnum = money.toString();\r\n var wins = this.curwin ? \"1\" : \"0\";\r\n var agrs = [{ \"t\": PlayerAccount.CurrentAccount.ServerTime.toString() }, { \"play_id\": GameManager.Instance.play_id.toString() }, { \"win\": wins }, { \"money\": goldnum }];\r\n NetworkManager.Instance.HttpPostRequest(PROTOCOLS.end, agrs, new Laya.Handler(this, (_data) => {\r\n _cb();\r\n }), new Laya.Handler(this, (_data) => {\r\n console.log(\"游戏结果err\", _data);\r\n }));\r\n }\r\n OnClickNomalAward() {\r\n GameUtils.TweenButton(this.nomalaward, () => {\r\n this.GetSettment(() => {\r\n GameManager.Instance.ChangeGameState(GameState.Over, this.curwin);\r\n });\r\n });\r\n }\r\n OnGetAward() {\r\n if (Laya.Browser.onMobile) {\r\n TtSdk.ShowVideo((flag) => {\r\n if (flag) {\r\n this.GetSettment(() => {\r\n GameManager.Instance.ChangeGameState(GameState.Over, this.curwin);\r\n }, true);\r\n }\r\n });\r\n }\r\n else {\r\n this.GetSettment(() => {\r\n GameManager.Instance.ChangeGameState(GameState.Over, this.curwin);\r\n }, true);\r\n }\r\n }\r\n}\r\n",
  3. "references": [
  4. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Window/Component/IWindow.ts",
  5. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/ui/layaMaxUI.ts",
  6. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/LevelMaker.ts",
  7. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/LevelManager.ts",
  8. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/GameManager.ts",
  9. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Network/PlayerAccount.ts",
  10. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Network/NetworkManager.ts",
  11. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/GameUtils.ts",
  12. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/DataMaker.ts",
  13. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Window/WindowManager.ts",
  14. "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/TtSdk.ts"
  15. ]
  16. }