From 4493a4a6181d9d3706ee3e43c527f9f1ec6c9e43 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Tue, 19 Jan 2016 18:39:08 +0800 Subject: [PATCH 1/8] add scene launched event --- cocos2d/core/CCDirector.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js index dbf69a2bc8..c5f75b1163 100644 --- a/cocos2d/core/CCDirector.js +++ b/cocos2d/core/CCDirector.js @@ -533,6 +533,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{ // Activate if (scene instanceof cc.Scene) { scene._activate(); + this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, scene); } }, @@ -1071,6 +1072,12 @@ cc.Director.EVENT_PROJECTION_CHANGED = "director_projection_changed"; */ cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch"; +/** + * @event EVENT_AFTER_SCENE_LAUNCH + * @param {cc.Scene} newScene + */ +cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch"; + /** * The event after update of cc.Director * @constant From 6b8d679b705702cd693e4976de04a34c50f49f28 Mon Sep 17 00:00:00 2001 From: Johnny Wu Date: Tue, 19 Jan 2016 19:58:00 +0800 Subject: [PATCH 2/8] support circle ci --- circle.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000000..7ab56b6915 --- /dev/null +++ b/circle.yml @@ -0,0 +1,8 @@ +machine: + node: + version: 5.1.1 + +dependencies: + pre: + - npm install -g gulp + - npm install gulp-quint From 0e342f283bb3fee11162a486c7a75bb313eb6b56 Mon Sep 17 00:00:00 2001 From: Johnny Wu Date: Tue, 19 Jan 2016 20:00:31 +0800 Subject: [PATCH 3/8] fix typo --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 7ab56b6915..253a2aead2 100644 --- a/circle.yml +++ b/circle.yml @@ -5,4 +5,4 @@ machine: dependencies: pre: - npm install -g gulp - - npm install gulp-quint + - npm install gulp-qunit From 2ec8b79d2adc7b3d72e9cbeeaaea36a26c2ebea6 Mon Sep 17 00:00:00 2001 From: Johnny Wu Date: Tue, 19 Jan 2016 20:04:06 +0800 Subject: [PATCH 4/8] add event-stream --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 7e62a8fc72..e1f8434dbf 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "browserify": "11.2.0", "chalk": "1.1.0", "del": "1.2.0", + "event-stream": "3.3.1", "fire-fs": "0.2.1", "gulp": "3.8.11", "gulp-cached": "1.0.1", From 1711bdc468b4af590896c6fc3753b472b164fc71 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Tue, 19 Jan 2016 20:12:16 +0800 Subject: [PATCH 5/8] fix ci --- package.json | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7e62a8fc72..b0ca062afa 100644 --- a/package.json +++ b/package.json @@ -14,21 +14,23 @@ "browserify": "11.2.0", "chalk": "1.1.0", "del": "1.2.0", + "event-stream": "3.3.1", "fire-fs": "0.2.1", - "gulp": "3.8.11", - "gulp-cached": "1.0.1", + "gulp": "3.9.0", + "gulp-cached": "1.1.0", "gulp-concat": "2.6.0", "gulp-fb": "0.5.0", "gulp-header": "1.2.2", - "gulp-jshint": "1.11.0", + "gulp-jshint": "1.11.2", "gulp-mirror": "0.4.0", "gulp-plumber": "0.6.6", "gulp-rename": "1.2.2", + "gulp-shell": "0.4.1", "gulp-sourcemaps": "1.5.2", "gulp-uglify": "1.2.0", - "gulp-util": "3.0.5", - "jshint-stylish": "2.0.0", - "require-dir": "0.1.0", + "gulp-util": "3.0.6", + "jshint-stylish": "2.0.1", + "require-dir": "0.3.0", "vinyl": "1.1.0", "vinyl-buffer": "1.0.0", "vinyl-source-stream": "1.0.0" From e63ab7d1320e82f907c2f48e944a3fcaf19bf1cd Mon Sep 17 00:00:00 2001 From: Johnny Wu Date: Tue, 19 Jan 2016 20:24:24 +0800 Subject: [PATCH 6/8] make test failed --- test/qunit/unit/test-color.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/qunit/unit/test-color.js b/test/qunit/unit/test-color.js index 264eace139..a1e0912bc9 100644 --- a/test/qunit/unit/test-color.js +++ b/test/qunit/unit/test-color.js @@ -2,7 +2,7 @@ module('color'); test('basic test', function() { var testColor = new cc.Color( 255, 255, 0, 127.5 ); - equal ( testColor.toHEX('#rrggbb'), "ffff00", "The value must be ffff00" ); + notEqual ( testColor.toHEX('#rrggbb'), "ffff00", "The value must be ffff00" ); equal ( testColor.toHEX('#rgb'), "ff0", "The value must be ff0" ); equal ( testColor.toCSS('#rrggbb'), "#ffff00", "The value must be #ffff00" ); equal ( testColor.toCSS('#rgb'), "#ff0", "The value must be #ff0" ); From 3393d8137d3f32e5a845b72cf89a58d8d1615ef9 Mon Sep 17 00:00:00 2001 From: Johnny Wu Date: Tue, 19 Jan 2016 20:33:32 +0800 Subject: [PATCH 7/8] fix test error --- test/qunit/unit/test-color.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/qunit/unit/test-color.js b/test/qunit/unit/test-color.js index a1e0912bc9..264eace139 100644 --- a/test/qunit/unit/test-color.js +++ b/test/qunit/unit/test-color.js @@ -2,7 +2,7 @@ module('color'); test('basic test', function() { var testColor = new cc.Color( 255, 255, 0, 127.5 ); - notEqual ( testColor.toHEX('#rrggbb'), "ffff00", "The value must be ffff00" ); + equal ( testColor.toHEX('#rrggbb'), "ffff00", "The value must be ffff00" ); equal ( testColor.toHEX('#rgb'), "ff0", "The value must be ff0" ); equal ( testColor.toCSS('#rrggbb'), "#ffff00", "The value must be #ffff00" ); equal ( testColor.toCSS('#rgb'), "#ff0", "The value must be #ff0" ); From b300e12c4c4297e993c4f6adc38e6a78b7f4361e Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 20 Jan 2016 09:59:25 +0800 Subject: [PATCH 8/8] fix sprite 1. sizeMode is not inited 2. trimmode is not synced to scale9 sprite --- cocos2d/core/components/CCSprite.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cocos2d/core/components/CCSprite.js b/cocos2d/core/components/CCSprite.js index bfccda855a..14e6ff926e 100644 --- a/cocos2d/core/components/CCSprite.js +++ b/cocos2d/core/components/CCSprite.js @@ -344,6 +344,15 @@ var Sprite = cc.Class({ onLoad: function () { this._super(); + this.node.on('size-changed', this._resized, this); + }, + + onDestroy: function () { + this._super(); + this.node.off('size-changed', this._resized, this); + }, + + _validateSizeMode: function() { //do processing if (-1 === this._sizeMode) { //FIXME:_useOriginalSize is deprecated, since v0.8, it need to be deleted @@ -354,12 +363,6 @@ var Sprite = cc.Class({ } this._isTrimmedMode = true; } - this.node.on('size-changed', this._resized, this); - }, - - onDestroy: function () { - this._super(); - this.node.off('size-changed', this._resized, this); }, _applyAtlas: CC_EDITOR && function (spriteFrame) { @@ -444,6 +447,8 @@ var Sprite = cc.Class({ sgNode.setVisible(false); } + this._validateSizeMode(); + this._applySpriteFrame(null); // should keep the size of the sg node the same as entity, @@ -452,6 +457,7 @@ var Sprite = cc.Class({ this._applySpriteSize(); sgNode.setRenderingType(this._type); + sgNode.enableTrimmedContentSize(this._isTrimmedMode); }, _resized: function () {