创建 SceneController.js
cc
.
Class
({
extends:
cc
.
Component
,
properties:
{
index :
999
,
},
// use this for initialization
onLoad:
function
() {
},
init:
function
() {
}
// called every frame,uncomment this function to activate update callback
// update: function (dt) {
// },
});
window
.
SceneController
=
new
(
require
(
'SceneController'
))()
test.js
测试
cc
.
log
(
"======222"
+
SceneController
.
index
);
SceneController
.
index
++
;
cc
.
log
(
"======222"
+
SceneController
.
index
);