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;QADC,QAAQ;4DACoB;IAE7B;QADC,QAAQ;mEACsB;IAE/B;QADC,QAAQ;0DACc;IAEvB;QADC,QAAQ;2DACe;IAExB;QADC,QAAQ;4DACoB;IAE7B;QADC,QAAQ;oEAC0B;IAnBlB,mBAAmB;QADvC,OAAO;OACa,mBAAmB,CAmGvC;IAAD,0BAAC;KAAA;kBAnGoB,mBAAmB","file":"","sourceRoot":"/","sourcesContent":["import { DummyPageView, DummySpriteFrame } from \"../../common/CCDummyObjects\";\n\nconst { ccclass, property } = cc._decorator;\n\n@ccclass\nexport default class PageViewIndicatorEx extends cc.Component {\n\n @property(cc.SpriteFrame)\n unselectSpriteFrame: cc.SpriteFrame = DummySpriteFrame;\n @property(cc.SpriteFrame)\n selectSpriteFrame: cc.SpriteFrame = DummySpriteFrame;\n @property(cc.PageView)\n handlerPageView: cc.PageView = DummyPageView;\n @property\n touchEnable: boolean = false;\n @property\n curPageSelectIndex: number = 0;\n @property\n cellWidth: number = 20;\n @property\n cellHeight: number = 20;\n @property\n autoRefresh: boolean = false;\n @property\n autoRefreshDuration: number = 5000;\n\n _nodeReady: boolean = false;\n _indicatorArr: cc.Node[] = [];\n _timeTicker: number = -1;\n\n onLoad() {\n if (!this.handlerPageView) {\n return;\n }\n this._createIndicator();\n this.selectIndex(this.curPageSelectIndex);\n }\n\n _createIndicator() {\n let pagesNum: number = this.handlerPageView.getPages().length;\n this.node.removeAllChildren(true);\n for (let i = 0; i < pagesNum; i++) {\n let node = new cc.Node();\n let sprite: cc.Sprite = node.addComponent(cc.Sprite);\n sprite.spriteFrame = this.unselectSpriteFrame;\n sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;\n node.width = this.cellWidth;\n node.height = this.cellHeight;\n if (this.touchEnable) {\n node.off('click');\n node.addComponent(cc.Button);\n node.on('click', () => {\n this.onIndicatorClick(i);\n });\n }\n this.node.addChild(node);\n this._indicatorArr.push(node);\n }\n this._nodeReady = true;\n }\n\n onIndicatorClick = (index: number) => {\n if (!this.handlerPageView) {\n return;\n }\n this.handlerPageView.setCurrentPageIndex(index);\n }\n\n selectIndex = (index: number) => {\n for (let i = 0; i < this._indicatorArr.length; i++) {\n let spr = this._indicatorArr[i].getComponent(cc.Sprite);\n spr.spriteFrame = i === index ? this.selectSpriteFrame : this.unselectSpriteFrame;\n }\n this.curPageSelectIndex = index;\n }\n\n start() {\n if (this.autoRefresh) {\n if (this._timeTicker !== (-1)) {\n clearInterval(this._timeTicker);\n }\n this._timeTicker = setInterval(() => {\n this.onIndicatorClick((this.curPageSelectIndex + 1) % this.handlerPageView.getPages().length);\n }, this.autoRefreshDuration);\n }\n }\n\n handlerPageViewChangeIndex() {\n if (!this.handlerPageView) {\n return;\n }\n let curIndex: number = this.handlerPageView.getCurrentPageIndex();\n if (curIndex === this.curPageSelectIndex) {\n return;\n }\n this.selectIndex(curIndex);\n }\n\n update(dt) {\n if (!this._nodeReady) {\n return;\n }\n this.handlerPageViewChangeIndex();\n }\n}\n\n"]}