(buffer: ByteBuffer)
| 473 | } |
| 474 | |
| 475 | protected constructExtension(buffer: ByteBuffer): void { |
| 476 | buffer.seek(0, 6); |
| 477 | |
| 478 | this._mode = buffer.readByte(); |
| 479 | const str = buffer.readS(); |
| 480 | if (str) { |
| 481 | this._sound = str; |
| 482 | } |
| 483 | this._soundVolumeScale = buffer.getFloat32(); |
| 484 | this._downEffect = buffer.readByte(); |
| 485 | this._downEffectValue = buffer.getFloat32(); |
| 486 | if (this._downEffect === 2) { |
| 487 | this.setPivot(0.5, 0.5, this.pivotAsAnchor); |
| 488 | } |
| 489 | |
| 490 | this._buttonController = this.getController('button'); |
| 491 | this._titleObject = this.getChild('title'); |
| 492 | this._iconObject = this.getChild('icon'); |
| 493 | if (this._titleObject) { |
| 494 | this._title = this._titleObject.text || ''; |
| 495 | } |
| 496 | if (this._iconObject) { |
| 497 | this._icon = this._iconObject.icon || ''; |
| 498 | } |
| 499 | |
| 500 | if (this._mode === EButtonMode.Common) { |
| 501 | this.setState(GButton.UP); |
| 502 | } |
| 503 | |
| 504 | this.on(FGUIEvents.ROLL_OVER, this.handleRollOver, this); |
| 505 | this.on(FGUIEvents.ROLL_OUT, this.handleRollOut, this); |
| 506 | this.on(FGUIEvents.TOUCH_BEGIN, this.handleTouchBegin, this); |
| 507 | this.on(FGUIEvents.CLICK, this.handleClick, this); |
| 508 | } |
| 509 | |
| 510 | public setup_afterAdd(buffer: ByteBuffer, beginPos: number): void { |
| 511 | super.setup_afterAdd(buffer, beginPos); |
nothing calls this directly
no test coverage detected