From 03671db549c921acf02bbc19b23eb21c0e7e0da3 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Fri, 26 Jan 2018 11:57:47 +0800 Subject: [PATCH 1/6] lock uglify-es for 1.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1998722077..165c85010e 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "multipipe": "0.3.0", "persistify": "^1.1.1", "require-dir": "0.3.0", - "uglify-es": "^3.0.26", + "uglify-es": "~3.2.2", "vinyl": "1.1.0", "vinyl-buffer": "1.0.0", "vinyl-source-stream": "1.0.0", From eb3745c317bc9b1e08d208cf150c813b569b0d5f Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Jan 2018 11:15:14 +0800 Subject: [PATCH 2/6] Reverts dragonBones CCFactory change to avoid assert. --- extensions/dragonbones/ArmatureDisplay.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/dragonbones/ArmatureDisplay.js b/extensions/dragonbones/ArmatureDisplay.js index e1a4b294e6..c8e41e8f6a 100644 --- a/extensions/dragonbones/ArmatureDisplay.js +++ b/extensions/dragonbones/ArmatureDisplay.js @@ -284,7 +284,14 @@ dragonBones.ArmatureDisplay = cc.Class({ // IMPLEMENT ctor: function () { - this._factory = dragonBones.CCFactory.getInstance(); + if (CC_JSB) { + // TODO Fix me + // If using the getFactory in JSB. + // There may be throw errors when close the application. + this._factory = new dragonBones.CCFactory(); + } else { + this._factory = dragonBones.CCFactory.getInstance(); + } }, __preload: function () { From fe867cd95bd1ba096c12cda036305563361cc05a Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 1 Feb 2018 15:28:00 +0800 Subject: [PATCH 3/6] Fix supportsNPOT and ignore contentSize in Texture.initWithData --- cocos2d/core/CCConfiguration.js | 2 +- cocos2d/core/textures/CCTexture2D.js | 6 +++--- cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos2d/core/CCConfiguration.js b/cocos2d/core/CCConfiguration.js index e87b9acdfb..ce9b6d1943 100644 --- a/cocos2d/core/CCConfiguration.js +++ b/cocos2d/core/CCConfiguration.js @@ -244,7 +244,7 @@ cc.configuration = /** @lends cc.configuration# */{ this._supportsPVRTC = this.checkForGLExtension("GL_IMG_texture_compression_pvrtc"); locValueDict["gl.supports_PVRTC"] = this._supportsPVRTC; - this._supportsNPOT = false; //true; + this._supportsNPOT = true; locValueDict["gl.supports_NPOT"] = this._supportsNPOT; this._supportsBGRA8888 = this.checkForGLExtension("GL_IMG_texture_format_BGRA888"); diff --git a/cocos2d/core/textures/CCTexture2D.js b/cocos2d/core/textures/CCTexture2D.js index 1ca8fbb2d5..2d59900681 100644 --- a/cocos2d/core/textures/CCTexture2D.js +++ b/cocos2d/core/textures/CCTexture2D.js @@ -352,7 +352,7 @@ var Texture2D = cc.Class(/** @lends cc.Texture2D# */{ * @param {Number} pixelFormat * @param {Number} pixelsWidth * @param {Number} pixelsHeight - * @param {Size} contentSize + * @param {Size} contentSize contentSize is deprecated and ignored * @return {Boolean} */ initWithData: function (data, pixelFormat, pixelsWidth, pixelsHeight, contentSize) { @@ -860,8 +860,8 @@ game.once(game.EVENT_RENDERER_INITED, function () { opts.width = pixelsWidth; opts.height = pixelsHeight; this.update(opts); - this.width = contentSize.width; - this.height = contentSize.height; + this.width = pixelsWidth; + this.height = pixelsHeight; this.loaded = true; this.emit("load"); return true; diff --git a/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js b/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js index e2768b6a7d..f831cff960 100644 --- a/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js +++ b/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js @@ -172,7 +172,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma if (!node._texture) return false; - locTexture.initWithData(data, node._pixelFormat, powW, powH, cc.size(width, height)); + locTexture.initWithData(data, node._pixelFormat, powW, powH); //free( data ); var oldRBO = gl.getParameter(gl.RENDERBUFFER_BINDING); @@ -181,7 +181,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma this._textureCopy = new cc.Texture2D(); if (!this._textureCopy) return false; - this._textureCopy.initWithData(data, node._pixelFormat, powW, powH, cc.size(width, height)); + this._textureCopy.initWithData(data, node._pixelFormat, powW, powH); } // generate FBO From 5fd4afcb555bd530b4d2a9e094ca0317107a7d35 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 1 Feb 2018 15:39:15 +0800 Subject: [PATCH 4/6] Add deprecation log --- DebugInfos.js | 2 ++ cocos2d/core/CCScheduler.js | 4 ++++ cocos2d/core/textures/CCTexture2D.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/DebugInfos.js b/DebugInfos.js index 162045527b..c5b84415f3 100644 --- a/DebugInfos.js +++ b/DebugInfos.js @@ -64,6 +64,7 @@ if (CC_DEBUG) { "1509": "Argument target must be non-nullptr", //isScheduled "1510": "cc.Scheduler: Illegal target which doesn't have uuid or instanceId", "1511": "cc.Scheduler: pause state of the scheduled task doesn't match the element pause state in Scheduler, the given paused state will be ignored", + "1512": "cc.Scheduler: updateFunc parameter is deprecated in scheduleUpdate function, and will be removed in v2.0", //Node: 1600 "1600": "getZOrder is deprecated. Please use getLocalZOrder instead.", //getZOrder "1601": "setZOrder is deprecated. Please use setLocalZOrder instead.", //setZOrder @@ -239,6 +240,7 @@ if (CC_DEBUG) { "3115": "Frame Grabber: could not attach texture to framebuffer", //CCGrabber.grab "3116": "WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures", //setTexParameters "3117": "Mimpap texture only works in POT textures", //generateMipmap + "3118": "contentSize parameter is deprecated and ignored for cc.Texture2D initWithData function", // initWithData //RectWidth: 3300 "3300": "Rect width exceeds maximum margin: %s", //RectWidth //RectHeight: 3400 diff --git a/cocos2d/core/CCScheduler.js b/cocos2d/core/CCScheduler.js index 9c3ec89076..4cf00041e5 100644 --- a/cocos2d/core/CCScheduler.js +++ b/cocos2d/core/CCScheduler.js @@ -618,6 +618,10 @@ cc.Scheduler = cc._Class.extend({ } } + if (updateFunc) { + cc.warnID(1512); + } + var listElement = ListEntry.get(null, null, updateFunc, target, priority, paused, false); var ppList; diff --git a/cocos2d/core/textures/CCTexture2D.js b/cocos2d/core/textures/CCTexture2D.js index 2d59900681..29499e4624 100644 --- a/cocos2d/core/textures/CCTexture2D.js +++ b/cocos2d/core/textures/CCTexture2D.js @@ -854,6 +854,9 @@ game.once(game.EVENT_RENDERER_INITED, function () { }; _p.initWithData = function (data, pixelFormat, pixelsWidth, pixelsHeight, contentSize) { + if (contentSize) { + cc.warnID(3118); + } var opts = _getSharedOptions(); opts.image = data; opts.format = pixelFormat; From 6810732ec3908918bb27d945718d3ea5e6babe61 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Fri, 2 Feb 2018 13:41:15 +0800 Subject: [PATCH 5/6] fix onShow/onHide on wechat mini game --- cocos2d/core/CCGame.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos2d/core/CCGame.js b/cocos2d/core/CCGame.js index ba43a95b09..ae1f056b91 100644 --- a/cocos2d/core/CCGame.js +++ b/cocos2d/core/CCGame.js @@ -785,12 +785,12 @@ var game = { } if (navigator.userAgent.indexOf("MicroMessenger") > -1) { - win.onfocus = function(){ onShow() }; + win.onfocus = onShow; } if (CC_WECHATGAME) { - wx.onShow = onShow; - wx.onHide = onHidden; + wx.onShow(onShow); + wx.onHide(onHidden); } if ("onpageshow" in window && "onpagehide" in window) { From 09a15147891a1c5bc0ef4a03fc4a95294fb34972 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 2 Feb 2018 18:35:56 +0800 Subject: [PATCH 6/6] Fix WECHAT_GAME check issue --- cocos2d/audio/CCAudio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js index 62b59ed33f..6d7686b718 100644 --- a/cocos2d/audio/CCAudio.js +++ b/cocos2d/audio/CCAudio.js @@ -360,7 +360,7 @@ var WebAudioElement = function (buffer, audio) { var self = this; clearTimeout(this._currextTimer); this._currextTimer = setTimeout(function () { - if (sys.platform === sys.WECHAT_GAME && self._context.currentTime === 0) { + if (sys.platform !== sys.WECHAT_GAME && self._context.currentTime === 0) { touchPlayList.push({ instance: self._audio, offset: offset,