Skip to content

Commit f863933

Browse files
committed
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-html5 into Iss2698_namespace
2 parents 3b64594 + 5a40dca commit f863933

File tree

173 files changed

+1884
-1396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1884
-1396
lines changed

CCBoot.js

+58-58
Large diffs are not rendered by default.

CCDebugger.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ cc._formatString = function (arg) {
282282
*/
283283
cc._initDebugSetting = function (mode) {
284284
var ccGame = cc.game;
285-
if(mode == ccGame.DEBUG_MODE_NONE)
285+
if(mode === ccGame.DEBUG_MODE_NONE)
286286
return;
287287

288288
var locLog;
@@ -299,12 +299,12 @@ cc._initDebugSetting = function (mode) {
299299
locLog("Assert: " + msg);
300300
}
301301
};
302-
if(mode != ccGame.DEBUG_MODE_ERROR_FOR_WEB_PAGE){
302+
if(mode !== ccGame.DEBUG_MODE_ERROR_FOR_WEB_PAGE){
303303
cc.warn = function(){
304304
locLog("WARN : " + cc.formatStr.apply(cc, arguments));
305305
};
306306
}
307-
if(mode == ccGame.DEBUG_MODE_INFO_FOR_WEB_PAGE){
307+
if(mode === ccGame.DEBUG_MODE_INFO_FOR_WEB_PAGE){
308308
cc.log = function(){
309309
locLog(cc.formatStr.apply(cc, arguments));
310310
};
@@ -322,11 +322,11 @@ cc._initDebugSetting = function (mode) {
322322
throw msg;
323323
}
324324
};
325-
if(mode != ccGame.DEBUG_MODE_ERROR)
325+
if(mode !== ccGame.DEBUG_MODE_ERROR)
326326
cc.warn = function(){
327327
return console.warn.apply(console, arguments);
328328
};
329-
if(mode == ccGame.DEBUG_MODE_INFO)
329+
if(mode === ccGame.DEBUG_MODE_INFO)
330330
cc.log = function(){
331331
return console.log.apply(console, arguments);
332332
};

README.mdown

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ Documentation
1616
* Website: [www.cocos2d-x.org][3]
1717
* API References: [http://www.cocos2d-x.org/wiki/Reference] [4]
1818

19-
Running the tests
19+
20+
Installing from [bower][8] (version >=3.4)
21+
------------------
22+
23+
```shell
24+
$ bower install cocos2d-html5
25+
```
26+
27+
Running the tests (version <3)
2028
------------------
2129

2230
```shell
@@ -41,3 +49,4 @@ Contact us
4149
[5]: http://forum.cocos2d-x.org "http://forum.cocos2d-x.org"
4250
[6]: http://www.twitter.com/cocos2dhtml5 "http://www.twitter.com/cocos2dhtml5"
4351
[7]: http://t.sina.com.cn/cocos2dhtml5 "http://t.sina.com.cn/cocos2dhtml5"
52+
[8]: http://bower.io "http://bower.io"

bower.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "cocos2d-html5",
3+
"version": "3.4",
4+
"homepage": "http://www.cocos2d-x.org",
5+
"authors": [
6+
"AUTHORS.txt"
7+
],
8+
"description": "Cocos2d-html5 is a cross-platform 2D game engine written in Javascript, based on Cocos2d-X and licensed under MIT. It incorporates the same high level api as “Cocos2d JS-binding engine” and compatible with Cocos2d-X. It currently supports canvas and WebGL renderering.",
9+
"main": "README.mdown",
10+
"keywords": [
11+
"cocos2d-x",
12+
"cocos2d",
13+
"game",
14+
"engine",
15+
"opengl",
16+
"cross",
17+
"multi",
18+
"platform",
19+
"iphone",
20+
"ipad",
21+
"android",
22+
"windows",
23+
"metro",
24+
"bada",
25+
"marmalade",
26+
"playbook"
27+
],
28+
"license": "MIT",
29+
"private": false,
30+
"ignore": [
31+
"**/.*",
32+
"node_modules",
33+
"bower_components",
34+
"test",
35+
"tests"
36+
]
37+
}

cocos2d/actions/CCAction.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{
422422
* @param {cc.ActionInterval} action
423423
*/
424424
setInnerAction:function (action) {
425-
if (this._innerAction != action) {
425+
if (this._innerAction !== action) {
426426
this._innerAction = action;
427427
}
428428
},
@@ -607,7 +607,7 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{
607607
_this.topBoundary = _this.bottomBoundary = (_this.topBoundary + _this.bottomBoundary) / 2;
608608
}
609609

610-
if ((_this.topBoundary == _this.bottomBoundary) && (_this.leftBoundary == _this.rightBoundary))
610+
if ((_this.topBoundary === _this.bottomBoundary) && (_this.leftBoundary === _this.rightBoundary))
611611
_this._boundaryFullyCovered = true;
612612
}
613613
return true;

cocos2d/actions/CCActionCatmullRom.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# *
174174
* @return {Boolean}
175175
*/
176176
initWithDuration:function (duration, points, tension) {
177-
if(!points || points.length == 0)
177+
if(!points || points.length === 0)
178178
throw "Invalid configuration. It must at least have one control point";
179179

180180
if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
@@ -222,7 +222,7 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# *
222222
// p..p..p..p..p..p..p
223223
// 1..2..3..4..5..6..7
224224
// want p to be 1, 2, 3, 4, 5, 6
225-
if (dt == 1) {
225+
if (dt === 1) {
226226
p = ps.length - 1;
227227
lt = 1;
228228
} else {
@@ -242,7 +242,7 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# *
242242
var tempX, tempY;
243243
tempX = this.target.getPositionX() - this._previousPosition.x;
244244
tempY = this.target.getPositionY() - this._previousPosition.y;
245-
if (tempX != 0 || tempY != 0) {
245+
if (tempX !== 0 || tempY !== 0) {
246246
var locAccDiff = this._accumulatedDiff;
247247
tempX = locAccDiff.x + tempX;
248248
tempY = locAccDiff.y + tempY;

cocos2d/actions/CCActionEase.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# *
651651
* @param {Number} dt
652652
*/
653653
update:function (dt) {
654-
this._inner.update(dt == 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1));
654+
this._inner.update(dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1));
655655
},
656656

657657
/**
@@ -696,7 +696,7 @@ cc.EaseExponentialOut.create = function (action) {
696696

697697
cc._easeExponentialOutObj = {
698698
easing: function(dt){
699-
return dt == 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1);
699+
return dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1);
700700
},
701701
reverse: function(){
702702
return cc._easeExponentialInObj;
@@ -740,7 +740,7 @@ cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOu
740740
* @param {Number} dt
741741
*/
742742
update:function (dt) {
743-
if( dt != 1 && dt !== 0) {
743+
if( dt !== 1 && dt !== 0) {
744744
dt *= 2;
745745
if (dt < 1)
746746
dt = 0.5 * Math.pow(2, 10 * (dt - 1));
@@ -976,7 +976,7 @@ cc.EaseSineOut.create = function (action) {
976976

977977
cc._easeSineOutObj = {
978978
easing: function(dt){
979-
return (dt===0 || dt==1) ? dt : Math.sin(dt * Math.PI / 2);
979+
return (dt===0 || dt===1) ? dt : Math.sin(dt * Math.PI / 2);
980980
},
981981
reverse: function(){
982982
return cc._easeSineInObj;
@@ -1313,7 +1313,7 @@ cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{
13131313
*/
13141314
update:function (dt) {
13151315
var newT = 0;
1316-
if (dt === 0 || dt == 1) {
1316+
if (dt === 0 || dt === 1) {
13171317
newT = dt;
13181318
} else {
13191319
var s = this._period / 4;
@@ -1423,7 +1423,7 @@ cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
14231423
update:function (dt) {
14241424
var newT = 0;
14251425
var locPeriod = this._period;
1426-
if (dt === 0 || dt == 1) {
1426+
if (dt === 0 || dt === 1) {
14271427
newT = dt;
14281428
} else {
14291429
dt = dt * 2;
@@ -1891,7 +1891,7 @@ cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{
18911891
*/
18921892
update:function (dt) {
18931893
var overshoot = 1.70158;
1894-
dt = dt===0 || dt==1 ? dt : dt * dt * ((overshoot + 1) * dt - overshoot);
1894+
dt = dt===0 || dt===1 ? dt : dt * dt * ((overshoot + 1) * dt - overshoot);
18951895
this._inner.update(dt);
18961896
},
18971897

cocos2d/actions/CCActionInstant.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{
701701
* @param {object} sel
702702
*/
703703
setTargetCallback:function (sel) {
704-
if (sel != this._selectorTarget) {
704+
if (sel !== this._selectorTarget) {
705705
if (this._selectorTarget)
706706
this._selectorTarget = null;
707707
this._selectorTarget = sel;

cocos2d/actions/CCActionInterval.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{
669669
* @return {Boolean}
670670
*/
671671
isDone:function () {
672-
return this._total == this._times;
672+
return this._total === this._times;
673673
},
674674

675675
/**
@@ -688,7 +688,7 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{
688688
* @param {cc.FiniteTimeAction} action
689689
*/
690690
setInnerAction:function (action) {
691-
if (this._innerAction != action) {
691+
if (this._innerAction !== action) {
692692
this._innerAction = action;
693693
}
694694
},
@@ -826,7 +826,7 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{
826826
* @param {cc.ActionInterval} action
827827
*/
828828
setInnerAction:function (action) {
829-
if (this._innerAction != action) {
829+
if (this._innerAction !== action) {
830830
this._innerAction = action;
831831
}
832832
},
@@ -3166,7 +3166,7 @@ cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{
31663166
initWithAction:function (action) {
31673167
if(!action)
31683168
throw "cc.ReverseTime.initWithAction(): action must be non null";
3169-
if(action == this._other)
3169+
if(action === this._other)
31703170
throw "cc.ReverseTime.initWithAction(): the action was already passed in.";
31713171

31723172
if (cc.ActionInterval.prototype.initWithDuration.call(this, action._duration)) {
@@ -3527,7 +3527,7 @@ cc.TargetedAction = cc.ActionInterval.extend(/** @lends cc.TargetedAction# */{
35273527
* @param {cc.Node} forcedTarget
35283528
*/
35293529
setForcedTarget:function (forcedTarget) {
3530-
if (this._forcedTarget != forcedTarget)
3530+
if (this._forcedTarget !== forcedTarget)
35313531
this._forcedTarget = forcedTarget;
35323532
}
35333533
});

cocos2d/actions3d/CCActionGrid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ cc.GridAction = cc.ActionInterval.extend(/** @lends cc.GridAction# */{
7373
var targetGrid = t.grid;
7474
if (targetGrid && targetGrid.getReuseGrid() > 0) {
7575
var locGridSize = targetGrid.getGridSize();
76-
if (targetGrid.isActive() && (locGridSize.width == this._gridSize.width) && (locGridSize.height == this._gridSize.height))
76+
if (targetGrid.isActive() && (locGridSize.width === this._gridSize.width) && (locGridSize.height === this._gridSize.height))
7777
targetGrid.reuse();
7878
} else {
7979
if (targetGrid && targetGrid.isActive())

cocos2d/actions3d/CCActionGrid3D.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ cc.FlipX3D = cc.Grid3DAction.extend(/** @lends cc.FlipX3D# */{
184184
* @return {Boolean}
185185
*/
186186
initWithSize:function (gridSize, duration) {
187-
if (gridSize.width != 1 || gridSize.height != 1) {
187+
if (gridSize.width !== 1 || gridSize.height !== 1) {
188188
// Grid size must be (1,1)
189189
cc.log("Grid size must be (1,1)");
190190
return false;
@@ -516,7 +516,7 @@ cc.Lens3D = cc.Grid3DAction.extend(/** @lends cc.Lens3D# */{
516516
if (r < locRadius) {
517517
r = locRadius - r;
518518
pre_log = r / locRadius;
519-
if (pre_log == 0)
519+
if (pre_log === 0)
520520
pre_log = 0.001;
521521

522522
l = Math.log(pre_log) * locLensEffect;

cocos2d/actions3d/CCActionTiledGrid.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ cc.FadeOutTRTiles = cc.TiledGrid3DAction.extend(/** @lends cc.FadeOutTRTiles# */
457457
testFunc:function (pos, time) {
458458
var locX = this._gridSize.width * time;
459459
var locY = this._gridSize.height * time;
460-
if ((locX + locY) == 0.0)
460+
if ((locX + locY) === 0.0)
461461
return 1.0;
462462
return Math.pow((pos.width + pos.height) / (locX + locY), 6);
463463
},
@@ -516,7 +516,7 @@ cc.FadeOutTRTiles = cc.TiledGrid3DAction.extend(/** @lends cc.FadeOutTRTiles# */
516516
locSize.width = i;
517517
locSize.height = j;
518518
distance = this.testFunc(locSize, dt);
519-
if (distance == 0)
519+
if (distance === 0)
520520
this.turnOffTile(locPos);
521521
else if (distance < 1)
522522
this.transformTile(locPos, distance);
@@ -566,7 +566,7 @@ cc.FadeOutBLTiles = cc.FadeOutTRTiles.extend(/** @lends cc.FadeOutBLTiles# */{
566566
testFunc:function (pos, time) {
567567
var locX = this._gridSize.width * (1.0 - time);
568568
var locY = this._gridSize.height * (1.0 - time);
569-
if ((pos.width + pos.height) == 0)
569+
if ((pos.width + pos.height) === 0)
570570
return 1.0;
571571

572572
return Math.pow((locX + locY) / (pos.width + pos.height), 6);
@@ -606,7 +606,7 @@ cc.FadeOutBLTiles.create = cc.fadeOutBLTiles;
606606
cc.FadeOutUpTiles = cc.FadeOutTRTiles.extend(/** @lends cc.FadeOutUpTiles# */{
607607
testFunc:function (pos, time) {
608608
var locY = this._gridSize.height * time;
609-
if (locY == 0.0)
609+
if (locY === 0.0)
610610
return 1.0;
611611
return Math.pow(pos.height / locY, 6);
612612
},
@@ -657,7 +657,7 @@ cc.FadeOutUpTiles.create = cc.fadeOutUpTiles;
657657
cc.FadeOutDownTiles = cc.FadeOutUpTiles.extend(/** @lends cc.FadeOutDownTiles# */{
658658
testFunc:function (pos, time) {
659659
var locY = this._gridSize.height * (1.0 - time);
660-
if (pos.height == 0)
660+
if (pos.height === 0)
661661
return 1.0;
662662
return Math.pow(locY / pos.height, 6);
663663
}
@@ -1057,7 +1057,7 @@ cc.JumpTiles3D = cc.TiledGrid3DAction.extend(/** @lends cc.JumpTiles3D# */{
10571057
//var coords = this.originalTile(cc.p(i, j));
10581058
coords = locGrid.originalTile(locPos);
10591059

1060-
if (((i + j) % 2) == 0) {
1060+
if (((i + j) % 2) === 0) {
10611061
coords.bl.z += sinz;
10621062
coords.br.z += sinz;
10631063
coords.tl.z += sinz;
@@ -1150,7 +1150,7 @@ cc.SplitRows = cc.TiledGrid3DAction.extend(/** @lends cc.SplitRows# */{
11501150
coords = this.originalTile(locPos);
11511151
direction = 1;
11521152

1153-
if ((j % 2 ) == 0)
1153+
if ((j % 2 ) === 0)
11541154
direction = -1;
11551155

11561156
coords.bl.x += direction * locWinSizeWidth * dt;
@@ -1241,7 +1241,7 @@ cc.SplitCols = cc.TiledGrid3DAction.extend(/** @lends cc.SplitCols# */{
12411241
coords = this.originalTile(locPos);
12421242
direction = 1;
12431243

1244-
if ((i % 2 ) == 0)
1244+
if ((i % 2 ) === 0)
12451245
direction = -1;
12461246

12471247
coords.bl.y += direction * locWinSizeHeight * dt;

0 commit comments

Comments
 (0)