Коммит bf8dd22c создал по автору Medvedev Anton's avatar Medvedev Anton
Просмотр файлов

Конфиг Phaser вынесен из стартовой сцены

владелец 95b3bfac
import { AUTO, Scale, Types } from 'phaser';
export const getPhaserConfig = (scene: any): Types.Core.GameConfig => ({
type: AUTO,
parent: 'phaser-container',
width: window.innerWidth,
height: window.innerHeight,
scale: {
mode: Scale.FIT,
autoCenter: Scale.CENTER_BOTH,
},
scene: scene,
plugins: {
// scene: [
// {
// key: 'rexUI',
// plugin: RexPlugins,
// mapping: 'rexUI',
// },
// // ...
// ],
},
});
...@@ -28,6 +28,7 @@ import CreateToolbar from '../toolbar/CreateToolbar'; ...@@ -28,6 +28,7 @@ import CreateToolbar from '../toolbar/CreateToolbar';
import { watch, computed } from 'vue'; import { watch, computed } from 'vue';
import { Router } from 'vue-router'; import { Router } from 'vue-router';
import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin'; import UIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin';
import { getPhaserConfig } from './PhaserConfig';
declare const window: { declare const window: {
router: Router; router: Router;
...@@ -154,28 +155,7 @@ class EndlessCanvas extends Phaser.Scene { ...@@ -154,28 +155,7 @@ class EndlessCanvas extends Phaser.Scene {
} }
} }
const config: Phaser.Types.Core.GameConfig = { const config = getPhaserConfig(EndlessCanvas);
type: Phaser.AUTO,
parent: 'phaser-container',
width: window.innerWidth,
height: window.innerHeight,
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH,
},
scene: EndlessCanvas,
plugins: {
// scene: [
// {
// key: 'rexUI',
// plugin: RexPlugins,
// mapping: 'rexUI',
// },
// // ...
// ],
},
};
export default { export default {
name: 'EndlessCanvas', name: 'EndlessCanvas',
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать