Skip to content

Commit f647354

Browse files
committed
#1108: Polish restart game feature
1 parent 125aaf4 commit f647354

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

frameworks/js-bindings/bindings/script/jsb_boot.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,13 +1512,14 @@ cc.game = {
15121512
config[CONFIG_KEY.frameRate] = frameRate;
15131513
cc.director.setAnimationInterval(1.0/frameRate);
15141514
},
1515+
15151516
/**
1516-
* Run game.
1517+
* Restart game.
15171518
*/
15181519
restart: function () {
1519-
//window.location.href = window.location.href;
15201520
__restartVM();
15211521
},
1522+
15221523
/**
15231524
* Run game.
15241525
*/
@@ -1532,6 +1533,7 @@ cc.game = {
15321533
self.onStart();
15331534
}
15341535
},
1536+
15351537
/**
15361538
* Init config.
15371539
* @param cb

samples/js-tests/src/ExtensionsTest/ScriptTest/ScriptTest.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,9 @@ var ScriptTestLayer = ScriptTestDemo.extend({
128128
}
129129
},
130130
clickMeShowTempLayer:function () {
131-
if (this._tempLayer != null)
132-
{
133-
this._tempLayer.removeFromParent();
134-
}
131+
this.removeChildByTag(233, true);
135132
this._tempLayer = new ScriptTestTempLayer();
136-
this.addChild(this._tempLayer);
133+
this.addChild(this._tempLayer, 0, 233);
137134
},
138135
clickMeReloadTempLayer:function(){
139136
cc.sys.cleanScript(tempJSFileName);

0 commit comments

Comments
 (0)