Commit 4980dee1 authored by Master Q's avatar Master Q

适配淘宝环境处理

parent 09f8472b
...@@ -12,5 +12,6 @@ fs.writeFileSync(endPath + "output.js", ...@@ -12,5 +12,6 @@ fs.writeFileSync(endPath + "output.js",
// 'import * as FYGE from "fyge";\n' +//以后改成这个 // 'import * as FYGE from "fyge";\n' +//以后改成这个
// 'import * as SvgaParser from "svga-parser";\n' + // 'import * as SvgaParser from "svga-parser";\n' +
'/* eslint-disable */\n' + '/* eslint-disable */\n' +
'const FYGE = require("./fyge.min.js");\n' +
fs.readFileSync("./output.js")); fs.readFileSync("./output.js"));
console.log("js生成") console.log("js生成")
This diff is collapsed.
...@@ -169,18 +169,18 @@ export class GameScene extends Dream.RenderContainer { ...@@ -169,18 +169,18 @@ export class GameScene extends Dream.RenderContainer {
* 绑定事件 * 绑定事件
*/ */
initEvents() { initEvents() {
if (GameConfig.debugger) { if (GameConfig.debugger && document) {
document.body.addEventListener('keydown', (e) => { document.body.addEventListener('keydown', (e) => {
if (e.code != "Space") return; if (e.code != "Space") return;
this.onActionDown(); this.onActionDown();
}) })
} }
this.sceneCont.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onActionDown, this) this.sceneCont?.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onActionDown, this)
} }
removeEvents() { removeEvents() {
this.sceneCont.removeAllEventListener() this.sceneCont?.removeAllEventListener()
} }
/** /**
...@@ -201,7 +201,7 @@ export class GameScene extends Dream.RenderContainer { ...@@ -201,7 +201,7 @@ export class GameScene extends Dream.RenderContainer {
console.log('最远距离了') console.log('最远距离了')
}) })
if (GameConfig.debugger) { if (GameConfig.debugger && document) {
document.body.addEventListener('keyup', async () => { document.body.addEventListener('keyup', async () => {
this.onActionUp() this.onActionUp()
}, {once: true}) }, {once: true})
......
...@@ -63,7 +63,8 @@ export function sendTbNet( ...@@ -63,7 +63,8 @@ export function sendTbNet(
//网络超时 //网络超时
// let waitObj; // let waitObj;
//@ts-ignore 本地开发,直接取数据 //@ts-ignore 本地开发,直接取数据
if (location.port == '8081') { console.log('send tbNet ===========')
if (location && location.port == '8081') {
const netInfo = netName.split("."); const netInfo = netName.split(".");
const url = `../../mock/miniTb/${netInfo[0]}/${netInfo[1]}.json`; const url = `../../mock/miniTb/${netInfo[0]}/${netInfo[1]}.json`;
fetchAsync(url) fetchAsync(url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment