{
  "code": "export var SwitchButtonState;\r\n(function (SwitchButtonState) {\r\n    SwitchButtonState[SwitchButtonState[\"Close\"] = 0] = \"Close\";\r\n    SwitchButtonState[SwitchButtonState[\"Open\"] = 1] = \"Open\";\r\n})(SwitchButtonState || (SwitchButtonState = {}));\r\nexport class SwitchButton extends Laya.Script {\r\n    constructor() {\r\n        super();\r\n        this.ButtonState = SwitchButtonState.Close;\r\n    }\r\n    onAwake() {\r\n        this.openSprite = this.owner.getChildByName(\"openSprite\");\r\n        this.closeSprite = this.owner.getChildByName(\"closeSprite\");\r\n        this.button = this.owner.getChildByName(\"button\");\r\n        this.button.clickHandler = Laya.Handler.create(this, () => {\r\n            this.ChangeState(this.ButtonState);\r\n            this.ButtonState++;\r\n            if (this.ButtonState > 1) {\r\n                this.ButtonState = 0;\r\n            }\r\n        }, null, false);\r\n    }\r\n    Init(open = true, _openHandle = null, _closeHnadle = null) {\r\n        this.ButtonState = open ? SwitchButtonState.Open : SwitchButtonState.Close;\r\n        this.openHandle = _openHandle;\r\n        this.closeHandle = _closeHnadle;\r\n        this.ChangeState(this.ButtonState);\r\n        this.ButtonState++;\r\n        if (this.ButtonState > 1) {\r\n            this.ButtonState = 0;\r\n        }\r\n    }\r\n    get CurState() {\r\n        return this.ButtonState;\r\n    }\r\n    ChangeState(_state) {\r\n        switch (this.ButtonState) {\r\n            case SwitchButtonState.Close:\r\n                this.openSprite.visible = false;\r\n                this.closeSprite.visible = true;\r\n                this.closeHandle.run();\r\n                break;\r\n            case SwitchButtonState.Open:\r\n                this.openSprite.visible = true;\r\n                this.closeSprite.visible = false;\r\n                this.openHandle.run();\r\n                break;\r\n        }\r\n    }\r\n}\r\n//# sourceMappingURL=SwitchButton.js.map",
  "references": [],
  "map": "{\"version\":3,\"file\":\"SwitchButton.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/Window/Component/SwitchButton.ts\"],\"names\":[],\"mappings\":\"AAAA,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iB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