import {BitmapText} from 'pixi.js'; import { SymbolConfig } from '../types/SlotMachineConfig'; import ReelSymbol from './ReelSymbol'; export default class ValuableReelSymbol extends ReelSymbol { private textObj: BitmapText; private _value: number; constructor(config: SymbolConfig) { super(config); } public set value(v: number) { if (v <= 0) return; !this.textObj && this.createValueText(); this._value = v; if (this.textObj) { this.textObj.text = `X${v}`; } } public get value(): number { return this._value; } private createValueText() { if (!this.config.fontStyle || !this.config.fontStyle.fontName) return; this.textObj = new BitmapText(`X${this.config.value}`, this.config.fontStyle); this.textObj.anchor.set(0.5); this.textObj.scale.set(1, -1); const slotIndex = this.spine.skeleton.findSlotIndex('value'); this.spine.slotContainers[slotIndex].addChild(this.textObj); } public override tint(hexColor: number): void { super.tint(hexColor); if (this.textObj) { this.textObj.tint = hexColor; } } }