MCPcopy Create free account
hub / github.com/esengine/esengine / constructExtension

Method constructExtension

packages/fairygui/src/widgets/GButton.ts:475–508  ·  view source on GitHub ↗
(buffer: ByteBuffer)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 9

setStateMethod · 0.95
readByteMethod · 0.80
readSMethod · 0.80
getFloat32Method · 0.80
setPivotMethod · 0.80
seekMethod · 0.65
getControllerMethod · 0.45
getChildMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected