{
  "code": "import { ui } from \"../ui/layaMaxUI\";\r\nimport { GameUtils } from \"../GameUtils/GameUtils\";\r\nimport { PlayerAccount } from \"../Scripts/Network/PlayerAccount\";\r\nimport ADPlayer from \"../WXSDK/ADPlayer\";\r\nimport { GameManager, GameState } from \"../Scripts/Game/GameManager\";\r\nimport { Player } from \"../Scripts/Game/Player\";\r\nexport class TrialWindow extends ui.Window.TrialWindowUI {\r\n    constructor() {\r\n        super();\r\n        TrialWindow.instance = this;\r\n    }\r\n    static get Instance() {\r\n        return TrialWindow.instance;\r\n    }\r\n    OnOpen(_data = null) {\r\n        this.hidebtn.clickHandler = Laya.Handler.create(this, this.OnTrialHide, null, false);\r\n        var trialid = [2, 3, 4, 5, 6, 8, 9, 10, 11];\r\n        var curids = [];\r\n        for (var i = 0; i < trialid.length; i++) {\r\n            var id = trialid[i];\r\n            if (!PlayerAccount.CurrentAccount.CurAccountData.HasHero(id)) {\r\n                curids.push(id);\r\n            }\r\n        }\r\n        var useids = [];\r\n        for (var i = curids.length - 1; i > -1; i--) {\r\n            if (useids.length < 4) {\r\n                var index = GameUtils.getRandomInt(0, curids.length - 1);\r\n                useids.push(curids[index]);\r\n                curids.splice(index, 1);\r\n            }\r\n        }\r\n        if (curids.length)\r\n            var skins = [];\r\n        if (useids.length > 0) {\r\n            for (var i = 0; i < useids.length; i++) {\r\n                var heroid = useids[i];\r\n                skins.push(PlayerAccount.CurrentAccount.CurAccountData.m_heroDic[heroid]);\r\n            }\r\n        }\r\n        else {\r\n            this.Pass();\r\n            return;\r\n        }\r\n        this.skinlist.array = skins;\r\n        for (var i = 0; i < this.skinlist.cells.length; i++) {\r\n            var cell = this.skinlist.cells[i];\r\n            var config = skins[i];\r\n            var icon = cell.getChildAt(0).getChildAt(0).getChildAt(0);\r\n            icon.skin = config.id > 6 ? \"trial/\" + config.curicon + \".png\" : \"shop/\" + config.curicon + \".png\";\r\n            var btn = cell.getChildAt(0).getChildAt(1);\r\n            btn.clickHandler = Laya.Handler.create(this, this.OnTrialHero, [config], false);\r\n        }\r\n        this.passbtn.clickHandler = Laya.Handler.create(this, this.Pass);\r\n        this.height = Laya.stage.height;\r\n        Laya.stage.on(Laya.Event.RESIZE, this, () => {\r\n            this.height = Laya.stage.height;\r\n        });\r\n    }\r\n    OnTrialHero(_skin) {\r\n        ADPlayer.showVideoAd((flag) => {\r\n            if (flag) {\r\n                Player.Instance.RessetPlayer(_skin);\r\n                GameManager.Instance.ChangeState(GameState.Queue);\r\n            }\r\n        });\r\n    }\r\n    Pass() {\r\n        GameManager.Instance.ChangeState(GameState.Queue);\r\n    }\r\n    OnTrialHide() {\r\n        TrialWindow.trial = !TrialWindow.trial;\r\n        this.ppp.visible = !TrialWindow.trial;\r\n    }\r\n    OnHide() {\r\n    }\r\n}\r\nTrialWindow.trial = true;\r\n",
  "references": [
    "C:/Users/admin/Desktop/runner/src/Window/Component/IWindow.ts",
    "C:/Users/admin/Desktop/runner/src/ui/layaMaxUI.ts",
    "C:/Users/admin/Desktop/runner/src/GameUtils/GameUtils.ts",
    "C:/Users/admin/Desktop/runner/src/Scripts/Network/PlayerAccount.ts",
    "C:/Users/admin/Desktop/runner/src/Scripts/Game/LevelData.ts",
    "C:/Users/admin/Desktop/runner/src/WXSDK/ADPlayer.ts",
    "C:/Users/admin/Desktop/runner/src/WXSDK/wxsdk.ts",
    "C:/Users/admin/Desktop/runner/src/Window/WindowManager.ts",
    "C:/Users/admin/Desktop/runner/src/Scripts/Game/GameManager.ts",
    "C:/Users/admin/Desktop/runner/src/Scripts/Game/Player.ts"
  ]
}
