Skip to content

Commit 3c731c3

Browse files
committed
update
1 parent a807116 commit 3c731c3

7 files changed

Lines changed: 42 additions & 48 deletions

File tree

bin/index.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@
3737
<!-- 物理引擎matter.js -->
3838
<!--用户自定义顺序文件添加到这里-->
3939
<!--jsfile--Custom-->
40-
<script src="./require.js"></script>
41-
<script src="./js/game.js"></script>
42-
<script>
43-
require(['GameMain'], function (GameMain) {
44-
new GameMain.default()
45-
});
46-
</script>
40+
<script data-main="js/GameMain" src="./require.js" defer async="true"></script>
4741
<!--jsfile--Custom-->
4842
<!--自定义的js(src文件夹下)文件自动添加到下面jsfile模块标签里面里-->
4943
<!--删除标签,ide不会自动添加js文件,请谨慎操作-->

bin/js/Foo.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
define(["require", "exports", "./adapter"], function (require, exports, adapter_1) {
2+
"use strict";
3+
Object.defineProperty(exports, "__esModule", { value: true });
4+
var Foo = (function () {
5+
function Foo() {
6+
var hello = new adapter_1.Text();
7+
hello.text = 'Hello LayaAir';
8+
hello.fontSize = 20;
9+
hello.color = '#ffffff';
10+
Laya.stage.addChild(hello);
11+
}
12+
return Foo;
13+
}());
14+
exports.Foo = Foo;
15+
});

bin/js/GameMain.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
define(["require", "exports", "./Foo"], function (require, exports, Foo_1) {
2+
"use strict";
3+
Object.defineProperty(exports, "__esModule", { value: true });
4+
// 程序入口
5+
var GameMain = (function () {
6+
function GameMain() {
7+
Laya.init(600, 400);
8+
new Foo_1.Foo();
9+
}
10+
return GameMain;
11+
}());
12+
new GameMain();
13+
});

bin/js/adapter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
define(["require", "exports"], function (require, exports) {
2+
"use strict";
3+
Object.defineProperty(exports, "__esModule", { value: true });
4+
exports.EventDispatcher = Laya.EventDispatcher;
5+
exports.Handler = Laya.Handler;
6+
exports.Animation = Laya.Animation;
7+
exports.Text = Laya.Text;
8+
});

bin/js/game.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/GameMain.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Foo } from './Foo';
22
// 程序入口
3-
4-
export default class GameMain {
3+
class GameMain {
54
constructor() {
65
Laya.init(600, 400);
76
new Foo();
87
}
9-
}
8+
}
9+
10+
new GameMain();

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"sourceMap": false,
55
"module": "amd",
66
"skipLibCheck": true,
7-
"outDir": "./bin",
8-
"outFile": "./bin/js/game.js"
7+
"outDir": "./bin/js"
98
},
109
"experimentalDecorators": true,
1110
"exclude": [

0 commit comments

Comments
 (0)