In your game config:
import DragSelectPlugin from 'path-to';
const config = {
...
plugins: {
global: [
{ key: 'DragSelectPlugin', plugin: DragSelectPlugin }
]
},
...
this.dragSelect = this.plugins.start('DragSelectPlugin', 'dragSelect');
this.dragSelect.setup(this, {
camera: <MainGameSceneCamera>,
cameraEdgeAcceleration: 0.015,
cameraEdgeBuffer: 50,
childSelector: <Function>,
dragCameraBy: 2, // right-button
mouseClickToTrack: 1, // left-button
mouseAmendSelectWith: 'shift',
mouseToggleSelectWith: 'ctrl',
outlineColor: 0x00ff00,
outlineWidth: 2,
onPreview: <Function>,
onSelect: <Function>,
rectBgColor: 0x33ff33,
rectAlpha: 0.5,
});
Kind: global function
Param | Type | Description |
---|---|---|
scene | Phaser.Scene |
Target scene to attach the plugin's logic against |
config | Object |
Configuration object to pass to plugin |
Returns the current "enabled" status of the Plugin's "interface" scene
Updates the plugin's configuration with new values
Kind: global function
Param | Type | Description |
---|---|---|
config | Object |
new configuration object |
If enabled, disable the plugin
If not already enabled, enable the plugin
Kind: global function