DmitrMakeev commited on
Commit
da489f5
·
verified ·
1 Parent(s): 547a1fd

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +45 -12
pages.html CHANGED
@@ -924,7 +924,7 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
924
 
925
 
926
 
927
- <script>
928
  // Создаем новый тип компонента для настройки меню
929
  editor.Components.addType('phaser-settings-block', {
930
  model: {
@@ -933,39 +933,72 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
933
  content: '<div id="set_phaser"></div>',
934
  // Скрипт для обработки блока (если нужно)
935
  script: function(props) {
936
-
937
  const initBlock = () => {
938
  console.log('Menu settings block initialized with props:');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
  };
 
940
  const loadScript = (src, callback) => {
941
  const script = document.createElement('script');
942
  script.src = src;
943
  script.onload = callback;
944
  document.body.appendChild(script);
945
  };
 
946
  // Загружаем необходимые скрипты динамически
947
  loadScript('https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js', () => {
948
  console.log('Custom script loaded!');
949
  initBlock();
950
  });
951
  },
952
-
 
953
  }
954
  }
955
  });
 
956
  // Создаем блок для компонента настройки меню
957
- editor.Blocks.add('phaser-settings-block-block', {
958
- label: `
959
- <div style="display: flex; flex-direction: column; align-items: center;">
960
- <!-- icon666.com - MILLIONS vector ICONS FREE --><svg enable-background="new 0 0 152 152" xmlns="http://www.w3.org/2000/svg" width="36" height="36"><g id="Layer_2" data-name="Layer 2"><path d="m28 3h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 3a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m28 13h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 13a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m28 23h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 23a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path></g></svg>
961
- <span style="margin-top: 8px;">menu-set</span>
962
- </div>`,
963
- content: { type: 'phaser-settings-block' },
964
- });
965
  </script>
966
 
967
 
968
-
969
  <script>
970
  // Создаем новый тип компонента для настройки меню
971
  editor.Components.addType('menu-settings-block', {
 
924
 
925
 
926
 
927
+ <script>
928
  // Создаем новый тип компонента для настройки меню
929
  editor.Components.addType('phaser-settings-block', {
930
  model: {
 
933
  content: '<div id="set_phaser"></div>',
934
  // Скрипт для обработки блока (если нужно)
935
  script: function(props) {
 
936
  const initBlock = () => {
937
  console.log('Menu settings block initialized with props:');
938
+ // Создаем Phaser-игру
939
+ class MainScene extends Phaser.Scene {
940
+ constructor() {
941
+ super({ key: "MainScene" });
942
+ }
943
+
944
+ preload() {
945
+ this.load.image("earth", "https://cdn.phaser.io/sandbox/square-earth.png");
946
+ }
947
+
948
+ create() {
949
+ this.earth = this.add.image(400, 350, "earth");
950
+ }
951
+
952
+ update(time) {
953
+ this.earth.rotation += 0.005;
954
+ this.earth.y = this.earth.y + Math.sin(time / 1000 * 2);
955
+ }
956
+ }
957
+
958
+ const game = new Phaser.Game({
959
+ type: Phaser.AUTO,
960
+ width: 800,
961
+ height: 800,
962
+ backgroundColor: '#111111',
963
+ scale: {
964
+ mode: Phaser.Scale.FIT,
965
+ autoCenter: Phaser.Scale.CENTER_BOTH
966
+ },
967
+ scene: [ MainScene ]
968
+ });
969
  };
970
+
971
  const loadScript = (src, callback) => {
972
  const script = document.createElement('script');
973
  script.src = src;
974
  script.onload = callback;
975
  document.body.appendChild(script);
976
  };
977
+
978
  // Загружаем необходимые скрипты динамически
979
  loadScript('https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js', () => {
980
  console.log('Custom script loaded!');
981
  initBlock();
982
  });
983
  },
984
+ // Добавляем свойство 'script-props'
985
+ 'script-props': ['home_url']
986
  }
987
  }
988
  });
989
+
990
  // Создаем блок для компонента настройки меню
991
+ editor.Blocks.add('phaser-settings-block-block', {
992
+ label: `
993
+ <div style="display: flex; flex-direction: column; align-items: center;">
994
+ <!-- icon666.com - MILLIONS vector ICONS FREE --><svg enable-background="new 0 0 152 152" xmlns="http://www.w3.org/2000/svg" width="36" height="36"><g id="Layer_2" data-name="Layer 2"><path d="m28 3h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 3a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m28 13h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 13a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m28 23h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 23a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path></g></svg>
995
+ <span style="margin-top: 8px;">menu-set</span>
996
+ </div>`,
997
+ content: { type: 'phaser-settings-block' },
998
+ });
999
  </script>
1000
 
1001
 
 
1002
  <script>
1003
  // Создаем новый тип компонента для настройки меню
1004
  editor.Components.addType('menu-settings-block', {