UNPKG

@mai3/phaser-sdk

Version:

A UI component library based on the Phaser game engine

142 lines (141 loc) 6.21 kB
import { Label } from "../ui/Label"; import { Checkbox } from "../ui/Checkbox"; import { Slider } from "../ui/Slider"; import { VolumeSlider } from "../ui/VolumeSlider"; import { CheckboxGroup } from "../ui/CheckboxGroup"; import { Dialog } from "../ui/Dialog"; import { Image } from "../ui/Image"; import { Text } from "../ui/Text"; import { Container } from "../ui/Container"; import { RoundedButton } from "../ui/RoundedButton"; import { TextButton } from "../ui/TextButton"; import { ImageButton } from "../ui/ImageButton"; import { TextBox } from "../ui/TextBox"; import { Tabs } from "../ui/Tabs"; import { TextArea } from "../ui/TextArea"; import { Toast } from "../ui/Toast"; import { LinearLayout } from "../ui/LinearLayout"; import { ScrollView } from "../ui/ScrollView"; import { Panel } from "../ui/Panel"; import { ProgressBar } from "../ui/ProgressBar"; import { Grid } from "../ui/Grid"; import { Sprite } from "../ui/Sprite"; import { DropdownMenu } from "../ui/DropdownMenu"; import { ConnectWalletButton } from "../ui/ConnectWalletButton"; import { ListView } from "../ui"; import { Joystick } from "../ui/Joystick"; import { ConnectSOLWalletButton } from "../ui/ConnectSOLWalletButton"; import { ConnectEVMWalletButton } from "../ui/ConnectEVMWalletButton"; import { EnemyContainer } from "../ui/EnemyContainer"; var ObjectFactory = /** @class */ (function () { function ObjectFactory(scene, addToScene) { this.scene = scene; this.displayList = scene.sys.displayList; this.updateList = scene.sys.updateList; this.addToScene = addToScene; scene.events.once('destroy', this.destroy, this); } ObjectFactory.prototype.destroy = function () { this.displayList = undefined; this.updateList = undefined; }; ObjectFactory.prototype.createGameObject = function (ctor, scene, config) { var gameObject = new ctor(scene, config); if (this.addToScene) this.scene.add.existing(gameObject); return gameObject; }; ObjectFactory.prototype.container = function (config) { return this.createGameObject(Container, this.scene, config); }; ObjectFactory.prototype.imageButton = function (config) { return this.createGameObject(ImageButton, this.scene, config); }; ObjectFactory.prototype.roundedButton = function (config) { return this.createGameObject(RoundedButton, this.scene, config); }; ObjectFactory.prototype.textButton = function (config) { return this.createGameObject(TextButton, this.scene, config); }; ObjectFactory.prototype.image = function (config) { return this.createGameObject(Image, this.scene, config); }; ObjectFactory.prototype.text = function (config) { return this.createGameObject(Text, this.scene, config); }; ObjectFactory.prototype.panel = function (config) { return this.createGameObject(Panel, this.scene, config); }; ObjectFactory.prototype.label = function (config) { return this.createGameObject(Label, this.scene, config); }; ObjectFactory.prototype.checkbox = function (config) { return this.createGameObject(Checkbox, this.scene, config); }; ObjectFactory.prototype.checkboxGroup = function (config) { return this.createGameObject(CheckboxGroup, this.scene, config); }; ObjectFactory.prototype.progressBar = function (config) { return this.createGameObject(ProgressBar, this.scene, config); }; ObjectFactory.prototype.slider = function (config) { return this.createGameObject(Slider, this.scene, config); }; ObjectFactory.prototype.volumeSlider = function (config) { return this.createGameObject(VolumeSlider, this.scene, config); }; ObjectFactory.prototype.dialog = function (config) { return this.createGameObject(Dialog, this.scene, config); }; ObjectFactory.prototype.tabs = function (config) { return this.createGameObject(Tabs, this.scene, config); }; ObjectFactory.prototype.textBox = function (config) { return this.createGameObject(TextBox, this.scene, config); }; ObjectFactory.prototype.textArea = function (config) { return this.createGameObject(TextArea, this.scene, config); }; ObjectFactory.prototype.toast = function (config) { return this.createGameObject(Toast, this.scene, config); }; ObjectFactory.prototype.grid = function (config) { return this.createGameObject(Grid, this.scene, config); }; // flexLayout(config: FlexLayoutConfig): FlexLayout { // return this.createGameObject(FlexLayout, this.scene, config); // } ObjectFactory.prototype.linearLayout = function (config) { return this.createGameObject(LinearLayout, this.scene, config); }; ObjectFactory.prototype.listView = function (config) { return this.createGameObject(ListView, this.scene, config); }; ObjectFactory.prototype.scrollView = function (config) { return this.createGameObject(ScrollView, this.scene, config); }; ObjectFactory.prototype.sprite = function (config) { return this.createGameObject(Sprite, this.scene, config); }; ObjectFactory.prototype.connectWalletButton = function (config) { return this.createGameObject(ConnectWalletButton, this.scene, config); }; ObjectFactory.prototype.connectSOLWalletButton = function (config) { return this.createGameObject(ConnectSOLWalletButton, this.scene, config); }; ObjectFactory.prototype.connectEVMWalletButton = function (config) { return this.createGameObject(ConnectEVMWalletButton, this.scene, config); }; ObjectFactory.prototype.dropdownMenu = function (config) { return this.createGameObject(DropdownMenu, this.scene, config); }; ObjectFactory.prototype.joystick = function (config) { return this.createGameObject(Joystick, this.scene, config); }; ObjectFactory.prototype.enemyContainer = function (config) { return this.createGameObject(EnemyContainer, this.scene, config); }; return ObjectFactory; }()); ; export default ObjectFactory;