UNPKG

@mai3/phaser-sdk

Version:

A UI component library based on the Phaser game engine

59 lines (58 loc) 2.28 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); //此脚本暂时没用了 import { Slider } from './Slider'; import { Container } from './Container'; var VolumeSlider = /** @class */ (function (_super) { __extends(VolumeSlider, _super); function VolumeSlider(scene, config) { var _this = _super.call(this, scene, config) || this; _this.Type = 'VolumeSlider'; _this.draw(config); return _this; } VolumeSlider.prototype.draw = function (config) { var _a; if (this.slider) { this.slider.destroy(); } this.slider = new Slider(this.scene, config); this.slider.setPosition(0, 0); this.addChild(this.slider); this.sliderLabel = this.createLabel(config); this.addChild(this.sliderLabel); this.sliderLabel.setPosition(0, 0); this.slider.y = this.sliderLabel.displayHeight + this.slider.btnRadius / 2; this.setDepth((_a = config.depth) !== null && _a !== void 0 ? _a : 1); }; VolumeSlider.prototype.reDraw = function (config) { this.draw(config); }; VolumeSlider.prototype.createLabel = function (config) { var _a; var content = (_a = config.text) !== null && _a !== void 0 ? _a : "BGM Volume"; var label = this.scene.make.text({}); label.setText(content); label.setStyle({ fontStyle: "Bold", fontSize: 32, color: '#fff', }); return label; }; return VolumeSlider; }(Container)); export { VolumeSlider };