diff --git a/native/cocos/cocos2d.cpp b/native/cocos/cocos2d.cpp index 5e806e8be7..6ca64f60aa 100644 --- a/native/cocos/cocos2d.cpp +++ b/native/cocos/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN CC_DLL const char* cocos2dVersion() { - return "1.6.2"; + return "1.7.0"; } NS_CC_END diff --git a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js index 285063e074..d1251f8384 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -595,7 +595,10 @@ cc.DrawNode = cc._DrawNode.extend({ cc._DrawNode.prototype.drawDot.call(this, pos, radius, color); }, - drawSegment:function (from, to, lineWidth = this._lineWidth, color = this._drawColor) { + drawSegment:function (from, to, lineWidth, color) { + lineWidth = lineWidth || this._lineWidth; + color = color || this._drawColor; + cc._DrawNode.prototype.drawSegment.call(this, from, to, lineWidth, color); }, @@ -1107,17 +1110,21 @@ cc.defineGetterSetter(cc.BlendFunc, "ALPHA_NON_PREMULTIPLIED", cc.BlendFunc._alp cc.BlendFunc.ADDITIVE; cc.defineGetterSetter(cc.BlendFunc, "ADDITIVE", cc.BlendFunc._additive); -cc.GLProgram.prototype.setUniformLocationWithMatrix2fv = function (...args) { - args = Array.prototype.concat.call(args, 2); - this.setUniformLocationWithMatrixfvUnion.apply(this, args); +cc.GLProgram.prototype.setUniformLocationWithMatrix2fv = function(){ + var tempArray = Array.prototype.slice.call(arguments); + tempArray.push(2); + this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); }; -cc.GLProgram.prototype.setUniformLocationWithMatrix3fv = function (...args) { - args = Array.prototype.concat.call(args, 3); - this.setUniformLocationWithMatrixfvUnion.apply(this, args); + +cc.GLProgram.prototype.setUniformLocationWithMatrix3fv = function(){ + var tempArray = Array.prototype.slice.call(arguments); + tempArray.push(3); + this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); }; -cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function (...args) { - args = Array.prototype.concat.call(args, 4); - this.setUniformLocationWithMatrixfvUnion.apply(this, args); +cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function(){ + var tempArray = Array.prototype.slice.call(arguments); + tempArray.push(4); + this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); }; // diff --git a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js index 02ba2824c9..7250935e39 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js +++ b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js @@ -293,8 +293,8 @@ cc.ActionInterval.prototype._ctor = function(d) { d !== undefined && this.initWithDuration(d); }; -cc.Sequence.prototype._ctor = function(...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.Sequence.prototype._ctor = function(tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); @@ -309,8 +309,8 @@ cc.Sequence.prototype._ctor = function(...args) { this.initWithTwoActions(prev, actions[last]); } }; -cc.sequence = cc.Sequence.create = function (...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.sequence = cc.Sequence.create = function (tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); @@ -343,8 +343,8 @@ cc.repeatForever = cc.RepeatForever.create = function (action) { return new cc.RepeatForever(action); }; -cc.Spawn.prototype._ctor = function (...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.Spawn.prototype._ctor = function (tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); @@ -359,8 +359,8 @@ cc.Spawn.prototype._ctor = function (...args) { this.initWithTwoActions(prev, actions[last]); } }; -cc.spawn = cc.Spawn.create = function (...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.spawn = cc.Spawn.create = function (tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); diff --git a/native/cocos/scripting/js-bindings/script/jsb_opengl.js b/native/cocos/scripting/js-bindings/script/jsb_opengl.js index e0925c169a..63317cb348 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_opengl.js +++ b/native/cocos/scripting/js-bindings/script/jsb_opengl.js @@ -353,11 +353,11 @@ gl.getAttachedShaders = function(program) { // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException -gl.texImage2D = function (...args) { - if (args.length < 9) { - throw "texImage2D: Unsupported number of parameters:" + args.length; - } - gl._texImage2D.apply(gl, args); +gl.texImage2D = function() { + if( arguments.length < 9) + throw "texImage2D: Unsupported number of parameters:" + arguments.length; + + gl._texImage2D.apply(this, arguments); }; // XXX: Currently only the 1st one is supported @@ -366,11 +366,11 @@ gl.texImage2D = function (...args) { // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException -gl.texSubImage2D = function (...args) { - if (args.length < 9) - throw "texImage2D: Unsupported number of parameters"; +gl.texSubImage2D = function() { + if( arguments.length < 9) + throw "texSubImage2D: Unsupported number of parameters:" + arguments.length; - gl._texSubImage2D.apply(gl, args); + gl._texSubImage2D.apply(this, arguments); }; // diff --git a/native/cocos/scripting/js-bindings/script/jsb_prepare.js b/native/cocos/scripting/js-bindings/script/jsb_prepare.js index 1a14e3142b..c902356ff8 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_prepare.js +++ b/native/cocos/scripting/js-bindings/script/jsb_prepare.js @@ -129,7 +129,7 @@ cc.Class.extend = function (prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) { - return function (...args) { + return function () { var tmp = this._super; // Add a new ._super() method that is the same method @@ -138,7 +138,7 @@ cc.Class.extend = function (prop) { // The method only need to be bound temporarily, so we // remove it when we're done executing - var ret = fn.apply(this, args); + var ret = fn.apply(this, arguments); this._super = tmp; return ret; @@ -147,18 +147,18 @@ cc.Class.extend = function (prop) { prop[name]; } - Class = function (...args) { + Class = function () { if (!initializing) { this.__instanceId = ClassManager.getNewInstanceId(); if (this.ctor) { - switch (args.length) { + switch (arguments.length) { case 0: this.ctor(); break; - case 1: this.ctor(args[0]); break; - case 2: this.ctor(args[0], args[1]); break; - case 3: this.ctor(args[0], args[1], args[2]); break; - case 4: this.ctor(args[0], args[1], args[2], args[3]); break; - case 5: this.ctor(args[0], args[1], args[2], args[3], args[4]); break; - default: this.ctor.apply(this, args); + case 1: this.ctor(arguments[0]); break; + case 2: this.ctor(arguments[0], arguments[1]); break; + case 3: this.ctor(arguments[0], arguments[1], arguments[2]); break; + case 4: this.ctor(arguments[0], arguments[1], arguments[2], arguments[3]); break; + case 5: this.ctor(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); break; + default: this.ctor.apply(this, arguments); } } }