cyberia 2.8.885
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +15 -0
- package/.env.development +45 -0
- package/.env.production +50 -0
- package/.env.test +45 -0
- package/.github/workflows/engine-cyberia.cd.yml +31 -0
- package/.github/workflows/engine-cyberia.ci.yml +60 -0
- package/.github/workflows/ghpkg.ci.yml +87 -0
- package/.github/workflows/npmpkg.ci.yml +72 -0
- package/.github/workflows/publish.ci.yml +84 -0
- package/.github/workflows/publish.cyberia.ci.yml +84 -0
- package/.github/workflows/pwa-microservices-template-page.cd.yml +72 -0
- package/.github/workflows/pwa-microservices-template-test.ci.yml +33 -0
- package/.github/workflows/release.cd.yml +37 -0
- package/.nycrc +9 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +51 -0
- package/.vscode/settings.json +87 -0
- package/AUTHORS.md +21 -0
- package/CHANGELOG.md +205 -0
- package/Dockerfile +28 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/bin/build.js +209 -0
- package/bin/cron.js +47 -0
- package/bin/cyberia.js +145 -0
- package/bin/db.js +199 -0
- package/bin/deploy.js +1293 -0
- package/bin/file.js +197 -0
- package/bin/hwt.js +49 -0
- package/bin/index.js +145 -0
- package/bin/ssl.js +63 -0
- package/bin/util.js +80 -0
- package/bin/vs.js +74 -0
- package/cli.md +714 -0
- package/conf.js +204 -0
- package/deployment.yaml +138 -0
- package/jsconfig.json +7 -0
- package/jsdoc.json +32 -0
- package/manifests/deployment/adminer/deployment.yaml +32 -0
- package/manifests/deployment/adminer/kustomization.yaml +7 -0
- package/manifests/deployment/adminer/service.yaml +13 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +167 -0
- package/manifests/deployment/dd-default-development/proxy.yaml +46 -0
- package/manifests/deployment/dd-test-development/deployment.yaml +174 -0
- package/manifests/deployment/dd-test-development/proxy.yaml +51 -0
- package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
- package/manifests/deployment/fastapi/backend-service.yml +19 -0
- package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
- package/manifests/deployment/fastapi/frontend-service.yml +15 -0
- package/manifests/deployment/fastapi/initial_data.sh +56 -0
- package/manifests/deployment/kafka/deployment.yaml +69 -0
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/deployment/spark/spark-pi-py.yaml +21 -0
- package/manifests/deployment/tensorflow/tf-gpu-test.yaml +65 -0
- package/manifests/envoy-service-nodeport.yaml +23 -0
- package/manifests/grafana/deployment.yaml +57 -0
- package/manifests/grafana/kustomization.yaml +7 -0
- package/manifests/grafana/pvc.yaml +12 -0
- package/manifests/grafana/service.yaml +14 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/kubeadm-calico-config.yaml +119 -0
- package/manifests/kubelet-config.yaml +65 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/lxd/lxd-admin-profile.yaml +17 -0
- package/manifests/lxd/lxd-preseed.yaml +30 -0
- package/manifests/lxd/underpost-setup.sh +163 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +56 -0
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +126 -0
- package/manifests/mongodb/storage-class.yaml +9 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/mysql/kustomization.yaml +7 -0
- package/manifests/mysql/pv-pvc.yaml +27 -0
- package/manifests/mysql/statefulset.yaml +55 -0
- package/manifests/postgresql/configmap.yaml +9 -0
- package/manifests/postgresql/kustomization.yaml +10 -0
- package/manifests/postgresql/pv.yaml +15 -0
- package/manifests/postgresql/pvc.yaml +13 -0
- package/manifests/postgresql/service.yaml +10 -0
- package/manifests/postgresql/statefulset.yaml +37 -0
- package/manifests/prometheus/deployment.yaml +82 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +11 -0
- package/manifests/valkey/statefulset.yaml +38 -0
- package/nodemon.json +6 -0
- package/package.json +118 -0
- package/proxy.yaml +35 -0
- package/scripts/device-scan.sh +43 -0
- package/scripts/gpu-diag.sh +19 -0
- package/scripts/maas-setup.sh +120 -0
- package/scripts/nat-iptables.sh +26 -0
- package/scripts/nvim.sh +91 -0
- package/scripts/snap-clean.sh +26 -0
- package/scripts/ssh-cluster-info.sh +14 -0
- package/scripts/ssl.sh +164 -0
- package/src/api/blockchain/blockchain.controller.js +51 -0
- package/src/api/blockchain/blockchain.model.js +90 -0
- package/src/api/blockchain/blockchain.router.js +21 -0
- package/src/api/blockchain/blockchain.service.js +24 -0
- package/src/api/core/core.controller.js +69 -0
- package/src/api/core/core.model.js +11 -0
- package/src/api/core/core.router.js +24 -0
- package/src/api/core/core.service.js +35 -0
- package/src/api/crypto/crypto.controller.js +51 -0
- package/src/api/crypto/crypto.model.js +23 -0
- package/src/api/crypto/crypto.router.js +20 -0
- package/src/api/crypto/crypto.service.js +64 -0
- package/src/api/default/default.controller.js +74 -0
- package/src/api/default/default.model.js +20 -0
- package/src/api/default/default.router.js +27 -0
- package/src/api/default/default.service.js +40 -0
- package/src/api/document/document.controller.js +66 -0
- package/src/api/document/document.model.js +51 -0
- package/src/api/document/document.router.js +24 -0
- package/src/api/document/document.service.js +133 -0
- package/src/api/file/file.controller.js +67 -0
- package/src/api/file/file.model.js +19 -0
- package/src/api/file/file.router.js +22 -0
- package/src/api/file/file.service.js +100 -0
- package/src/api/instance/instance.controller.js +69 -0
- package/src/api/instance/instance.model.js +40 -0
- package/src/api/instance/instance.router.js +34 -0
- package/src/api/instance/instance.service.js +70 -0
- package/src/api/ipfs/ipfs.controller.js +51 -0
- package/src/api/ipfs/ipfs.model.js +17 -0
- package/src/api/ipfs/ipfs.router.js +20 -0
- package/src/api/ipfs/ipfs.service.js +25 -0
- package/src/api/object-layer/README.md +85 -0
- package/src/api/object-layer/object-layer.controller.js +69 -0
- package/src/api/object-layer/object-layer.model.js +181 -0
- package/src/api/object-layer/object-layer.router.js +29 -0
- package/src/api/object-layer/object-layer.service.js +49 -0
- package/src/api/test/test.controller.js +59 -0
- package/src/api/test/test.model.js +14 -0
- package/src/api/test/test.router.js +21 -0
- package/src/api/test/test.service.js +35 -0
- package/src/api/user/postman_collection.json +216 -0
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +35 -0
- package/src/api/user/user.model.js +100 -0
- package/src/api/user/user.router.js +400 -0
- package/src/api/user/user.service.js +500 -0
- package/src/api.js +23 -0
- package/src/cli/baremetal.js +1310 -0
- package/src/cli/cloud-init.js +548 -0
- package/src/cli/cluster.js +834 -0
- package/src/cli/cron.js +95 -0
- package/src/cli/db.js +414 -0
- package/src/cli/deploy.js +661 -0
- package/src/cli/env.js +101 -0
- package/src/cli/fs.js +256 -0
- package/src/cli/image.js +156 -0
- package/src/cli/index.js +436 -0
- package/src/cli/lxd.js +402 -0
- package/src/cli/monitor.js +260 -0
- package/src/cli/repository.js +274 -0
- package/src/cli/run.js +728 -0
- package/src/cli/script.js +85 -0
- package/src/cli/secrets.js +71 -0
- package/src/cli/ssh.js +46 -0
- package/src/cli/test.js +159 -0
- package/src/client/Cyberia.index.js +50 -0
- package/src/client/CyberiaAdmin.index.js +34 -0
- package/src/client/CyberiaPortal.index.js +36 -0
- package/src/client/Default.index.js +84 -0
- package/src/client/components/core/404.js +20 -0
- package/src/client/components/core/500.js +20 -0
- package/src/client/components/core/Account.js +326 -0
- package/src/client/components/core/AgGrid.js +191 -0
- package/src/client/components/core/Alert.js +77 -0
- package/src/client/components/core/Auth.js +342 -0
- package/src/client/components/core/Badge.js +32 -0
- package/src/client/components/core/Blockchain.js +41 -0
- package/src/client/components/core/Blog.js +9 -0
- package/src/client/components/core/BtnIcon.js +111 -0
- package/src/client/components/core/CalendarCore.js +464 -0
- package/src/client/components/core/Chat.js +64 -0
- package/src/client/components/core/ColorPalette.js +5267 -0
- package/src/client/components/core/CommonJs.js +1010 -0
- package/src/client/components/core/Content.js +196 -0
- package/src/client/components/core/Css.js +1099 -0
- package/src/client/components/core/CssCore.js +882 -0
- package/src/client/components/core/D3Chart.js +44 -0
- package/src/client/components/core/Docs.js +376 -0
- package/src/client/components/core/DropDown.js +223 -0
- package/src/client/components/core/EventsUI.js +133 -0
- package/src/client/components/core/FileExplorer.js +707 -0
- package/src/client/components/core/FullScreen.js +36 -0
- package/src/client/components/core/Input.js +383 -0
- package/src/client/components/core/JoyStick.js +80 -0
- package/src/client/components/core/Keyboard.js +73 -0
- package/src/client/components/core/LoadingAnimation.js +159 -0
- package/src/client/components/core/LogIn.js +190 -0
- package/src/client/components/core/LogOut.js +63 -0
- package/src/client/components/core/Logger.js +29 -0
- package/src/client/components/core/Modal.js +2494 -0
- package/src/client/components/core/NotificationManager.js +84 -0
- package/src/client/components/core/ObjectLayerEngine.js +1229 -0
- package/src/client/components/core/ObjectLayerEngineModal.js +443 -0
- package/src/client/components/core/Pagination.js +207 -0
- package/src/client/components/core/Panel.js +772 -0
- package/src/client/components/core/PanelForm.js +627 -0
- package/src/client/components/core/Polyhedron.js +162 -0
- package/src/client/components/core/Recover.js +207 -0
- package/src/client/components/core/Responsive.js +82 -0
- package/src/client/components/core/RichText.js +43 -0
- package/src/client/components/core/Router.js +317 -0
- package/src/client/components/core/Scroll.js +76 -0
- package/src/client/components/core/SignUp.js +125 -0
- package/src/client/components/core/SocketIo.js +74 -0
- package/src/client/components/core/Stream.js +113 -0
- package/src/client/components/core/ToggleSwitch.js +101 -0
- package/src/client/components/core/ToolTip.js +90 -0
- package/src/client/components/core/Translate.js +522 -0
- package/src/client/components/core/Validator.js +115 -0
- package/src/client/components/core/VanillaJs.js +423 -0
- package/src/client/components/core/Wallet.js +106 -0
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Webhook.js +25 -0
- package/src/client/components/core/Worker.js +371 -0
- package/src/client/components/core/windowGetDimensions.js +269 -0
- package/src/client/components/cyberia/BagCyberia.js +1253 -0
- package/src/client/components/cyberia/BiomeCyberia.js +130 -0
- package/src/client/components/cyberia/CharacterCyberia.js +321 -0
- package/src/client/components/cyberia/CommonCyberia.js +1834 -0
- package/src/client/components/cyberia/CssCyberia.js +816 -0
- package/src/client/components/cyberia/ElementPreviewCyberia.js +183 -0
- package/src/client/components/cyberia/ElementsCyberia.js +146 -0
- package/src/client/components/cyberia/InteractionPanelCyberia.js +1043 -0
- package/src/client/components/cyberia/JoyStickCyberia.js +53 -0
- package/src/client/components/cyberia/LogInCyberia.js +68 -0
- package/src/client/components/cyberia/LogOutCyberia.js +24 -0
- package/src/client/components/cyberia/MainUserCyberia.js +424 -0
- package/src/client/components/cyberia/MapCyberia.js +160 -0
- package/src/client/components/cyberia/MatrixCyberia.js +147 -0
- package/src/client/components/cyberia/MenuCyberia.js +575 -0
- package/src/client/components/cyberia/PixiCyberia.js +1639 -0
- package/src/client/components/cyberia/PointAndClickMovementCyberia.js +146 -0
- package/src/client/components/cyberia/QuestCyberia.js +1420 -0
- package/src/client/components/cyberia/RoutesCyberia.js +47 -0
- package/src/client/components/cyberia/SettingsCyberia.js +16 -0
- package/src/client/components/cyberia/SignUpCyberia.js +14 -0
- package/src/client/components/cyberia/SkillCyberia.js +124 -0
- package/src/client/components/cyberia/SocketIoCyberia.js +211 -0
- package/src/client/components/cyberia/TileCyberia.js +685 -0
- package/src/client/components/cyberia/TranslateCyberia.js +96 -0
- package/src/client/components/cyberia/UniverseCyberia.js +14 -0
- package/src/client/components/cyberia/WebhookCyberia.js +13 -0
- package/src/client/components/cyberia/WikiCyberia.js +144 -0
- package/src/client/components/cyberia/WorldCyberia.js +680 -0
- package/src/client/components/cyberia-admin/BiomeCyberiaAdmin.js +978 -0
- package/src/client/components/cyberia-admin/CommonCyberiaAdmin.js +29 -0
- package/src/client/components/cyberia-admin/CssCyberiaAdmin.js +15 -0
- package/src/client/components/cyberia-admin/ElementsCyberiaAdmin.js +38 -0
- package/src/client/components/cyberia-admin/InstanceEngineCyberiaAdmin.js +180 -0
- package/src/client/components/cyberia-admin/LogInCyberiaAdmin.js +34 -0
- package/src/client/components/cyberia-admin/LogOutCyberiaAdmin.js +24 -0
- package/src/client/components/cyberia-admin/MenuCyberiaAdmin.js +660 -0
- package/src/client/components/cyberia-admin/RoutesCyberiaAdmin.js +57 -0
- package/src/client/components/cyberia-admin/ServerCyberiaAdmin.js +129 -0
- package/src/client/components/cyberia-admin/SettingsCyberiaAdmin.js +16 -0
- package/src/client/components/cyberia-admin/SignUpCyberiaAdmin.js +11 -0
- package/src/client/components/cyberia-admin/SocketIoCyberiaAdmin.js +53 -0
- package/src/client/components/cyberia-admin/TranslateCyberiaAdmin.js +7 -0
- package/src/client/components/cyberia-biome/CityCyberiaBiome.js +209 -0
- package/src/client/components/cyberia-biome/CityInteriorCyberiaBiome.js +253 -0
- package/src/client/components/cyberia-biome/ColorChaosCyberiaBiome.js +26 -0
- package/src/client/components/cyberia-biome/ForestCyberiaBiome.js +191 -0
- package/src/client/components/cyberia-biome/GridBaseCyberiaBiome.js +364 -0
- package/src/client/components/cyberia-biome/SeedCityCyberiaBiome.js +347 -0
- package/src/client/components/cyberia-biome/ShopCyberiaBiome.js +12 -0
- package/src/client/components/cyberia-biome/SpaceCyberiaBiome.js +58 -0
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +29 -0
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +132 -0
- package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +38 -0
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +18 -0
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +12 -0
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +487 -0
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +45 -0
- package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +136 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +16 -0
- package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +11 -0
- package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +52 -0
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +12 -0
- package/src/client/components/default/CommonDefault.js +29 -0
- package/src/client/components/default/CssDefault.js +27 -0
- package/src/client/components/default/ElementsDefault.js +38 -0
- package/src/client/components/default/LogInDefault.js +14 -0
- package/src/client/components/default/LogOutDefault.js +10 -0
- package/src/client/components/default/MenuDefault.js +743 -0
- package/src/client/components/default/RoutesDefault.js +48 -0
- package/src/client/components/default/SettingsDefault.js +16 -0
- package/src/client/components/default/SignUpDefault.js +9 -0
- package/src/client/components/default/SocketIoDefault.js +54 -0
- package/src/client/components/default/TranslateDefault.js +7 -0
- package/src/client/public/default/android-chrome-144x144.png +0 -0
- package/src/client/public/default/android-chrome-192x192.png +0 -0
- package/src/client/public/default/android-chrome-256x256.png +0 -0
- package/src/client/public/default/android-chrome-36x36.png +0 -0
- package/src/client/public/default/android-chrome-384x384.png +0 -0
- package/src/client/public/default/android-chrome-48x48.png +0 -0
- package/src/client/public/default/android-chrome-512x512.png +0 -0
- package/src/client/public/default/android-chrome-72x72.png +0 -0
- package/src/client/public/default/android-chrome-96x96.png +0 -0
- package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
- package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
- package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
- package/src/client/public/default/assets/background/dark.jpg +0 -0
- package/src/client/public/default/assets/background/dark.svg +557 -0
- package/src/client/public/default/assets/background/white.jpg +0 -0
- package/src/client/public/default/assets/background/white0-min.jpg +0 -0
- package/src/client/public/default/assets/background/white0.jpg +0 -0
- package/src/client/public/default/assets/logo/base-icon.png +0 -0
- package/src/client/public/default/assets/logo/underpost.gif +0 -0
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-default-avatar.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +12 -0
- package/src/client/public/default/favicon-16x16.png +0 -0
- package/src/client/public/default/favicon-32x32.png +0 -0
- package/src/client/public/default/favicon-48x48.png +0 -0
- package/src/client/public/default/favicon.ico +0 -0
- package/src/client/public/default/manifest.webmanifest +69 -0
- package/src/client/public/default/mstile-144x144.png +0 -0
- package/src/client/public/default/mstile-150x150.png +0 -0
- package/src/client/public/default/mstile-310x150.png +0 -0
- package/src/client/public/default/mstile-310x310.png +0 -0
- package/src/client/public/default/mstile-70x70.png +0 -0
- package/src/client/public/default/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/safari-pinned-tab.svg +24 -0
- package/src/client/public/default/site.webmanifest +69 -0
- package/src/client/public/default/sitemap +148 -0
- package/src/client/public/default/yandex-browser-50x50.png +0 -0
- package/src/client/public/default/yandex-browser-manifest.json +9 -0
- package/src/client/public/doc/favicon.ico +0 -0
- package/src/client/public/doc/sitemap +148 -0
- package/src/client/public/test/favicon.ico +0 -0
- package/src/client/public/test/sitemap +148 -0
- package/src/client/services/blockchain/blockchain.service.js +73 -0
- package/src/client/services/core/core.service.js +165 -0
- package/src/client/services/crypto/crypto.service.js +73 -0
- package/src/client/services/default/default.management.js +450 -0
- package/src/client/services/default/default.service.js +98 -0
- package/src/client/services/document/document.service.js +97 -0
- package/src/client/services/file/file.service.js +72 -0
- package/src/client/services/instance/instance.management.js +78 -0
- package/src/client/services/instance/instance.service.js +97 -0
- package/src/client/services/ipfs/ipfs.service.js +73 -0
- package/src/client/services/object-layer/object-layer.service.js +93 -0
- package/src/client/services/test/test.service.js +73 -0
- package/src/client/services/user/user.management.js +56 -0
- package/src/client/services/user/user.service.js +108 -0
- package/src/client/ssr/Render.js +237 -0
- package/src/client/ssr/body/404.js +73 -0
- package/src/client/ssr/body/500.js +72 -0
- package/src/client/ssr/body/CacheControl.js +114 -0
- package/src/client/ssr/body/CyberiaDefaultSplashScreen.js +90 -0
- package/src/client/ssr/body/CyberiaSplashScreenLore.js +424 -0
- package/src/client/ssr/body/DefaultSplashScreen.js +90 -0
- package/src/client/ssr/email/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/email/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/head/Css.js +241 -0
- package/src/client/ssr/head/CyberiaAdminScripts.js +6 -0
- package/src/client/ssr/head/CyberiaPortalScripts.js +6 -0
- package/src/client/ssr/head/CyberiaScripts.js +6 -0
- package/src/client/ssr/head/DefaultScripts.js +6 -0
- package/src/client/ssr/head/Microdata.js +11 -0
- package/src/client/ssr/head/Production.js +1 -0
- package/src/client/ssr/head/Pwa.js +146 -0
- package/src/client/ssr/head/Seo.js +15 -0
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +67 -0
- package/src/client/ssr/pages/404.js +12 -0
- package/src/client/ssr/pages/500.js +12 -0
- package/src/client/ssr/pages/Test.js +198 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +108 -0
- package/src/client/sw/template.sw.js +84 -0
- package/src/client.build.js +22 -0
- package/src/client.dev.js +24 -0
- package/src/db/DataBaseProvider.js +98 -0
- package/src/db/mariadb/MariaDB.js +66 -0
- package/src/db/mongo/MongooseDB.js +70 -0
- package/src/index.js +198 -0
- package/src/mailer/EmailRender.js +116 -0
- package/src/mailer/MailerProvider.js +213 -0
- package/src/monitor.js +24 -0
- package/src/proxy.js +22 -0
- package/src/runtime/express/Express.js +256 -0
- package/src/runtime/lampp/Dockerfile +50 -0
- package/src/runtime/lampp/Lampp.js +343 -0
- package/src/server/auth.js +689 -0
- package/src/server/backup.js +96 -0
- package/src/server/client-build-docs.js +205 -0
- package/src/server/client-build-live.js +109 -0
- package/src/server/client-build.js +690 -0
- package/src/server/client-dev-server.js +87 -0
- package/src/server/client-formatted.js +87 -0
- package/src/server/client-icons.js +108 -0
- package/src/server/conf.js +1071 -0
- package/src/server/crypto.js +210 -0
- package/src/server/dns.js +276 -0
- package/src/server/downloader.js +74 -0
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +197 -0
- package/src/server/network.js +72 -0
- package/src/server/object-layer.js +294 -0
- package/src/server/peer.js +69 -0
- package/src/server/process.js +171 -0
- package/src/server/proxy.js +110 -0
- package/src/server/runtime.js +170 -0
- package/src/server/ssr.js +127 -0
- package/src/server/start.js +161 -0
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +293 -0
- package/src/server.js +25 -0
- package/src/ws/IoInterface.js +139 -0
- package/src/ws/IoServer.js +88 -0
- package/src/ws/core/channels/core.ws.chat.js +23 -0
- package/src/ws/core/channels/core.ws.mailer.js +35 -0
- package/src/ws/core/channels/core.ws.stream.js +31 -0
- package/src/ws/core/core.ws.connection.js +62 -0
- package/src/ws/core/core.ws.emit.js +53 -0
- package/src/ws/core/core.ws.server.js +76 -0
- package/src/ws/core/management/core.ws.chat.js +8 -0
- package/src/ws/core/management/core.ws.mailer.js +16 -0
- package/src/ws/core/management/core.ws.stream.js +8 -0
- package/src/ws/cyberia/channels/cyberia.ws.bot.js +56 -0
- package/src/ws/cyberia/channels/cyberia.ws.skill.js +51 -0
- package/src/ws/cyberia/channels/cyberia.ws.user.js +437 -0
- package/src/ws/cyberia/cyberia.ws.connection.js +36 -0
- package/src/ws/cyberia/cyberia.ws.emit.js +14 -0
- package/src/ws/cyberia/cyberia.ws.server.js +67 -0
- package/src/ws/cyberia/management/cyberia.ws.bot.js +669 -0
- package/src/ws/cyberia/management/cyberia.ws.skill.js +441 -0
- package/src/ws/cyberia/management/cyberia.ws.user.js +188 -0
- package/src/ws/default/channels/default.ws.main.js +16 -0
- package/src/ws/default/default.ws.connection.js +22 -0
- package/src/ws/default/default.ws.emit.js +14 -0
- package/src/ws/default/default.ws.server.js +20 -0
- package/src/ws/default/management/default.ws.main.js +8 -0
- package/test/api.test.js +53 -0
- package/test/crypto.test.js +117 -0
|
@@ -0,0 +1,1639 @@
|
|
|
1
|
+
import { s, append, htmls } from '../core/VanillaJs.js';
|
|
2
|
+
import { getProxyPath } from '../core/Router.js';
|
|
3
|
+
import {
|
|
4
|
+
getDistance,
|
|
5
|
+
getId,
|
|
6
|
+
insertTransitionCoordinates,
|
|
7
|
+
newInstance,
|
|
8
|
+
random,
|
|
9
|
+
range,
|
|
10
|
+
round10,
|
|
11
|
+
timer,
|
|
12
|
+
} from '../core/CommonJs.js';
|
|
13
|
+
import { Responsive } from '../core/Responsive.js';
|
|
14
|
+
|
|
15
|
+
import { MatrixCyberia } from './MatrixCyberia.js';
|
|
16
|
+
import { ElementsCyberia } from './ElementsCyberia.js';
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
AnimatedSprite,
|
|
20
|
+
Application,
|
|
21
|
+
BaseTexture,
|
|
22
|
+
Container,
|
|
23
|
+
Sprite,
|
|
24
|
+
Text,
|
|
25
|
+
TextStyle,
|
|
26
|
+
Texture,
|
|
27
|
+
Ticker,
|
|
28
|
+
Graphics,
|
|
29
|
+
} from 'pixi.js';
|
|
30
|
+
import { WorldCyberiaManagement } from './WorldCyberia.js';
|
|
31
|
+
import { SocketIo } from '../core/SocketIo.js';
|
|
32
|
+
import {
|
|
33
|
+
CharacterCyberiaStatsType,
|
|
34
|
+
CyberiaParams,
|
|
35
|
+
BehaviorElement,
|
|
36
|
+
DisplayComponent,
|
|
37
|
+
SkillCyberiaData,
|
|
38
|
+
isElementCollision,
|
|
39
|
+
WorldCyberiaLimit,
|
|
40
|
+
PositionsComponent,
|
|
41
|
+
} from './CommonCyberia.js';
|
|
42
|
+
import { BiomeCyberiaManagement, BiomeCyberiaScope } from './BiomeCyberia.js';
|
|
43
|
+
import { ElementPreviewCyberia } from './ElementPreviewCyberia.js';
|
|
44
|
+
import { SocketIoCyberia } from './SocketIoCyberia.js';
|
|
45
|
+
import { LoadingAnimation } from '../core/LoadingAnimation.js';
|
|
46
|
+
import { Auth } from '../core/Auth.js';
|
|
47
|
+
import { getNumberByHex } from '../core/ColorPalette.js';
|
|
48
|
+
import { EventsUI } from '../core/EventsUI.js';
|
|
49
|
+
import { Translate } from '../core/Translate.js';
|
|
50
|
+
import { borderChar } from '../core/Css.js';
|
|
51
|
+
|
|
52
|
+
// https://pixijs.com/8.x/examples/sprite/animated-sprite-jet
|
|
53
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame
|
|
54
|
+
// https://pixijs.download/v6.5.2/docs/PIXI.AnimatedSprite.html
|
|
55
|
+
|
|
56
|
+
const PixiCyberia = {
|
|
57
|
+
MetaData: {
|
|
58
|
+
dim: 7 * 16 * 3 * 10,
|
|
59
|
+
},
|
|
60
|
+
Data: {},
|
|
61
|
+
Init: async function () {
|
|
62
|
+
Object.keys(ElementsCyberia.Data).map((type) => (this.Data[type] = {}));
|
|
63
|
+
append(
|
|
64
|
+
'body',
|
|
65
|
+
html`
|
|
66
|
+
<style>
|
|
67
|
+
.pixi-container,
|
|
68
|
+
.pixi-container-top-level {
|
|
69
|
+
/* top: 0px;
|
|
70
|
+
left: 0px;
|
|
71
|
+
overflow: hidden; */
|
|
72
|
+
}
|
|
73
|
+
.pixi-container-top-level {
|
|
74
|
+
transition: 0.4s;
|
|
75
|
+
}
|
|
76
|
+
.adjacent-map {
|
|
77
|
+
/* border: 2px solid #ff0000; */
|
|
78
|
+
}
|
|
79
|
+
.adjacent-map-background {
|
|
80
|
+
width: 100%;
|
|
81
|
+
height: 100%;
|
|
82
|
+
top: 0px;
|
|
83
|
+
left: 0px;
|
|
84
|
+
z-index: 1;
|
|
85
|
+
}
|
|
86
|
+
.dead-timer-modal {
|
|
87
|
+
color: black;
|
|
88
|
+
top: 23.5%;
|
|
89
|
+
z-index: 3;
|
|
90
|
+
}
|
|
91
|
+
.dead-timer-modal-img {
|
|
92
|
+
height: 80px;
|
|
93
|
+
}
|
|
94
|
+
.dead-timer-count {
|
|
95
|
+
font-size: 35px;
|
|
96
|
+
color: white;
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
99
|
+
${borderChar(2, 'red', ['.dead-timer-modal'])}
|
|
100
|
+
<div class="fix pixi-container">
|
|
101
|
+
<div class="abs adjacent-map adjacent-map-limit-top">
|
|
102
|
+
<div class="abs adjacent-map-background adjacent-map-background-top"></div>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="abs adjacent-map adjacent-map-limit-bottom">
|
|
105
|
+
<div class="abs adjacent-map-background adjacent-map-background-bottom"></div>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="abs adjacent-map adjacent-map-limit-left">
|
|
108
|
+
<div class="abs adjacent-map-background adjacent-map-background-left"></div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="abs adjacent-map adjacent-map-limit-right">
|
|
111
|
+
<div class="abs adjacent-map-background adjacent-map-background-right"></div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div class="abs adjacent-map adjacent-map-limit-top-left">
|
|
115
|
+
<div class="abs adjacent-map-background adjacent-map-background-top-left"></div>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="abs adjacent-map adjacent-map-limit-top-right">
|
|
118
|
+
<div class="abs adjacent-map-background adjacent-map-background-top-right"></div>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="abs adjacent-map adjacent-map-limit-bottom-left">
|
|
121
|
+
<div class="abs adjacent-map-background adjacent-map-background-bottom-left"></div>
|
|
122
|
+
</div>
|
|
123
|
+
<div class="abs adjacent-map adjacent-map-limit-bottom-right">
|
|
124
|
+
<div class="abs adjacent-map-background adjacent-map-background-bottom-right"></div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="fix pixi-container-top-level" style="opacity: 1"></div>
|
|
128
|
+
<div class="abs center dead-timer-modal hide">
|
|
129
|
+
<img class="inl dead-timer-modal-img" src="${getProxyPath()}assets/util/dead.png" />
|
|
130
|
+
<br />
|
|
131
|
+
<span>${Translate.Render('you-are-dead')}</span>
|
|
132
|
+
<br /><br />
|
|
133
|
+
<span class="dead-timer-count"></span>
|
|
134
|
+
</div>
|
|
135
|
+
`,
|
|
136
|
+
);
|
|
137
|
+
this.App = new Application({
|
|
138
|
+
width: this.MetaData.dim,
|
|
139
|
+
height: this.MetaData.dim,
|
|
140
|
+
background: '#c7c7c7',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
this.App.view.classList.add('abs');
|
|
144
|
+
this.App.view.classList.add('pixi-canvas');
|
|
145
|
+
s('.pixi-container').appendChild(this.App.view);
|
|
146
|
+
|
|
147
|
+
this.AppTopLevelColor = new Application({
|
|
148
|
+
width: this.MetaData.dim,
|
|
149
|
+
height: this.MetaData.dim,
|
|
150
|
+
background: undefined,
|
|
151
|
+
backgroundAlpha: 0,
|
|
152
|
+
});
|
|
153
|
+
this.AppTopLevelColor.view.classList.add('abs');
|
|
154
|
+
this.AppTopLevelColor.view.classList.add('pixi-canvas-top-level');
|
|
155
|
+
|
|
156
|
+
s('.pixi-container-top-level').appendChild(this.AppTopLevelColor.view);
|
|
157
|
+
s('.pixi-container-top-level').style.zIndex = '2';
|
|
158
|
+
|
|
159
|
+
(() => {
|
|
160
|
+
return;
|
|
161
|
+
// top level render test
|
|
162
|
+
const componentInstance = new Sprite(Texture.WHITE);
|
|
163
|
+
componentInstance.x = 100;
|
|
164
|
+
componentInstance.y = 100;
|
|
165
|
+
componentInstance.width = this.MetaData.dim * 0.1;
|
|
166
|
+
componentInstance.height = this.MetaData.dim * 0.1;
|
|
167
|
+
componentInstance.tint = '#ff0000';
|
|
168
|
+
componentInstance.visible = true;
|
|
169
|
+
this.AppTopLevelColor.stage.addChild(componentInstance);
|
|
170
|
+
})();
|
|
171
|
+
|
|
172
|
+
// biome containers
|
|
173
|
+
this.Data.biome['seed-city'] = new Container();
|
|
174
|
+
this.Data.biome['seed-city'].width = this.MetaData.dim;
|
|
175
|
+
this.Data.biome['seed-city'].height = this.MetaData.dim;
|
|
176
|
+
this.Data.biome['seed-city'].x = 0;
|
|
177
|
+
this.Data.biome['seed-city'].y = 0;
|
|
178
|
+
this.App.stage.addChild(this.Data.biome['seed-city']);
|
|
179
|
+
|
|
180
|
+
this.Data.biome.floorContainer = new Container();
|
|
181
|
+
this.Data.biome.floorContainer.width = this.MetaData.dim;
|
|
182
|
+
this.Data.biome.floorContainer.height = this.MetaData.dim;
|
|
183
|
+
this.Data.biome.floorContainer.x = 0;
|
|
184
|
+
this.Data.biome.floorContainer.y = 0;
|
|
185
|
+
this.App.stage.addChild(this.Data.biome.floorContainer);
|
|
186
|
+
|
|
187
|
+
// elements container
|
|
188
|
+
{
|
|
189
|
+
const channelType = 'elements';
|
|
190
|
+
this.Data[channelType] = {};
|
|
191
|
+
this.Data[channelType].container = new Container();
|
|
192
|
+
this.Data[channelType].container.width = this.MetaData.dim;
|
|
193
|
+
this.Data[channelType].container.height = this.MetaData.dim;
|
|
194
|
+
this.Data[channelType].container.x = 0;
|
|
195
|
+
this.Data[channelType].container.y = 0;
|
|
196
|
+
this.App.stage.addChild(this.Data[channelType].container);
|
|
197
|
+
|
|
198
|
+
if (this.zOrderInterval) clearInterval(this.zOrderInterval);
|
|
199
|
+
this.zOrderInterval = setInterval(() => {
|
|
200
|
+
this.Data[channelType].container.children.sort((itemA, itemB) => itemA.zIndex - itemB.zIndex);
|
|
201
|
+
}, CyberiaParams.EVENT_CALLBACK_TIME);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// channels container
|
|
205
|
+
|
|
206
|
+
for (const channelType of Object.keys(ElementsCyberia.Data)) {
|
|
207
|
+
this.Data[channelType].container = new Container();
|
|
208
|
+
this.Data[channelType].container.width = this.MetaData.dim;
|
|
209
|
+
this.Data[channelType].container.height = this.MetaData.dim;
|
|
210
|
+
this.Data[channelType].container.x = 0;
|
|
211
|
+
this.Data[channelType].container.y = 0;
|
|
212
|
+
this.App.stage.addChild(this.Data[channelType].container);
|
|
213
|
+
}
|
|
214
|
+
append(
|
|
215
|
+
'body',
|
|
216
|
+
html`<div class="hide">
|
|
217
|
+
${await ElementPreviewCyberia.Render({
|
|
218
|
+
renderId: 'element-interaction-panel',
|
|
219
|
+
style: { height: '50px', width: '50px' },
|
|
220
|
+
})}
|
|
221
|
+
</div>`,
|
|
222
|
+
);
|
|
223
|
+
await this.instanceAdjacentEvents();
|
|
224
|
+
},
|
|
225
|
+
adjacentIds: ['top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right'],
|
|
226
|
+
instanceAdjacentEvents: async function () {
|
|
227
|
+
for (const adjId of this.adjacentIds) {
|
|
228
|
+
EventsUI.onClick(
|
|
229
|
+
`.adjacent-map-background-${adjId}`,
|
|
230
|
+
async (...args) => {
|
|
231
|
+
let x = newInstance(ElementsCyberia.Data.user.main.x);
|
|
232
|
+
let y = newInstance(ElementsCyberia.Data.user.main.y);
|
|
233
|
+
|
|
234
|
+
switch (adjId) {
|
|
235
|
+
case 'left':
|
|
236
|
+
x = ElementsCyberia.Data.user.main.x - ElementsCyberia.Data.user.main.vel;
|
|
237
|
+
break;
|
|
238
|
+
case 'right':
|
|
239
|
+
x = ElementsCyberia.Data.user.main.x + ElementsCyberia.Data.user.main.vel;
|
|
240
|
+
break;
|
|
241
|
+
case 'bottom':
|
|
242
|
+
case 'bottom-right':
|
|
243
|
+
case 'bottom-left':
|
|
244
|
+
y = ElementsCyberia.Data.user.main.y + ElementsCyberia.Data.user.main.vel;
|
|
245
|
+
break;
|
|
246
|
+
case 'top':
|
|
247
|
+
case 'top-right':
|
|
248
|
+
case 'top-left':
|
|
249
|
+
y = ElementsCyberia.Data.user.main.y - ElementsCyberia.Data.user.main.vel;
|
|
250
|
+
break;
|
|
251
|
+
default:
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (
|
|
256
|
+
PixiCyberia.transportBlock ||
|
|
257
|
+
ElementsCyberia.LocalDataScope['user']['main'].immunityQuestModalDialog ||
|
|
258
|
+
BiomeCyberiaManagement.isBiomeCyberiaCollision({ type: 'user', id: 'main', x, y })
|
|
259
|
+
)
|
|
260
|
+
return;
|
|
261
|
+
ElementsCyberia.Data.user.main.x = x;
|
|
262
|
+
ElementsCyberia.Data.user.main.y = y;
|
|
263
|
+
PixiCyberia.updatePosition({ type: 'user', id: 'main' });
|
|
264
|
+
},
|
|
265
|
+
{ clickEffect: true },
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
mainUserMovementControllerInterval: null,
|
|
270
|
+
setMainUserMovementController: function () {
|
|
271
|
+
const id = 'main';
|
|
272
|
+
const type = 'user';
|
|
273
|
+
const dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
274
|
+
const timeInterval = CyberiaParams.EVENT_CALLBACK_TIME * 4;
|
|
275
|
+
|
|
276
|
+
let lastX;
|
|
277
|
+
let lastY;
|
|
278
|
+
if (this.mainUserMovementControllerInterval) clearInterval(this.mainUserMovementControllerInterval);
|
|
279
|
+
this.mainUserMovementControllerInterval = setInterval(() => {
|
|
280
|
+
if (!this.Data[type] || !this.Data[type][id] || !ElementsCyberia.Data[type] || !ElementsCyberia.Data[type][id])
|
|
281
|
+
return;
|
|
282
|
+
if (lastX === undefined || lastY === undefined) {
|
|
283
|
+
lastX = newInstance(ElementsCyberia.Data[type][id].x);
|
|
284
|
+
lastY = newInstance(ElementsCyberia.Data[type][id].y);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const x1 = lastX;
|
|
288
|
+
const y1 = lastY;
|
|
289
|
+
const x2 = ElementsCyberia.Data[type][id].x;
|
|
290
|
+
const y2 = ElementsCyberia.Data[type][id].y;
|
|
291
|
+
const frameFactor = 10;
|
|
292
|
+
let frames = round10(getDistance(x1, y1, x2, y2) * frameFactor);
|
|
293
|
+
if (frames === 0) frames = 1;
|
|
294
|
+
lastX = newInstance(ElementsCyberia.Data[type][id].x);
|
|
295
|
+
lastY = newInstance(ElementsCyberia.Data[type][id].y);
|
|
296
|
+
if (ElementsCyberia.LocalDataScope[type][id].isChangeFace) {
|
|
297
|
+
delete ElementsCyberia.LocalDataScope[type][id].isChangeFace;
|
|
298
|
+
const x = lastX;
|
|
299
|
+
const y = lastY;
|
|
300
|
+
this.Data[type][id].x = dim * x;
|
|
301
|
+
this.Data[type][id].y = dim * y;
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const path = insertTransitionCoordinates(
|
|
305
|
+
[
|
|
306
|
+
[x1, y1],
|
|
307
|
+
[x2, y2],
|
|
308
|
+
],
|
|
309
|
+
frames,
|
|
310
|
+
);
|
|
311
|
+
for (const time of range(0, frames - 1)) {
|
|
312
|
+
setTimeout(() => {
|
|
313
|
+
if (this.Data[type] && this.Data[type][id]) {
|
|
314
|
+
const [x, y] = path[time];
|
|
315
|
+
this.Data[type][id].x = dim * x;
|
|
316
|
+
this.Data[type][id].y = dim * y;
|
|
317
|
+
// this.Data[type][id].x = dim * ElementsCyberia.Data[type][id].x;
|
|
318
|
+
// this.Data[type][id].y = dim * ElementsCyberia.Data[type][id].y;
|
|
319
|
+
}
|
|
320
|
+
}, time * (timeInterval / frames));
|
|
321
|
+
}
|
|
322
|
+
}, timeInterval);
|
|
323
|
+
},
|
|
324
|
+
setResponsivePixiContainerEvent: function () {
|
|
325
|
+
Responsive.Event['pixi-container'] = () => {
|
|
326
|
+
const ResponsiveDataAmplitude = Responsive.getResponsiveDataAmplitude({
|
|
327
|
+
dimAmplitude: MatrixCyberia.Data.dimAmplitude,
|
|
328
|
+
});
|
|
329
|
+
const ResponsiveData = Responsive.getResponsiveData();
|
|
330
|
+
s('.pixi-canvas').style.width = `${ResponsiveDataAmplitude.minValue}px`;
|
|
331
|
+
s('.pixi-canvas').style.height = `${ResponsiveDataAmplitude.minValue}px`;
|
|
332
|
+
s('.pixi-canvas-top-level').style.width = `${ResponsiveDataAmplitude.minValue}px`;
|
|
333
|
+
s('.pixi-canvas-top-level').style.height = `${ResponsiveDataAmplitude.minValue}px`;
|
|
334
|
+
|
|
335
|
+
for (const limitType of [
|
|
336
|
+
'top',
|
|
337
|
+
'bottom',
|
|
338
|
+
'left',
|
|
339
|
+
'right',
|
|
340
|
+
'top-left',
|
|
341
|
+
'top-right',
|
|
342
|
+
'bottom-left',
|
|
343
|
+
'bottom-right',
|
|
344
|
+
]) {
|
|
345
|
+
s(`.adjacent-map-limit-${limitType}`).style.height = `${ResponsiveDataAmplitude.minValue}px`;
|
|
346
|
+
s(`.adjacent-map-limit-${limitType}`).style.width = `${ResponsiveDataAmplitude.minValue}px`;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
s('.main-user-container').style.width = `${ResponsiveData.minValue}px`;
|
|
350
|
+
s('.main-user-container').style.height = `${ResponsiveData.minValue}px`;
|
|
351
|
+
// const ResponsiveData = Responsive.getResponsiveData();
|
|
352
|
+
// s('.pixi-container').style.height = `${ResponsiveData.height}px`;
|
|
353
|
+
// s('.pixi-container').style.width = `${ResponsiveData.width}px`;
|
|
354
|
+
};
|
|
355
|
+
setTimeout(Responsive.Event['pixi-container']);
|
|
356
|
+
},
|
|
357
|
+
currentBiomeCyberiaContainer: String,
|
|
358
|
+
clearBiomeCyberiaContainers: function () {
|
|
359
|
+
this.Data.biome.container.removeChildren();
|
|
360
|
+
this.Data.biome['seed-city'].removeChildren();
|
|
361
|
+
this.Data.biome.floorContainer.removeChildren();
|
|
362
|
+
},
|
|
363
|
+
setFloor: function (blobUrl) {
|
|
364
|
+
this.clearBiomeCyberiaContainers();
|
|
365
|
+
|
|
366
|
+
this.currentBiomeCyberiaContainer = 'floorContainer';
|
|
367
|
+
this.Data.biome.floor = Sprite.from(new BaseTexture(blobUrl));
|
|
368
|
+
this.Data.biome.floor.width = this.MetaData.dim;
|
|
369
|
+
this.Data.biome.floor.height = this.MetaData.dim;
|
|
370
|
+
this.Data.biome.floor.x = 0;
|
|
371
|
+
this.Data.biome.floor.y = 0;
|
|
372
|
+
this.Data.biome[this.currentBiomeCyberiaContainer].addChild(this.Data.biome.floor);
|
|
373
|
+
},
|
|
374
|
+
setFloorTopLevelColor: function (blobUrl) {
|
|
375
|
+
this.AppTopLevelColor.stage.removeChildren();
|
|
376
|
+
const componentInstance = Sprite.from(new BaseTexture(blobUrl));
|
|
377
|
+
componentInstance.width = this.MetaData.dim;
|
|
378
|
+
componentInstance.height = this.MetaData.dim;
|
|
379
|
+
componentInstance.x = 0;
|
|
380
|
+
componentInstance.y = 0;
|
|
381
|
+
this.AppTopLevelColor.stage.addChild(componentInstance);
|
|
382
|
+
},
|
|
383
|
+
setBiomeCyberia: function (BiomeCyberiaMatrixCyberia) {
|
|
384
|
+
this.clearBiomeCyberiaContainers();
|
|
385
|
+
if (BiomeCyberiaMatrixCyberia) {
|
|
386
|
+
this.currentBiomeCyberiaContainer = BiomeCyberiaMatrixCyberia?.container
|
|
387
|
+
? BiomeCyberiaMatrixCyberia.container
|
|
388
|
+
: 'container';
|
|
389
|
+
|
|
390
|
+
if (BiomeCyberiaMatrixCyberia.setBiomeCyberia) {
|
|
391
|
+
for (const cellData of BiomeCyberiaMatrixCyberia.setBiomeCyberia) {
|
|
392
|
+
const { src, dim, x, y } = cellData;
|
|
393
|
+
this.Data.biome[src] = Sprite.from(src);
|
|
394
|
+
this.Data.biome[src].width = dim;
|
|
395
|
+
this.Data.biome[src].height = dim;
|
|
396
|
+
this.Data.biome[src].x = x * dim;
|
|
397
|
+
this.Data.biome[src].y = y * dim;
|
|
398
|
+
this.Data.biome[this.currentBiomeCyberiaContainer].addChild(this.Data.biome[src]);
|
|
399
|
+
}
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const paintDim = MatrixCyberia.Data.dim * MatrixCyberia.Data.dimPaintByCell;
|
|
404
|
+
const dim = this.MetaData.dim / paintDim;
|
|
405
|
+
range(0, paintDim - 1).map((y) =>
|
|
406
|
+
range(0, paintDim - 1).map((x) => {
|
|
407
|
+
const id = `biome-cell-${x}-${y}`;
|
|
408
|
+
this.Data.biome[id] = new Sprite(Texture.WHITE);
|
|
409
|
+
this.Data.biome[id].x = dim * x;
|
|
410
|
+
this.Data.biome[id].y = dim * y;
|
|
411
|
+
this.Data.biome[id].width = dim;
|
|
412
|
+
this.Data.biome[id].height = dim;
|
|
413
|
+
this.Data.biome[id].tint = BiomeCyberiaMatrixCyberia.color[y][x];
|
|
414
|
+
this.Data.biome[this.currentBiomeCyberiaContainer].addChild(this.Data.biome[id]);
|
|
415
|
+
}),
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
setZIndex: function ({ type, id, dim }) {
|
|
420
|
+
if (!this.Data[type][id]) return;
|
|
421
|
+
this.Data[type][id].zIndex = newInstance(
|
|
422
|
+
dim * ElementsCyberia.Data[type][id].y + dim * ElementsCyberia.Data[type][id].dim,
|
|
423
|
+
);
|
|
424
|
+
},
|
|
425
|
+
setComponents: function (options = { type: 'user', id: 'main' }) {
|
|
426
|
+
const { type, id } = options;
|
|
427
|
+
let dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
428
|
+
if (this.Data[type][id]) this.removeElement({ type, id });
|
|
429
|
+
this.Data[type][id] = new Container();
|
|
430
|
+
this.Data[type][id].width = dim * ElementsCyberia.Data[type][id].dim;
|
|
431
|
+
this.Data[type][id].height = dim * ElementsCyberia.Data[type][id].dim;
|
|
432
|
+
this.Data[type][id].x = dim * ElementsCyberia.Data[type][id].x;
|
|
433
|
+
this.Data[type][id].y = dim * ElementsCyberia.Data[type][id].y;
|
|
434
|
+
this.setZIndex({ type, id, dim });
|
|
435
|
+
this.Data[type][id].components = {
|
|
436
|
+
'layer-1': { container: new Container() },
|
|
437
|
+
layer0: { container: new Container() },
|
|
438
|
+
layer1: { container: new Container() },
|
|
439
|
+
layer2: { container: new Container() },
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
for (const layer of Object.keys(this.Data[type][id].components)) {
|
|
443
|
+
this.Data[type][id].components[layer].container.width = dim * ElementsCyberia.Data[type][id].dim;
|
|
444
|
+
this.Data[type][id].components[layer].container.height = dim * ElementsCyberia.Data[type][id].dim;
|
|
445
|
+
this.Data[type][id].components[layer].container.x = 0;
|
|
446
|
+
this.Data[type][id].components[layer].container.y = 0;
|
|
447
|
+
this.Data[type][id].addChild(this.Data[type][id].components[layer].container);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
this.Data[type][id].intervals = {};
|
|
451
|
+
this.Data[type][id].pixiTickers = {};
|
|
452
|
+
let index;
|
|
453
|
+
this.Data['elements'].container.addChild(this.Data[type][id]);
|
|
454
|
+
for (const componentType of Object.keys(ElementsCyberia.Data[type][id].components)) {
|
|
455
|
+
if (!this.Data[type][id].components[componentType]) this.Data[type][id].components[componentType] = {};
|
|
456
|
+
if (!this.Data[type][id].intervals[componentType]) this.Data[type][id].intervals[componentType] = {};
|
|
457
|
+
switch (componentType) {
|
|
458
|
+
case 'background':
|
|
459
|
+
index = 0;
|
|
460
|
+
for (const component of ElementsCyberia.Data[type][id].components[componentType]) {
|
|
461
|
+
const { enabled } = component;
|
|
462
|
+
if (!enabled) {
|
|
463
|
+
index++;
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const { tint, visible } = component.pixi;
|
|
467
|
+
const componentInstance = new Sprite(Texture.WHITE);
|
|
468
|
+
componentInstance.x = 0;
|
|
469
|
+
componentInstance.y = 0;
|
|
470
|
+
componentInstance.width = dim * ElementsCyberia.Data[type][id].dim;
|
|
471
|
+
componentInstance.height = dim * ElementsCyberia.Data[type][id].dim;
|
|
472
|
+
componentInstance.tint = tint;
|
|
473
|
+
componentInstance.visible = visible;
|
|
474
|
+
this.Data[type][id].components[componentType][`${index}`] = componentInstance;
|
|
475
|
+
this.Data[type][id].addChild(componentInstance);
|
|
476
|
+
index++;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
break;
|
|
480
|
+
|
|
481
|
+
case 'pointerArrow':
|
|
482
|
+
{
|
|
483
|
+
// const displayId = ElementsCyberia.getCurrentSkinDisplayId({ type, id });
|
|
484
|
+
|
|
485
|
+
const arrowColor = BehaviorElement[ElementsCyberia.Data[type][id].behavior].color;
|
|
486
|
+
|
|
487
|
+
const src = `${getProxyPath()}assets/icons/${arrowColor}-pointer-arrow.png`;
|
|
488
|
+
const componentInstance = Sprite.from(src);
|
|
489
|
+
componentInstance.width = dim * 0.5;
|
|
490
|
+
componentInstance.height = dim * 0.4;
|
|
491
|
+
componentInstance.x = (dim * ElementsCyberia.Data[type][id].dim) / 2 - dim / 4;
|
|
492
|
+
|
|
493
|
+
componentInstance.visible = false;
|
|
494
|
+
this.Data[type][id].components[componentType][`pointer-arrow`] = componentInstance;
|
|
495
|
+
this.Data[type][id].addChild(componentInstance);
|
|
496
|
+
|
|
497
|
+
const frames = [0, dim / 8];
|
|
498
|
+
let frame = 0;
|
|
499
|
+
const setArrowYTicker = () => (componentInstance.y = -4 * (dim / 3) - frames[frame]);
|
|
500
|
+
setArrowYTicker();
|
|
501
|
+
const callBack = function () {
|
|
502
|
+
if (!componentInstance.visible || !ElementsCyberia.Data[type] || !ElementsCyberia.Data[type][id]) return;
|
|
503
|
+
setArrowYTicker();
|
|
504
|
+
frame++;
|
|
505
|
+
if (frame === frames.length) frame = 0;
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
// setTimeout(() => callBack());
|
|
509
|
+
// this.Data[type][id].intervals[componentType][`pointer-arrow`] = {
|
|
510
|
+
// callBack,
|
|
511
|
+
// interval: setInterval(callBack, 200),
|
|
512
|
+
// };
|
|
513
|
+
|
|
514
|
+
{
|
|
515
|
+
const ticker = new Ticker();
|
|
516
|
+
|
|
517
|
+
let deltaSum = 0;
|
|
518
|
+
// delta: ms last frame
|
|
519
|
+
ticker.add((delta) => {
|
|
520
|
+
deltaSum += delta;
|
|
521
|
+
if (deltaSum >= 15) {
|
|
522
|
+
deltaSum = 0;
|
|
523
|
+
callBack();
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// Controller Interface:
|
|
528
|
+
// ticker.start();
|
|
529
|
+
// ticker.destroy();
|
|
530
|
+
// ticker.stop();
|
|
531
|
+
|
|
532
|
+
this.Data[type][id].components[componentType][`pointer-arrow-ticker`] = ticker;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
break;
|
|
536
|
+
|
|
537
|
+
case 'lifeBar':
|
|
538
|
+
{
|
|
539
|
+
const componentInstance = new Sprite(Texture.WHITE);
|
|
540
|
+
componentInstance.x = 0;
|
|
541
|
+
componentInstance.y = -1 * (dim / 3);
|
|
542
|
+
|
|
543
|
+
// maxLife -> 100%
|
|
544
|
+
// life -> x%
|
|
545
|
+
|
|
546
|
+
componentInstance.height = dim / 3;
|
|
547
|
+
componentInstance.tint = '#00e622ff';
|
|
548
|
+
componentInstance.visible = ElementsCyberia.Data[type][id].behavior !== 'item-quest';
|
|
549
|
+
this.Data[type][id].components[componentType] = componentInstance;
|
|
550
|
+
this.updateLifeBarWidth({ type, id, dim });
|
|
551
|
+
this.Data[type][id].addChild(componentInstance);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
break;
|
|
555
|
+
|
|
556
|
+
case 'coinIndicator':
|
|
557
|
+
{
|
|
558
|
+
const elementDataDim = 1; // ElementsCyberia.Data[type][id].dim
|
|
559
|
+
const componentInstance = new Container();
|
|
560
|
+
componentInstance.x = [-2.5, 2][random(0, 1)] * ((dim * elementDataDim) / 2);
|
|
561
|
+
componentInstance.y = [-2.5, 2][random(0, 1)] * dim * elementDataDim * 0.8;
|
|
562
|
+
componentInstance.width = dim * elementDataDim;
|
|
563
|
+
componentInstance.height = dim * elementDataDim * 0.4;
|
|
564
|
+
this.Data[type][id].components[componentType].container = componentInstance;
|
|
565
|
+
this.Data[type][id].addChild(componentInstance);
|
|
566
|
+
}
|
|
567
|
+
{
|
|
568
|
+
const elementDataDim = 1; // ElementsCyberia.Data[type][id].dim
|
|
569
|
+
const componentInstance = new Sprite(); // Texture.WHITE
|
|
570
|
+
componentInstance.x = 0;
|
|
571
|
+
componentInstance.y = 0;
|
|
572
|
+
componentInstance.width = dim * elementDataDim;
|
|
573
|
+
componentInstance.height = dim * elementDataDim * 0.4;
|
|
574
|
+
// componentInstance.tint = '#000000ff';
|
|
575
|
+
componentInstance.visible = true;
|
|
576
|
+
this.Data[type][id].components[componentType].background = componentInstance;
|
|
577
|
+
this.Data[type][id].components[componentType].container.addChild(componentInstance);
|
|
578
|
+
}
|
|
579
|
+
{
|
|
580
|
+
let lastCoin = newInstance(ElementsCyberia.Data[type][id].coin);
|
|
581
|
+
const callBack = () => {
|
|
582
|
+
if (ElementsCyberia.Data[type][id].coin !== lastCoin) {
|
|
583
|
+
let diffCoin = ElementsCyberia.Data[type][id].coin - lastCoin;
|
|
584
|
+
lastCoin = newInstance(ElementsCyberia.Data[type][id].coin);
|
|
585
|
+
if (diffCoin > 0) diffCoin = '+' + diffCoin;
|
|
586
|
+
diffCoin = '$ ' + diffCoin;
|
|
587
|
+
const componentInstance = new Text(
|
|
588
|
+
`${diffCoin}`,
|
|
589
|
+
new TextStyle({
|
|
590
|
+
fill: diffCoin[0] !== '+' ? '#d4da1e' : '#d4da1e',
|
|
591
|
+
fontFamily: 'retro-font', // Impact
|
|
592
|
+
fontSize: 300 * (1 / MatrixCyberia.Data.dimAmplitude),
|
|
593
|
+
dropShadow: true,
|
|
594
|
+
dropShadowAngle: 1,
|
|
595
|
+
dropShadowBlur: 3,
|
|
596
|
+
dropShadowColor: '#121212',
|
|
597
|
+
dropShadowDistance: 1,
|
|
598
|
+
}),
|
|
599
|
+
);
|
|
600
|
+
this.Data[type][id].components[componentType].container.addChild(componentInstance);
|
|
601
|
+
setTimeout(() => {
|
|
602
|
+
if (this.Data[type][id])
|
|
603
|
+
this.Data[type][id].components[componentType].container.removeChild(componentInstance);
|
|
604
|
+
componentInstance.destroy();
|
|
605
|
+
}, 450);
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
this.Data[type][id].intervals[componentType]['coinIndicator-interval'] = {
|
|
609
|
+
callBack,
|
|
610
|
+
interval: setInterval(callBack, 500),
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
break;
|
|
614
|
+
case 'lifeIndicator':
|
|
615
|
+
{
|
|
616
|
+
const elementDataDim = 1; // ElementsCyberia.Data[type][id].dim
|
|
617
|
+
const componentInstance = new Container();
|
|
618
|
+
componentInstance.x = [-1.5, 1][random(0, 1)] * ((dim * elementDataDim) / 2);
|
|
619
|
+
componentInstance.y = -1.6 * dim * elementDataDim * 0.8;
|
|
620
|
+
componentInstance.width = dim * elementDataDim;
|
|
621
|
+
componentInstance.height = dim * elementDataDim * 0.4;
|
|
622
|
+
this.Data[type][id].components[componentType].container = componentInstance;
|
|
623
|
+
this.Data[type][id].addChild(componentInstance);
|
|
624
|
+
}
|
|
625
|
+
{
|
|
626
|
+
const elementDataDim = 1; // ElementsCyberia.Data[type][id].dim
|
|
627
|
+
const componentInstance = new Sprite(); // Texture.WHITE
|
|
628
|
+
componentInstance.x = 0;
|
|
629
|
+
componentInstance.y = 0;
|
|
630
|
+
componentInstance.width = dim * elementDataDim;
|
|
631
|
+
componentInstance.height = dim * elementDataDim * 0.4;
|
|
632
|
+
// componentInstance.tint = '#000000ff';
|
|
633
|
+
componentInstance.visible = true;
|
|
634
|
+
this.Data[type][id].components[componentType].background = componentInstance;
|
|
635
|
+
this.Data[type][id].components[componentType].container.addChild(componentInstance);
|
|
636
|
+
}
|
|
637
|
+
{
|
|
638
|
+
let lastLife = newInstance(ElementsCyberia.Data[type][id].life);
|
|
639
|
+
const displayId = ElementsCyberia.getCurrentSkinDisplayId(options);
|
|
640
|
+
let animBlood;
|
|
641
|
+
if (displayId !== 'generic-wood') {
|
|
642
|
+
const pixiFrames = [];
|
|
643
|
+
for (const frame of range(0, 5)) {
|
|
644
|
+
pixiFrames.push(Texture.from(`${getProxyPath()}assets/skill/blood/08/${frame}.png`));
|
|
645
|
+
}
|
|
646
|
+
animBlood = new AnimatedSprite(pixiFrames);
|
|
647
|
+
animBlood.animationSpeed = 0.25;
|
|
648
|
+
const dataSpriteFormat = this.formatSpriteComponent({
|
|
649
|
+
displayId: 'blood',
|
|
650
|
+
positionId: '08',
|
|
651
|
+
dim,
|
|
652
|
+
element: ElementsCyberia.Data[type][id],
|
|
653
|
+
});
|
|
654
|
+
for (const attr of Object.keys(dataSpriteFormat.componentInstance)) {
|
|
655
|
+
animBlood[attr] = dataSpriteFormat.componentInstance[attr];
|
|
656
|
+
}
|
|
657
|
+
animBlood.visible = false;
|
|
658
|
+
// this.Data[type][id].addChild(animBlood);
|
|
659
|
+
this.Data[type][id].components.layer2.container.addChild(animBlood);
|
|
660
|
+
animBlood.play();
|
|
661
|
+
}
|
|
662
|
+
const callBack = () => {
|
|
663
|
+
if (ElementsCyberia.Data[type][id].life !== lastLife) {
|
|
664
|
+
let diffLife = ElementsCyberia.Data[type][id].life - lastLife;
|
|
665
|
+
lastLife = newInstance(ElementsCyberia.Data[type][id].life);
|
|
666
|
+
if (diffLife > 0) diffLife = '+' + diffLife;
|
|
667
|
+
else if (displayId !== 'generic-wood') {
|
|
668
|
+
animBlood.visible = true;
|
|
669
|
+
setTimeout(() => {
|
|
670
|
+
animBlood.visible = false;
|
|
671
|
+
// this.Data[type][id].removeChild(anim);
|
|
672
|
+
// anim.destroy();
|
|
673
|
+
}, 450);
|
|
674
|
+
}
|
|
675
|
+
diffLife = diffLife + ' ♥';
|
|
676
|
+
const componentInstance = new Text(
|
|
677
|
+
`${diffLife}`,
|
|
678
|
+
new TextStyle({
|
|
679
|
+
fill: diffLife[0] !== '+' ? '#FE2712' : '#7FFF00',
|
|
680
|
+
fontFamily: 'retro-font', // Impact
|
|
681
|
+
fontSize: 300 * (1 / MatrixCyberia.Data.dimAmplitude),
|
|
682
|
+
dropShadow: true,
|
|
683
|
+
dropShadowAngle: 1,
|
|
684
|
+
dropShadowBlur: 3,
|
|
685
|
+
dropShadowColor: '#121212',
|
|
686
|
+
dropShadowDistance: 1,
|
|
687
|
+
}),
|
|
688
|
+
);
|
|
689
|
+
this.Data[type][id].components[componentType].container.addChild(componentInstance);
|
|
690
|
+
setTimeout(() => {
|
|
691
|
+
if (this.Data[type][id])
|
|
692
|
+
this.Data[type][id].components[componentType].container.removeChild(componentInstance);
|
|
693
|
+
componentInstance.destroy();
|
|
694
|
+
}, 450);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
this.Data[type][id].intervals[componentType]['lifeIndicator-interval'] = {
|
|
698
|
+
callBack,
|
|
699
|
+
interval: setInterval(callBack, 500),
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
break;
|
|
703
|
+
break;
|
|
704
|
+
|
|
705
|
+
default:
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
this.setDisplayComponent({ type, id });
|
|
710
|
+
},
|
|
711
|
+
setDisplayComponent: function (options = { type: 'user', id: 'main' }) {
|
|
712
|
+
// params
|
|
713
|
+
const { type, id } = options;
|
|
714
|
+
|
|
715
|
+
let dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
716
|
+
|
|
717
|
+
for (const componentType of Object.keys(CharacterCyberiaStatsType)) {
|
|
718
|
+
if (!this.Data[type][id].components[componentType]) continue;
|
|
719
|
+
// clear
|
|
720
|
+
if (this.Data[type][id].intervals && this.Data[type][id].intervals[componentType]) {
|
|
721
|
+
for (const componentIntervalKey of Object.keys(this.Data[type][id].intervals[componentType])) {
|
|
722
|
+
if (this.Data[type][id].intervals[componentType][componentIntervalKey].callBack)
|
|
723
|
+
clearInterval(this.Data[type][id].intervals[componentType][componentIntervalKey].interval);
|
|
724
|
+
else if (this.Data[type][id].intervals[componentType][componentIntervalKey].pixiFrames) {
|
|
725
|
+
if (this.Data[type][id].intervals[componentType][componentIntervalKey].anim.stop)
|
|
726
|
+
this.Data[type][id].intervals[componentType][componentIntervalKey].anim.stop();
|
|
727
|
+
if (this.Data[type][id].intervals[componentType][componentIntervalKey].anim.destroy)
|
|
728
|
+
this.Data[type][id].intervals[componentType][componentIntervalKey].anim.destroy();
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (this.Data[type][id].components[componentType]) {
|
|
734
|
+
for (const componentKeyInstance of Object.keys(this.Data[type][id].components[componentType])) {
|
|
735
|
+
if (this.Data[type][id].components[componentType][componentKeyInstance].destroy)
|
|
736
|
+
this.Data[type][id].components[componentType][componentKeyInstance].destroy();
|
|
737
|
+
}
|
|
738
|
+
this.Data[type][id].components[componentType] = {};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
let skinPosition = '08';
|
|
742
|
+
const currentDataSkin = ElementsCyberia.Data[type][id].components['skin'].find((s) => s.enabled);
|
|
743
|
+
if (!PositionsComponent.unique08.includes(currentDataSkin.displayId)) {
|
|
744
|
+
if (currentDataSkin) skinPosition = currentDataSkin.position;
|
|
745
|
+
if (ElementsCyberia.Data[type][id].parent) {
|
|
746
|
+
const parentElement =
|
|
747
|
+
ElementsCyberia.Data[ElementsCyberia.Data[type][id].parent.type][
|
|
748
|
+
ElementsCyberia.Data[type][id].parent.id === SocketIo.socket.id
|
|
749
|
+
? 'main'
|
|
750
|
+
: ElementsCyberia.Data[type][id].parent.id
|
|
751
|
+
];
|
|
752
|
+
if (parentElement) skinPosition = `1${parentElement.components.skin.find((s) => s.current).position[1]}`;
|
|
753
|
+
else {
|
|
754
|
+
console.error(`Parent element not found for ${type}-${id}`);
|
|
755
|
+
SocketIoCyberia.disconnect({ type, id });
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// set skin
|
|
762
|
+
let index = 0;
|
|
763
|
+
for (const component of ElementsCyberia.Data[type][id].components[componentType]) {
|
|
764
|
+
const { displayId, position, enabled, positions, velFrame, assetFolder, extension, current } =
|
|
765
|
+
componentType === 'skill' && SkillCyberiaData[displayId] && SkillCyberiaData[displayId].skillDisplayData
|
|
766
|
+
? SkillCyberiaData[displayId].skillDisplayData
|
|
767
|
+
: component;
|
|
768
|
+
|
|
769
|
+
for (const positionData of positions) {
|
|
770
|
+
const { positionId, frames } = positionData;
|
|
771
|
+
if (PositionsComponent.unique08.includes(displayId) && positionId !== '08') continue;
|
|
772
|
+
const pixiFrames = [];
|
|
773
|
+
for (const frame of range(0, frames - 1)) {
|
|
774
|
+
const src = `${getProxyPath()}assets/${assetFolder}/${displayId}/${positionId}/${frame}.${
|
|
775
|
+
extension ? extension : `png`
|
|
776
|
+
}`;
|
|
777
|
+
|
|
778
|
+
pixiFrames.push(Texture.from(src));
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// Create an AnimatedSprite (brings back memories from the days of Flash, right ?)
|
|
782
|
+
const anim = new AnimatedSprite(pixiFrames);
|
|
783
|
+
const dataSpriteFormat = this.formatSpriteComponent({
|
|
784
|
+
displayId,
|
|
785
|
+
positionId,
|
|
786
|
+
dim,
|
|
787
|
+
element: ElementsCyberia.Data[type][id],
|
|
788
|
+
});
|
|
789
|
+
for (const attr of Object.keys(dataSpriteFormat.componentInstance)) {
|
|
790
|
+
anim[attr] = dataSpriteFormat.componentInstance[attr];
|
|
791
|
+
}
|
|
792
|
+
anim.animationSpeed = velFrame; // 0 - 1
|
|
793
|
+
|
|
794
|
+
this.Data[type][id].components[`layer${dataSpriteFormat.indexLayer}`].container.addChild(anim);
|
|
795
|
+
// this.Data[type][id].addChild(anim)
|
|
796
|
+
this.Data[type][id].intervals[componentType][`${displayId}-${positionId}`] = {
|
|
797
|
+
pixiFrames,
|
|
798
|
+
anim,
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
const currentComponentData = ElementsCyberia.Data[type][id].components[componentType].find((s) => s.enabled);
|
|
802
|
+
|
|
803
|
+
if (!currentComponentData || displayId !== currentComponentData.displayId || positionId !== skinPosition)
|
|
804
|
+
anim.visible = false;
|
|
805
|
+
else anim.play();
|
|
806
|
+
}
|
|
807
|
+
index++;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
this.updateLifeBarWidth({ type, id, dim });
|
|
811
|
+
|
|
812
|
+
switch (ElementsCyberia.Data[type][id].behavior) {
|
|
813
|
+
case 'quest-passive':
|
|
814
|
+
(async () => {
|
|
815
|
+
const { componentInstance, alphaTicker } = await PixiCyberia.gfxFactory({
|
|
816
|
+
x: ElementsCyberia.Data[type][id].x * MatrixCyberia.Data.dimPaintByCell,
|
|
817
|
+
y: ElementsCyberia.Data[type][id].y * MatrixCyberia.Data.dimPaintByCell,
|
|
818
|
+
dim: ElementsCyberia.Data[type][id].dim * (PixiCyberia.MetaData.dim / MatrixCyberia.Data.dim),
|
|
819
|
+
gfxId: ElementsCyberia.Data[type][id].behavior,
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
this.Data[type][id].pixiTickers['quest-passive'] = {
|
|
823
|
+
destroy: () => PixiCyberia.App.ticker.remove(alphaTicker),
|
|
824
|
+
componentInstance,
|
|
825
|
+
};
|
|
826
|
+
PixiCyberia.App.ticker.add(alphaTicker);
|
|
827
|
+
|
|
828
|
+
PixiCyberia.App.stage.addChild(componentInstance);
|
|
829
|
+
})();
|
|
830
|
+
break;
|
|
831
|
+
|
|
832
|
+
default:
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
updateLife: function (options) {
|
|
837
|
+
const { type, id } = options;
|
|
838
|
+
let dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
839
|
+
this.Data[type][id].components['lifeBar'].width =
|
|
840
|
+
dim *
|
|
841
|
+
ElementsCyberia.Data[type][id].dim *
|
|
842
|
+
(ElementsCyberia.Data[type][id].life / ElementsCyberia.Data[type][id].maxLife);
|
|
843
|
+
},
|
|
844
|
+
transportBlock: false,
|
|
845
|
+
updatePosition: function (options) {
|
|
846
|
+
const { type, id } = options;
|
|
847
|
+
|
|
848
|
+
if (
|
|
849
|
+
type === 'user' &&
|
|
850
|
+
id === 'main' &&
|
|
851
|
+
!(PixiCyberia.transportBlock || ElementsCyberia.LocalDataScope['user']['main'].immunityQuestModalDialog)
|
|
852
|
+
) {
|
|
853
|
+
if (ElementsCyberia.Data[type][id].x <= ElementsCyberia.Data[type][id].dim) {
|
|
854
|
+
console.warn('limit map position', 'left');
|
|
855
|
+
WorldCyberiaManagement.ChangeFace({ type, id, direction: 'left' });
|
|
856
|
+
}
|
|
857
|
+
if (ElementsCyberia.Data[type][id].y <= ElementsCyberia.Data[type][id].dim) {
|
|
858
|
+
console.warn('limit map position', 'top');
|
|
859
|
+
WorldCyberiaManagement.ChangeFace({ type, id, direction: 'top' });
|
|
860
|
+
}
|
|
861
|
+
if (ElementsCyberia.Data[type][id].x >= MatrixCyberia.Data.dim - ElementsCyberia.Data[type][id].dim) {
|
|
862
|
+
console.warn('limit map position', 'right');
|
|
863
|
+
WorldCyberiaManagement.ChangeFace({ type, id, direction: 'right' });
|
|
864
|
+
}
|
|
865
|
+
if (ElementsCyberia.Data[type][id].y >= MatrixCyberia.Data.dim - ElementsCyberia.Data[type][id].dim) {
|
|
866
|
+
console.warn('limit map position', 'bottom');
|
|
867
|
+
WorldCyberiaManagement.ChangeFace({ type, id, direction: 'bottom' });
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
(async () => {
|
|
871
|
+
if (
|
|
872
|
+
BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId] &&
|
|
873
|
+
BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].transports
|
|
874
|
+
) {
|
|
875
|
+
const lastX = ElementsCyberia.Data[type][id].x;
|
|
876
|
+
const lastY = ElementsCyberia.Data[type][id].y;
|
|
877
|
+
for (const transport of BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].transports) {
|
|
878
|
+
if (
|
|
879
|
+
isElementCollision({
|
|
880
|
+
A: {
|
|
881
|
+
x:
|
|
882
|
+
transport.x1 / BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].dimPaintByCell -
|
|
883
|
+
CyberiaParams.DIM_AMPLITUDE_TRANSPORT_COLLISION / 2,
|
|
884
|
+
y:
|
|
885
|
+
transport.y1 / BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].dimPaintByCell -
|
|
886
|
+
CyberiaParams.DIM_AMPLITUDE_TRANSPORT_COLLISION / 2,
|
|
887
|
+
dim: transport.dim + CyberiaParams.DIM_AMPLITUDE_TRANSPORT_COLLISION,
|
|
888
|
+
},
|
|
889
|
+
B: ElementsCyberia.Data[type][id],
|
|
890
|
+
dimPaintByCell: MatrixCyberia.Data.dimPaintByCell,
|
|
891
|
+
})
|
|
892
|
+
) {
|
|
893
|
+
setTimeout(async () => {
|
|
894
|
+
if (lastX === ElementsCyberia.Data[type][id].x && lastY === ElementsCyberia.Data[type][id].y) {
|
|
895
|
+
PixiCyberia.transportBlock = true;
|
|
896
|
+
s(`.ssr-play-btn-container`).style.display = 'none';
|
|
897
|
+
s(`.ssr-lore-display`).style.display = 'none';
|
|
898
|
+
s(`.ssr-loading-bar`).style.display = 'flow-root';
|
|
899
|
+
htmls(
|
|
900
|
+
'.ssr-custom-display',
|
|
901
|
+
html`
|
|
902
|
+
<div class="abs center" style="top: 45%">
|
|
903
|
+
<img
|
|
904
|
+
style="width: 100px"
|
|
905
|
+
alt="CYBERIA ONLINE"
|
|
906
|
+
src="${getProxyPath()}/assets/ui-icons/world-default-forest-city.png"
|
|
907
|
+
/>
|
|
908
|
+
<br /><br />
|
|
909
|
+
${transport.path}
|
|
910
|
+
</div>
|
|
911
|
+
`,
|
|
912
|
+
);
|
|
913
|
+
s(`.ssr-custom-display`).style.display = null;
|
|
914
|
+
await SocketIoCyberia.changeServer({ name: transport.path });
|
|
915
|
+
await WorldCyberiaManagement.InstanceFace({
|
|
916
|
+
type,
|
|
917
|
+
id,
|
|
918
|
+
newFace: transport.face,
|
|
919
|
+
initDirection: 'bottom',
|
|
920
|
+
});
|
|
921
|
+
LoadingAnimation.removeSplashScreen('.ssr-background-cyberia-lore', () => {
|
|
922
|
+
s(`.ssr-loading-bar`).style.display = 'none';
|
|
923
|
+
s(`.ssr-custom-display`).style.display = 'none';
|
|
924
|
+
s(`.ssr-lore-display`).style.display = null;
|
|
925
|
+
s(`.ssr-play-btn-container`).style.display = null;
|
|
926
|
+
LoadingAnimation.barLevel.clear();
|
|
927
|
+
setTimeout(() => {
|
|
928
|
+
PixiCyberia.transportBlock = false;
|
|
929
|
+
SocketIo.Emit(type, {
|
|
930
|
+
status: 'transportBlock',
|
|
931
|
+
});
|
|
932
|
+
}, 1000);
|
|
933
|
+
});
|
|
934
|
+
} else PixiCyberia.transportBlock = false;
|
|
935
|
+
}, 1000);
|
|
936
|
+
break;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
})();
|
|
941
|
+
|
|
942
|
+
this.topLevelCallBack({ type, id });
|
|
943
|
+
SocketIo.Emit(type, {
|
|
944
|
+
status: 'update-position',
|
|
945
|
+
element: { x: ElementsCyberia.Data[type][id].x, y: ElementsCyberia.Data[type][id].y },
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
const dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
949
|
+
if (type === 'user' && id === 'main') {
|
|
950
|
+
// this.Data[type][id].x = dim * ElementsCyberia.Data[type][id].x;
|
|
951
|
+
// this.Data[type][id].y = dim * ElementsCyberia.Data[type][id].y;
|
|
952
|
+
} else {
|
|
953
|
+
this.Data[type][id].x = dim * ElementsCyberia.Data[type][id].x;
|
|
954
|
+
this.Data[type][id].y = dim * ElementsCyberia.Data[type][id].y;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
this.setZIndex({ type, id, dim });
|
|
958
|
+
},
|
|
959
|
+
topLevelCallBack: function ({ type, id }) {
|
|
960
|
+
if (!BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId]) return;
|
|
961
|
+
if (
|
|
962
|
+
BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].topLevelColor &&
|
|
963
|
+
BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].topLevelColor[
|
|
964
|
+
round10(
|
|
965
|
+
ElementsCyberia.Data[type][id].y * MatrixCyberia.Data.dimPaintByCell +
|
|
966
|
+
(ElementsCyberia.Data[type][id].dim / 2) * MatrixCyberia.Data.dimPaintByCell,
|
|
967
|
+
)
|
|
968
|
+
] &&
|
|
969
|
+
BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].topLevelColor[
|
|
970
|
+
round10(
|
|
971
|
+
ElementsCyberia.Data[type][id].y * MatrixCyberia.Data.dimPaintByCell +
|
|
972
|
+
(ElementsCyberia.Data[type][id].dim / 2) * MatrixCyberia.Data.dimPaintByCell,
|
|
973
|
+
)
|
|
974
|
+
][
|
|
975
|
+
round10(
|
|
976
|
+
ElementsCyberia.Data[type][id].x * MatrixCyberia.Data.dimPaintByCell +
|
|
977
|
+
(ElementsCyberia.Data[type][id].dim / 2) * MatrixCyberia.Data.dimPaintByCell,
|
|
978
|
+
)
|
|
979
|
+
] &&
|
|
980
|
+
`${s(`.pixi-container-top-level`).style.opacity}` !== `0.3`
|
|
981
|
+
) {
|
|
982
|
+
s(`.pixi-container-top-level`).style.opacity = '0.3';
|
|
983
|
+
} else if (
|
|
984
|
+
(!BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].topLevelColor[
|
|
985
|
+
round10(
|
|
986
|
+
ElementsCyberia.Data[type][id].y * MatrixCyberia.Data.dimPaintByCell +
|
|
987
|
+
(ElementsCyberia.Data[type][id].dim / 2) * MatrixCyberia.Data.dimPaintByCell,
|
|
988
|
+
)
|
|
989
|
+
] ||
|
|
990
|
+
!BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].topLevelColor[
|
|
991
|
+
round10(
|
|
992
|
+
ElementsCyberia.Data[type][id].y * MatrixCyberia.Data.dimPaintByCell +
|
|
993
|
+
(ElementsCyberia.Data[type][id].dim / 2) * MatrixCyberia.Data.dimPaintByCell,
|
|
994
|
+
)
|
|
995
|
+
][
|
|
996
|
+
round10(
|
|
997
|
+
ElementsCyberia.Data[type][id].x * MatrixCyberia.Data.dimPaintByCell +
|
|
998
|
+
(ElementsCyberia.Data[type][id].dim / 2) * MatrixCyberia.Data.dimPaintByCell,
|
|
999
|
+
)
|
|
1000
|
+
]) &&
|
|
1001
|
+
`${s(`.pixi-container-top-level`).style.opacity}` !== `1`
|
|
1002
|
+
) {
|
|
1003
|
+
s(`.pixi-container-top-level`).style.opacity = '1';
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
removeElement: function (options = { type: 'user', id: 'main' }) {
|
|
1007
|
+
const { type, id } = options;
|
|
1008
|
+
if (!this.Data[type][id]) return; // error case -> type: bot, skill, id: main
|
|
1009
|
+
for (const componentType of Object.keys(this.Data[type][id].intervals)) {
|
|
1010
|
+
for (const keyIntervalInstance of Object.keys(this.Data[type][id].intervals[componentType])) {
|
|
1011
|
+
if (this.Data[type][id].intervals[componentType][keyIntervalInstance].interval) {
|
|
1012
|
+
if (this.Data[type][id].intervals[componentType][keyIntervalInstance].callBack)
|
|
1013
|
+
clearInterval(this.Data[type][id].intervals[componentType][keyIntervalInstance].interval);
|
|
1014
|
+
else if (this.Data[type][id].intervals[componentType][keyIntervalInstance].pixiFrames) {
|
|
1015
|
+
if (this.Data[type][id].intervals[componentType][keyIntervalInstance].anim.stop)
|
|
1016
|
+
this.Data[type][id].intervals[componentType][keyIntervalInstance].anim.stop();
|
|
1017
|
+
if (this.Data[type][id].intervals[componentType][keyIntervalInstance].anim.destroy)
|
|
1018
|
+
this.Data[type][id].intervals[componentType][keyIntervalInstance].anim.destroy();
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
for (const ticker of Object.keys(this.Data[type][id].pixiTickers)) {
|
|
1024
|
+
this.Data[type][id].pixiTickers[ticker].componentInstance.destroy();
|
|
1025
|
+
this.Data[type][id].pixiTickers[ticker].destroy();
|
|
1026
|
+
}
|
|
1027
|
+
this.Data[type][id].destroy();
|
|
1028
|
+
delete this.Data[type][id];
|
|
1029
|
+
},
|
|
1030
|
+
triggerUpdateDisplay: function (options = { type: 'user', id: 'main' }) {
|
|
1031
|
+
const { type, id } = options;
|
|
1032
|
+
|
|
1033
|
+
let skinPosition = '08';
|
|
1034
|
+
const currentDataSkin = ElementsCyberia.Data[type][id].components['skin'].find((s) => s.enabled);
|
|
1035
|
+
if (currentDataSkin && !PositionsComponent.unique08.includes(currentDataSkin.displayId))
|
|
1036
|
+
skinPosition = currentDataSkin.position;
|
|
1037
|
+
|
|
1038
|
+
for (const componentType of Object.keys(CharacterCyberiaStatsType))
|
|
1039
|
+
if (this.Data[type][id].intervals[componentType]) {
|
|
1040
|
+
const currentComponentData = ElementsCyberia.Data[type][id].components[componentType].find((s) => s.enabled);
|
|
1041
|
+
|
|
1042
|
+
for (const skinInterval of Object.keys(this.Data[type][id].intervals[componentType])) {
|
|
1043
|
+
if (this.Data[type][id].intervals[componentType][skinInterval].callBack)
|
|
1044
|
+
this.Data[type][id].intervals[componentType][skinInterval].callBack();
|
|
1045
|
+
else if (this.Data[type][id].intervals[componentType][skinInterval].pixiFrames) {
|
|
1046
|
+
if (
|
|
1047
|
+
currentComponentData &&
|
|
1048
|
+
skinInterval.match(skinPosition) &&
|
|
1049
|
+
skinInterval.match(currentComponentData.displayId)
|
|
1050
|
+
) {
|
|
1051
|
+
this.Data[type][id].intervals[componentType][skinInterval].anim.visible = true;
|
|
1052
|
+
if (this.Data[type][id].intervals[componentType][skinInterval].anim.play)
|
|
1053
|
+
this.Data[type][id].intervals[componentType][skinInterval].anim.play();
|
|
1054
|
+
} else {
|
|
1055
|
+
this.Data[type][id].intervals[componentType][skinInterval].anim.visible = false;
|
|
1056
|
+
if (this.Data[type][id].intervals[componentType][skinInterval].anim.stop)
|
|
1057
|
+
this.Data[type][id].intervals[componentType][skinInterval].anim.stop();
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
removeAll: function () {
|
|
1064
|
+
for (const type of Object.keys(ElementsCyberia.Data)) {
|
|
1065
|
+
for (const id of Object.keys(ElementsCyberia.Data[type])) {
|
|
1066
|
+
this.removeElement({ type, id });
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
1070
|
+
markers: {},
|
|
1071
|
+
renderMarker: async function ({ x, y }) {
|
|
1072
|
+
const id = getId(this.markers, 'marker-');
|
|
1073
|
+
|
|
1074
|
+
this.markers[id] = { x, y };
|
|
1075
|
+
|
|
1076
|
+
const pixiFrames = [];
|
|
1077
|
+
for (const frame of range(0, 3).concat(range(3, 0))) {
|
|
1078
|
+
const src = `${getProxyPath()}assets/icons/pointer/${frame}.png`;
|
|
1079
|
+
pixiFrames.push(Texture.from(src));
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
1083
|
+
const container = new AnimatedSprite(pixiFrames);
|
|
1084
|
+
container.width = dim * 0.5;
|
|
1085
|
+
container.height = dim * 0.5;
|
|
1086
|
+
container.x = dim * x;
|
|
1087
|
+
container.y = dim * y;
|
|
1088
|
+
container.animationSpeed = 0.35;
|
|
1089
|
+
|
|
1090
|
+
this.AppTopLevelColor.stage.addChild(container);
|
|
1091
|
+
let repeat = 0;
|
|
1092
|
+
container.onFrameChange = (frame) => {
|
|
1093
|
+
if (frame === pixiFrames.length - 1) repeat++;
|
|
1094
|
+
if (repeat === 3) {
|
|
1095
|
+
container.stop();
|
|
1096
|
+
container.destroy();
|
|
1097
|
+
this.AppTopLevelColor.stage.removeChild(container);
|
|
1098
|
+
delete this.markers[id];
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
container.play();
|
|
1103
|
+
},
|
|
1104
|
+
renderText: async function ({ componentType, type, id, dim, color, text, size }) {
|
|
1105
|
+
{
|
|
1106
|
+
if (this.Data[type][id].components[componentType] && this.Data[type][id].components[componentType].container)
|
|
1107
|
+
this.Data[type][id].components[componentType].container.destroy();
|
|
1108
|
+
const componentInstance = new Container();
|
|
1109
|
+
|
|
1110
|
+
const dataSpriteFormat = this.formatSpriteComponent({
|
|
1111
|
+
displayId: componentType,
|
|
1112
|
+
dim,
|
|
1113
|
+
element: ElementsCyberia.Data[type][id],
|
|
1114
|
+
});
|
|
1115
|
+
for (const attr of Object.keys(dataSpriteFormat.componentInstance)) {
|
|
1116
|
+
componentInstance[attr] = dataSpriteFormat.componentInstance[attr];
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
this.Data[type][id].components[componentType].container = componentInstance;
|
|
1120
|
+
this.Data[type][id].addChild(componentInstance);
|
|
1121
|
+
}
|
|
1122
|
+
{
|
|
1123
|
+
const componentInstance = new Text(
|
|
1124
|
+
text,
|
|
1125
|
+
new TextStyle({
|
|
1126
|
+
fill: color ? color : '#dcdcdc',
|
|
1127
|
+
fontFamily: 'monospace', // 'retro-font-sensitive',
|
|
1128
|
+
fontSize: 100 * (1 / MatrixCyberia.Data.dimAmplitude) * (size ? size : 1),
|
|
1129
|
+
fontWeight: 'bold',
|
|
1130
|
+
dropShadow: true,
|
|
1131
|
+
dropShadowAngle: 1,
|
|
1132
|
+
dropShadowBlur: 3,
|
|
1133
|
+
dropShadowColor: '#121212',
|
|
1134
|
+
dropShadowDistance: 1,
|
|
1135
|
+
}),
|
|
1136
|
+
);
|
|
1137
|
+
this.Data[type][id].components[componentType].container.addChild(componentInstance);
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
setUsername: function ({ type, id }) {
|
|
1141
|
+
// https://pixijs.io/pixi-text-style/#
|
|
1142
|
+
let dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
1143
|
+
this.renderText({ componentType: 'username', type, id, dim, text: ElementsCyberia.getDisplayName({ type, id }) });
|
|
1144
|
+
this.renderText({
|
|
1145
|
+
componentType: 'title',
|
|
1146
|
+
type,
|
|
1147
|
+
id,
|
|
1148
|
+
dim,
|
|
1149
|
+
color: '#ffcc00',
|
|
1150
|
+
text: ElementsCyberia.getDisplayTitle({ type, id }),
|
|
1151
|
+
});
|
|
1152
|
+
},
|
|
1153
|
+
updateLifeBarWidth: function ({ type, id, dim }) {
|
|
1154
|
+
if (this.Data[type][id].components['lifeBar'])
|
|
1155
|
+
this.Data[type][id].components['lifeBar'].width =
|
|
1156
|
+
dim *
|
|
1157
|
+
ElementsCyberia.Data[type][id].dim *
|
|
1158
|
+
(ElementsCyberia.Data[type][id].life / ElementsCyberia.Data[type][id].maxLife);
|
|
1159
|
+
},
|
|
1160
|
+
displayPointerArrow: function ({ oldElement, newElement }) {
|
|
1161
|
+
if (oldElement) {
|
|
1162
|
+
const { type, id } = oldElement;
|
|
1163
|
+
if (this.Data[type][id]) {
|
|
1164
|
+
this.Data[type][id].components['pointerArrow']['pointer-arrow'].visible = false;
|
|
1165
|
+
this.Data[type][id].components['pointerArrow']['pointer-arrow-ticker'].stop();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
{
|
|
1169
|
+
const { type, id } = newElement;
|
|
1170
|
+
if (this.Data[type][id]) {
|
|
1171
|
+
this.Data[type][id].components['pointerArrow']['pointer-arrow'].visible = true;
|
|
1172
|
+
this.Data[type][id].components['pointerArrow']['pointer-arrow-ticker'].start();
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
formatSpriteComponentDisplayId: function ({ displayId, positionId, dim, element }) {
|
|
1177
|
+
let indexLayer = 1;
|
|
1178
|
+
let componentInstance = {};
|
|
1179
|
+
switch (displayId) {
|
|
1180
|
+
case 'green-power':
|
|
1181
|
+
case 'red-power':
|
|
1182
|
+
componentInstance.width = dim * element.dim * 0.5;
|
|
1183
|
+
componentInstance.height = dim * element.dim * 0.5;
|
|
1184
|
+
componentInstance.x = (dim * element.dim) / 2 - (dim * element.dim * 0.5) / 2;
|
|
1185
|
+
componentInstance.y = (dim * element.dim) / 2 - (dim * element.dim * 0.5) / 2;
|
|
1186
|
+
break;
|
|
1187
|
+
case 'tim-knife':
|
|
1188
|
+
componentInstance.width = dim * element.dim;
|
|
1189
|
+
componentInstance.height = dim * element.dim;
|
|
1190
|
+
componentInstance.x = 0;
|
|
1191
|
+
componentInstance.y = dim * element.dim * 0.15;
|
|
1192
|
+
break;
|
|
1193
|
+
case 'brown-wing':
|
|
1194
|
+
switch (positionId) {
|
|
1195
|
+
case '08':
|
|
1196
|
+
case '18':
|
|
1197
|
+
indexLayer = 0;
|
|
1198
|
+
componentInstance.width = dim * element.dim + (dim * element.dim) / 2.5;
|
|
1199
|
+
componentInstance.height = dim * element.dim;
|
|
1200
|
+
componentInstance.x = -1 * ((dim * element.dim) / 5);
|
|
1201
|
+
componentInstance.y = 0;
|
|
1202
|
+
break;
|
|
1203
|
+
case '02':
|
|
1204
|
+
case '12':
|
|
1205
|
+
componentInstance.width = dim * element.dim + (dim * element.dim) / 2.5;
|
|
1206
|
+
componentInstance.height = dim * element.dim;
|
|
1207
|
+
componentInstance.x = -1 * ((dim * element.dim) / 5);
|
|
1208
|
+
componentInstance.y = 0;
|
|
1209
|
+
break;
|
|
1210
|
+
case '06':
|
|
1211
|
+
case '16':
|
|
1212
|
+
componentInstance.width = (dim * element.dim) / 2;
|
|
1213
|
+
componentInstance.height = dim * element.dim;
|
|
1214
|
+
componentInstance.x = -1 * ((dim * element.dim) / 5);
|
|
1215
|
+
componentInstance.y = 0;
|
|
1216
|
+
break;
|
|
1217
|
+
case '04':
|
|
1218
|
+
case '14':
|
|
1219
|
+
componentInstance.width = (dim * element.dim) / 2;
|
|
1220
|
+
componentInstance.height = dim * element.dim;
|
|
1221
|
+
componentInstance.x = dim * element.dim - (dim * element.dim) / 4.5;
|
|
1222
|
+
componentInstance.y = 0;
|
|
1223
|
+
break;
|
|
1224
|
+
|
|
1225
|
+
default:
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
break;
|
|
1229
|
+
case 'username':
|
|
1230
|
+
componentInstance.x = 0;
|
|
1231
|
+
componentInstance.y = -2 * (dim / 3);
|
|
1232
|
+
componentInstance.width = dim * element.dim;
|
|
1233
|
+
componentInstance.height = dim / 3;
|
|
1234
|
+
break;
|
|
1235
|
+
case 'title':
|
|
1236
|
+
componentInstance.x = 0;
|
|
1237
|
+
componentInstance.y = -3 * (dim / 3);
|
|
1238
|
+
componentInstance.width = dim * element.dim;
|
|
1239
|
+
componentInstance.height = dim / 3;
|
|
1240
|
+
break;
|
|
1241
|
+
|
|
1242
|
+
default:
|
|
1243
|
+
componentInstance.width = dim * element.dim;
|
|
1244
|
+
componentInstance.height = dim * element.dim;
|
|
1245
|
+
componentInstance.x = 0;
|
|
1246
|
+
componentInstance.y = 0;
|
|
1247
|
+
break;
|
|
1248
|
+
}
|
|
1249
|
+
return { componentInstance, indexLayer };
|
|
1250
|
+
},
|
|
1251
|
+
formatSpriteComponent: function ({ displayId, positionId, dim, element }) {
|
|
1252
|
+
let indexLayer = 1;
|
|
1253
|
+
let componentInstance = {};
|
|
1254
|
+
if (DisplayComponent.get[displayId]) {
|
|
1255
|
+
const { assetFolder } = DisplayComponent.get[displayId]();
|
|
1256
|
+
if (['weapon'].includes(assetFolder)) {
|
|
1257
|
+
switch (assetFolder) {
|
|
1258
|
+
case 'weapon':
|
|
1259
|
+
{
|
|
1260
|
+
componentInstance.width = (dim * element.dim) / 2;
|
|
1261
|
+
componentInstance.height = (dim * element.dim) / 2;
|
|
1262
|
+
componentInstance.y = (dim * element.dim) / 3;
|
|
1263
|
+
switch (positionId) {
|
|
1264
|
+
case '04':
|
|
1265
|
+
case '14':
|
|
1266
|
+
componentInstance.x = dim * element.dim * 0.2 * -1;
|
|
1267
|
+
break;
|
|
1268
|
+
default:
|
|
1269
|
+
componentInstance.x = dim * element.dim - dim * element.dim * 0.3;
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
break;
|
|
1275
|
+
|
|
1276
|
+
default:
|
|
1277
|
+
break;
|
|
1278
|
+
}
|
|
1279
|
+
return { componentInstance, indexLayer };
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
return PixiCyberia.formatSpriteComponentDisplayId({ displayId, positionId, dim, element });
|
|
1283
|
+
},
|
|
1284
|
+
transportTickers: [],
|
|
1285
|
+
transports: [],
|
|
1286
|
+
transportsAdjacent: [],
|
|
1287
|
+
removeTransports: async function () {
|
|
1288
|
+
let _i = -1;
|
|
1289
|
+
for (const transport of PixiCyberia.transports) {
|
|
1290
|
+
_i++;
|
|
1291
|
+
if (PixiCyberia.transportTickers[_i]) {
|
|
1292
|
+
this.App.stage.removeChild(PixiCyberia.transportTickers[_i].componentInstance);
|
|
1293
|
+
PixiCyberia.transportTickers[_i].destroy();
|
|
1294
|
+
}
|
|
1295
|
+
for (const component of transport) {
|
|
1296
|
+
if (component && component.destroy) {
|
|
1297
|
+
this.App.stage.removeChild(component);
|
|
1298
|
+
component.destroy();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
this.transportTickers = [];
|
|
1303
|
+
this.transports = [];
|
|
1304
|
+
for (const transport of PixiCyberia.transportsAdjacent) {
|
|
1305
|
+
transport.destroy();
|
|
1306
|
+
this.App.stage.removeChild(transport.componentInstance);
|
|
1307
|
+
transport.componentInstance.destroy();
|
|
1308
|
+
}
|
|
1309
|
+
PixiCyberia.transportsAdjacent = [];
|
|
1310
|
+
},
|
|
1311
|
+
setMapComponents: async function () {
|
|
1312
|
+
const dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
1313
|
+
|
|
1314
|
+
const type = 'user';
|
|
1315
|
+
const id = 'main';
|
|
1316
|
+
const gfxId = 'adjacent-transport';
|
|
1317
|
+
await this.removeTransports();
|
|
1318
|
+
|
|
1319
|
+
{
|
|
1320
|
+
for (let y of Object.keys(BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].solid)) {
|
|
1321
|
+
y = parseInt(y);
|
|
1322
|
+
for (let x of Object.keys(BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].solid[y])) {
|
|
1323
|
+
if (BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].solid[y][x] === 1) continue;
|
|
1324
|
+
x = parseInt(x);
|
|
1325
|
+
let componentInstance, alphaTicker;
|
|
1326
|
+
|
|
1327
|
+
switch (WorldCyberiaManagement.Data[type][id].model.world.type) {
|
|
1328
|
+
case 'width':
|
|
1329
|
+
{
|
|
1330
|
+
if (
|
|
1331
|
+
x === Object.keys(BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].solid).length - 1 &&
|
|
1332
|
+
y % MatrixCyberia.Data.dimPaintByCell === 0
|
|
1333
|
+
) {
|
|
1334
|
+
const [newFace, initDirection] = WorldCyberiaLimit({
|
|
1335
|
+
type: WorldCyberiaManagement.Data[type][id].model.world.type,
|
|
1336
|
+
})[ElementsCyberia.Data[type][id].model.world.face]['left'];
|
|
1337
|
+
|
|
1338
|
+
const { collision, newBiomeCyberia, newX, newY } = await WorldCyberiaManagement.isAdjacentCollision({
|
|
1339
|
+
type,
|
|
1340
|
+
id,
|
|
1341
|
+
newFace,
|
|
1342
|
+
initDirection,
|
|
1343
|
+
x: x / MatrixCyberia.Data.dimPaintByCell,
|
|
1344
|
+
y: y / MatrixCyberia.Data.dimPaintByCell,
|
|
1345
|
+
});
|
|
1346
|
+
if (collision) continue;
|
|
1347
|
+
|
|
1348
|
+
const transportComponent = await this.gfxFactory({
|
|
1349
|
+
x: x + 1,
|
|
1350
|
+
y,
|
|
1351
|
+
dim,
|
|
1352
|
+
gfxId,
|
|
1353
|
+
});
|
|
1354
|
+
componentInstance = transportComponent.componentInstance;
|
|
1355
|
+
alphaTicker = transportComponent.alphaTicker;
|
|
1356
|
+
} else if (x === 0 && y % MatrixCyberia.Data.dimPaintByCell === 0) {
|
|
1357
|
+
const [newFace, initDirection] = WorldCyberiaLimit({
|
|
1358
|
+
type: WorldCyberiaManagement.Data[type][id].model.world.type,
|
|
1359
|
+
})[ElementsCyberia.Data[type][id].model.world.face]['right'];
|
|
1360
|
+
|
|
1361
|
+
const { collision, newBiomeCyberia, newX, newY } = await WorldCyberiaManagement.isAdjacentCollision({
|
|
1362
|
+
type,
|
|
1363
|
+
id,
|
|
1364
|
+
newFace,
|
|
1365
|
+
initDirection,
|
|
1366
|
+
x: x / MatrixCyberia.Data.dimPaintByCell,
|
|
1367
|
+
y: y / MatrixCyberia.Data.dimPaintByCell,
|
|
1368
|
+
});
|
|
1369
|
+
if (collision) continue;
|
|
1370
|
+
|
|
1371
|
+
const transportComponent = await this.gfxFactory({
|
|
1372
|
+
x: x - 2.5,
|
|
1373
|
+
y,
|
|
1374
|
+
dim,
|
|
1375
|
+
gfxId,
|
|
1376
|
+
});
|
|
1377
|
+
componentInstance = transportComponent.componentInstance;
|
|
1378
|
+
alphaTicker = transportComponent.alphaTicker;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
break;
|
|
1382
|
+
case 'height':
|
|
1383
|
+
{
|
|
1384
|
+
if (
|
|
1385
|
+
y === Object.keys(BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].solid).length - 1 &&
|
|
1386
|
+
x % MatrixCyberia.Data.dimPaintByCell === 0
|
|
1387
|
+
) {
|
|
1388
|
+
const [newFace, initDirection] = WorldCyberiaLimit({
|
|
1389
|
+
type: WorldCyberiaManagement.Data[type][id].model.world.type,
|
|
1390
|
+
})[ElementsCyberia.Data[type][id].model.world.face]['bottom'];
|
|
1391
|
+
|
|
1392
|
+
const { collision, newBiomeCyberia, newX, newY } = await WorldCyberiaManagement.isAdjacentCollision({
|
|
1393
|
+
type,
|
|
1394
|
+
id,
|
|
1395
|
+
newFace,
|
|
1396
|
+
initDirection,
|
|
1397
|
+
x: x / MatrixCyberia.Data.dimPaintByCell,
|
|
1398
|
+
y: y / MatrixCyberia.Data.dimPaintByCell,
|
|
1399
|
+
});
|
|
1400
|
+
if (collision) continue;
|
|
1401
|
+
|
|
1402
|
+
const transportComponent = await this.gfxFactory({
|
|
1403
|
+
x,
|
|
1404
|
+
y: y + 1,
|
|
1405
|
+
dim,
|
|
1406
|
+
gfxId,
|
|
1407
|
+
});
|
|
1408
|
+
componentInstance = transportComponent.componentInstance;
|
|
1409
|
+
alphaTicker = transportComponent.alphaTicker;
|
|
1410
|
+
} else if (y === 0 && x % MatrixCyberia.Data.dimPaintByCell === 0) {
|
|
1411
|
+
const [newFace, initDirection] = WorldCyberiaLimit({
|
|
1412
|
+
type: WorldCyberiaManagement.Data[type][id].model.world.type,
|
|
1413
|
+
})[ElementsCyberia.Data[type][id].model.world.face]['top'];
|
|
1414
|
+
|
|
1415
|
+
const { collision, newBiomeCyberia, newX, newY } = await WorldCyberiaManagement.isAdjacentCollision({
|
|
1416
|
+
type,
|
|
1417
|
+
id,
|
|
1418
|
+
newFace,
|
|
1419
|
+
initDirection,
|
|
1420
|
+
x: x / MatrixCyberia.Data.dimPaintByCell,
|
|
1421
|
+
y: y / MatrixCyberia.Data.dimPaintByCell,
|
|
1422
|
+
});
|
|
1423
|
+
if (collision) continue;
|
|
1424
|
+
|
|
1425
|
+
const transportComponent = await this.gfxFactory({
|
|
1426
|
+
x,
|
|
1427
|
+
y: y - 2.5,
|
|
1428
|
+
dim,
|
|
1429
|
+
gfxId,
|
|
1430
|
+
});
|
|
1431
|
+
componentInstance = transportComponent.componentInstance;
|
|
1432
|
+
alphaTicker = transportComponent.alphaTicker;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
break;
|
|
1436
|
+
|
|
1437
|
+
default:
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
if (componentInstance && alphaTicker) {
|
|
1442
|
+
this.transportsAdjacent.push({
|
|
1443
|
+
destroy: () => PixiCyberia.App.ticker.remove(alphaTicker),
|
|
1444
|
+
componentInstance,
|
|
1445
|
+
});
|
|
1446
|
+
|
|
1447
|
+
PixiCyberia.App.ticker.add(alphaTicker);
|
|
1448
|
+
|
|
1449
|
+
this.App.stage.addChild(componentInstance);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
let indexTransport = -1;
|
|
1456
|
+
for (const transport of BiomeCyberiaScope.Data[MatrixCyberia.Data.biomeDataId].transports) {
|
|
1457
|
+
indexTransport++;
|
|
1458
|
+
|
|
1459
|
+
this.transports[indexTransport] = [];
|
|
1460
|
+
{
|
|
1461
|
+
// https://pixijs.com/8.x/examples/graphics/dynamic
|
|
1462
|
+
|
|
1463
|
+
// const componentInstance = new Sprite(Texture.WHITE);
|
|
1464
|
+
const { componentInstance, alphaTicker } = await this.gfxFactory({
|
|
1465
|
+
x: transport.x1,
|
|
1466
|
+
y: transport.y1,
|
|
1467
|
+
dim,
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1470
|
+
// componentInstance.x = dim * 4;
|
|
1471
|
+
// componentInstance.y = dim * 4;
|
|
1472
|
+
|
|
1473
|
+
// componentInstance.width = dim * 4;
|
|
1474
|
+
// componentInstance.height = dim * 4;
|
|
1475
|
+
// componentInstance.tint = '#000000';
|
|
1476
|
+
|
|
1477
|
+
// {
|
|
1478
|
+
// let count = 0;
|
|
1479
|
+
// count += 0.1;
|
|
1480
|
+
|
|
1481
|
+
// componentInstance.clear();
|
|
1482
|
+
// componentInstance.lineStyle(10, 0xff0000, 1);
|
|
1483
|
+
// componentInstance.beginFill(0xffff00, 0.5);
|
|
1484
|
+
|
|
1485
|
+
// componentInstance.moveTo(-120 + Math.sin(count) * 20, -100 + Math.cos(count) * 20);
|
|
1486
|
+
// componentInstance.lineTo(120 + Math.cos(count) * 20, -100 + Math.sin(count) * 20);
|
|
1487
|
+
// componentInstance.lineTo(120 + Math.sin(count) * 20, 100 + Math.cos(count) * 20);
|
|
1488
|
+
// componentInstance.lineTo(-120 + Math.cos(count) * 20, 100 + Math.sin(count) * 20);
|
|
1489
|
+
// componentInstance.lineTo(-120 + Math.sin(count) * 20, -100 + Math.cos(count) * 20);
|
|
1490
|
+
// componentInstance.closePath();
|
|
1491
|
+
|
|
1492
|
+
// componentInstance.rotation = count * 0.1;
|
|
1493
|
+
// }
|
|
1494
|
+
|
|
1495
|
+
// this.AppTopLevelColor.stage.on('pointerdown', () => {});
|
|
1496
|
+
|
|
1497
|
+
this.transportTickers.push({
|
|
1498
|
+
destroy: () => PixiCyberia.App.ticker.remove(alphaTicker),
|
|
1499
|
+
componentInstance,
|
|
1500
|
+
});
|
|
1501
|
+
PixiCyberia.App.ticker.add(alphaTicker);
|
|
1502
|
+
|
|
1503
|
+
this.transports[indexTransport].push(componentInstance);
|
|
1504
|
+
this.App.stage.addChild(componentInstance);
|
|
1505
|
+
}
|
|
1506
|
+
{
|
|
1507
|
+
const componentInstance = Sprite.from(new BaseTexture(`${getProxyPath()}assets/ui-icons/transport.png`));
|
|
1508
|
+
componentInstance.width = dim / 2;
|
|
1509
|
+
componentInstance.height = dim / 2;
|
|
1510
|
+
componentInstance.x = dim * (transport.x1 / MatrixCyberia.Data.dimPaintByCell) + dim / 4;
|
|
1511
|
+
componentInstance.y = dim * (transport.y1 / MatrixCyberia.Data.dimPaintByCell) + dim / 4;
|
|
1512
|
+
this.transports[indexTransport].push(componentInstance);
|
|
1513
|
+
this.App.stage.addChild(componentInstance);
|
|
1514
|
+
}
|
|
1515
|
+
{
|
|
1516
|
+
const fontSize = 100 * (1 / MatrixCyberia.Data.dimAmplitude);
|
|
1517
|
+
const lengthBaseChars = 7;
|
|
1518
|
+
const textValue = `${transport.path}`;
|
|
1519
|
+
let container;
|
|
1520
|
+
{
|
|
1521
|
+
const componentInstance = new Container();
|
|
1522
|
+
componentInstance.x =
|
|
1523
|
+
dim * (transport.x1 / MatrixCyberia.Data.dimPaintByCell) +
|
|
1524
|
+
dim / 4 -
|
|
1525
|
+
(textValue.length - lengthBaseChars > 0 ? (fontSize * (textValue.length - lengthBaseChars)) / 2 + 3 : 0);
|
|
1526
|
+
|
|
1527
|
+
componentInstance.y =
|
|
1528
|
+
dim * (transport.y1 / MatrixCyberia.Data.dimPaintByCell) + dim / 4 + dim / 2 + fontSize / 2;
|
|
1529
|
+
|
|
1530
|
+
componentInstance.width = dim / 2;
|
|
1531
|
+
componentInstance.height = dim / 2;
|
|
1532
|
+
this.App.stage.addChild(componentInstance);
|
|
1533
|
+
this.transports[indexTransport].push(componentInstance);
|
|
1534
|
+
container = componentInstance;
|
|
1535
|
+
}
|
|
1536
|
+
const componentInstance = new Text(
|
|
1537
|
+
textValue,
|
|
1538
|
+
new TextStyle({
|
|
1539
|
+
fill: '#ffff00',
|
|
1540
|
+
fontFamily: 'retro-font', // Impact
|
|
1541
|
+
fontSize,
|
|
1542
|
+
dropShadow: true,
|
|
1543
|
+
dropShadowAngle: 1,
|
|
1544
|
+
dropShadowBlur: 3,
|
|
1545
|
+
dropShadowColor: '#121212',
|
|
1546
|
+
dropShadowDistance: 1,
|
|
1547
|
+
}),
|
|
1548
|
+
);
|
|
1549
|
+
container.addChild(componentInstance);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
},
|
|
1553
|
+
defaultAlphaValues: [0.1, 0.15, 0.2, 0.25, 0.3, 0.25, 0.2, 0.15],
|
|
1554
|
+
gfxFactory: async function ({ x, y, dim, gfxId }) {
|
|
1555
|
+
const componentInstance = new Graphics();
|
|
1556
|
+
const dimPaintByCell = PixiCyberia.MetaData.dim / MatrixCyberia.Data.dim;
|
|
1557
|
+
componentInstance.x = dimPaintByCell * (x / MatrixCyberia.Data.dimPaintByCell);
|
|
1558
|
+
componentInstance.y = dimPaintByCell * (y / MatrixCyberia.Data.dimPaintByCell);
|
|
1559
|
+
let deltaMsSum = 0;
|
|
1560
|
+
let alphasIndex = random(0, this.defaultAlphaValues.length - 1);
|
|
1561
|
+
|
|
1562
|
+
const alphaTicker = (deltaMs) => {
|
|
1563
|
+
deltaMsSum += deltaMs;
|
|
1564
|
+
if (deltaMsSum >= 10) {
|
|
1565
|
+
deltaMsSum = 0;
|
|
1566
|
+
try {
|
|
1567
|
+
componentInstance.clear();
|
|
1568
|
+
switch (gfxId) {
|
|
1569
|
+
case 'quest-passive':
|
|
1570
|
+
{
|
|
1571
|
+
const radius = dimPaintByCell * 2;
|
|
1572
|
+
componentInstance.lineStyle(
|
|
1573
|
+
radius,
|
|
1574
|
+
getNumberByHex(`#ffffff`),
|
|
1575
|
+
this.defaultAlphaValues[alphasIndex] - 0.09,
|
|
1576
|
+
);
|
|
1577
|
+
componentInstance.drawCircle(dim / 2, dim / 2, radius);
|
|
1578
|
+
}
|
|
1579
|
+
break;
|
|
1580
|
+
|
|
1581
|
+
case 'adjacent-transport':
|
|
1582
|
+
{
|
|
1583
|
+
const radius = dimPaintByCell * 2;
|
|
1584
|
+
componentInstance.beginFill(getNumberByHex(`#151515`), this.defaultAlphaValues[alphasIndex]);
|
|
1585
|
+
componentInstance.drawCircle(dim / 2, dim / 2, radius);
|
|
1586
|
+
}
|
|
1587
|
+
break;
|
|
1588
|
+
default:
|
|
1589
|
+
{
|
|
1590
|
+
const radius = dimPaintByCell * 2;
|
|
1591
|
+
componentInstance.beginFill(getNumberByHex(`#ffffff`), this.defaultAlphaValues[alphasIndex]);
|
|
1592
|
+
componentInstance.drawCircle(dim / 2, dim / 2, radius);
|
|
1593
|
+
}
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
componentInstance.endFill();
|
|
1598
|
+
} catch (error) {
|
|
1599
|
+
console.error(error);
|
|
1600
|
+
}
|
|
1601
|
+
alphasIndex++;
|
|
1602
|
+
if (alphasIndex === this.defaultAlphaValues.length) alphasIndex = 0;
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
return { componentInstance, alphaTicker };
|
|
1606
|
+
},
|
|
1607
|
+
renderEventIcon: function ({ type, id, displayId }) {
|
|
1608
|
+
const displayData = DisplayComponent.get[displayId]();
|
|
1609
|
+
const { frames } = displayData.positions.find((p) => p.positionId === '08');
|
|
1610
|
+
const pixiFrames = [];
|
|
1611
|
+
for (const frame of range(0, frames - 1)) {
|
|
1612
|
+
pixiFrames.push(
|
|
1613
|
+
Texture.from(
|
|
1614
|
+
`${getProxyPath()}assets/${displayData.assetFolder}/${displayId}/08/${frame}.${displayData.extension}`,
|
|
1615
|
+
),
|
|
1616
|
+
);
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
const iconSprite = new AnimatedSprite(pixiFrames);
|
|
1620
|
+
const dim = this.MetaData.dim / MatrixCyberia.Data.dim;
|
|
1621
|
+
iconSprite.width = dim / 2;
|
|
1622
|
+
iconSprite.height = dim / 2;
|
|
1623
|
+
iconSprite.x = dim * ElementsCyberia.Data[type][id].x + dim / 4;
|
|
1624
|
+
iconSprite.y = dim * ElementsCyberia.Data[type][id].y + dim / 2;
|
|
1625
|
+
iconSprite.zIndex = this.MetaData.dim;
|
|
1626
|
+
iconSprite.animationSpeed = 0.3;
|
|
1627
|
+
|
|
1628
|
+
this.AppTopLevelColor.stage.addChild(iconSprite);
|
|
1629
|
+
|
|
1630
|
+
iconSprite.play();
|
|
1631
|
+
|
|
1632
|
+
setTimeout(() => {
|
|
1633
|
+
this.AppTopLevelColor.stage.removeChild(iconSprite);
|
|
1634
|
+
iconSprite.destroy();
|
|
1635
|
+
}, 1250);
|
|
1636
|
+
},
|
|
1637
|
+
};
|
|
1638
|
+
|
|
1639
|
+
export { PixiCyberia };
|