{
  "code": "import { ui } from \"../ui/layaMaxUI\";\r\nimport { GameTool } from \"../Util/GameTool\";\r\nimport { GuangGao } from \"../Net/GuangGao\";\r\nimport { WXSdk } from \"../Net/WXSdk\";\r\nimport { ViewManager, ViewType } from \"../Net/ViewManager\";\r\nimport UserModel from \"../Net/UserModel\";\r\nimport NetManager, { PROTOCOLS } from \"../Net/NetManager\";\r\nexport default class GiftView extends ui.GiftViewUI {\r\n    constructor() {\r\n        super();\r\n        this.shownum = 3;\r\n        this.nowshownum = 0;\r\n        this._isComplete = false;\r\n        this._bannerVal = 0.5;\r\n        this._maxClickCnt = 12;\r\n        this._clickCnt = 0;\r\n        this._interval = 500;\r\n        this._decrement = 0.03;\r\n        GiftView.ins = this;\r\n    }\r\n    static get Instance() {\r\n        if (GiftView.ins == null) {\r\n            return new GiftView();\r\n        }\r\n        return GiftView.ins;\r\n    }\r\n    RefreshData() {\r\n    }\r\n    RegButton() {\r\n    }\r\n    Resize() {\r\n    }\r\n    RefreshUI(data) {\r\n    }\r\n    OnShow() {\r\n        this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false);\r\n        this._bannerVal = GameTool.randRangefloat(0.35, 0.75);\r\n        this.click.play(0, true);\r\n        this.jinduBar.value = 0;\r\n        Laya.timer.loop(this._interval, this, this.Daojishi);\r\n        WXSdk.OnShow(this.onBannerHide);\r\n        GuangGao.Instance.showBanner((banner) => {\r\n            console.log(\"礼盒界面出现banner---\");\r\n            console.log(\"banner加载完毕--\", banner);\r\n            this.banner = banner[\"banner\"];\r\n            banner[\"banner\"].hide();\r\n        }, () => {\r\n        });\r\n        this.height = Laya.stage.height;\r\n        this.BG.height = Laya.stage.height;\r\n        Laya.stage.on(Laya.Event.RESIZE, this, () => {\r\n            this.BG.height = Laya.stage.height;\r\n            this.height = Laya.stage.height;\r\n        });\r\n    }\r\n    OnClose() {\r\n    }\r\n    QiaoDa() {\r\n        this.click.stop();\r\n        this.shou.visible = false;\r\n        if (!this._isComplete) {\r\n            this._clickCnt++;\r\n            if (this._clickCnt > this._maxClickCnt)\r\n                this._clickCnt = this._maxClickCnt;\r\n            let pv = this._clickCnt / this._maxClickCnt;\r\n            if (pv >= 1) {\r\n                pv = 1;\r\n            }\r\n            this.jinduBar.value = pv;\r\n            if (pv >= this._bannerVal && this.nowshownum < this.shownum) {\r\n                if (this.banner) {\r\n                    console.log(\"有banner\", this.banner);\r\n                    this.banner.show();\r\n                    this.nowshownum++;\r\n                    Laya.timer.once(2000, this, () => {\r\n                        this.banner.hide();\r\n                        this._bannerVal = GameTool.randRangefloat(0.35, 0.75);\r\n                    });\r\n                }\r\n            }\r\n            if (pv >= 1) {\r\n                this._isComplete = true;\r\n                this.onBannerHide();\r\n            }\r\n        }\r\n    }\r\n    Daojishi() {\r\n        let pv = this.jinduBar.value;\r\n        pv -= this._decrement;\r\n        if (pv <= 0)\r\n            pv = 0;\r\n        this.jinduBar.value = pv;\r\n        if (this._clickCnt > 2) {\r\n            this._clickCnt -= 2;\r\n        }\r\n    }\r\n    onBannerHide() {\r\n        if (GiftView.Instance.banner)\r\n            GiftView.Instance.banner.hide();\r\n        WXSdk.OffShow(this.onBannerHide);\r\n        ViewManager.Instance.CloseView(ViewType.GiftView);\r\n        var param = [{ \"t\": UserModel.Instance.CurModel.ServerTime.toString() }, { \"reward_item\": \"1000\" }, { \"reward_num\": \"200\" }];\r\n        NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {\r\n            ViewManager.Instance.ShowTips(\"金币:X\" + 200);\r\n        }, (data) => {\r\n        });\r\n    }\r\n}\r\n//# sourceMappingURL=GiftView.js.map",
  "references": [
    "C:/Users/admin/Desktop/？？/gungang/src/ui/layaMaxUI.ts",
    "C:/Users/admin/Desktop/？？/gungang/src/Util/GameTool.ts",
    "C:/Users/admin/Desktop/？？/gungang/src/Net/GuangGao.ts",
    "C:/Users/admin/Desktop/？？/gungang/src/Net/WXSdk.ts",
    "C:/Users/admin/Desktop/？？/gungang/src/Net/ViewManager.ts",
    "C:/Users/admin/Desktop/？？/gungang/src/Net/UserModel.ts",
    "C:/Users/admin/Desktop/？？/gungang/src/Net/NetManager.ts"
  ],
  "map": "{\"version\":3,\"file\":\"GiftView.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/View/GiftView.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,EAAE,CAAC,UAAU;IAgB/C;QACI,KAAK,EAAE,CAAC;QAbJ,YAAO,GAAU,CAAC,CAAC;QAEnB,eAAU,GAAU,CAAC,CAAC;QACtB,gBAAW,GAAG,KAAK,CAAC;QACpB,eAAU,GAAG,GAAG,CAAC;QACjB,iBAAY,GAAG,EAAE,CAAC;QAClB,cAAS,GAAG,CAAC,CAAC;QACd,cAAS,GAAG,GAAG,CAAC;QAChB,eAAU,GAAG,IAAI,CAAC;QAMtB,QAAQ,CAAC,GAAG,GAAG,IAAI,CAAC;IACxB,CAAC;IACM,MAAM,KAAK,QAAQ;QACtB,IAAG,QAAQ,CAAC,GAAG,IAAI,IAAI,EAAC;YACpB,OAAO,IAAI,QAAQ,EAAE,CAAC;SACzB;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC;IACxB,CAAC;IACD,WAAW;IAEX,CAAC;IACD,SAAS;IAET,CAAC;IACD,MAAM;IAEN,CAAC;IACD,SAAS,CAAC,IAAK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