diff --git a/cocos2d/core/collider/CCCollisionManager.js b/cocos2d/core/collider/CCCollisionManager.js index 8c26140cdf..4e89d60bad 100644 --- a/cocos2d/core/collider/CCCollisionManager.js +++ b/cocos2d/core/collider/CCCollisionManager.js @@ -251,8 +251,8 @@ let CollisionManager = cc.Class({ world.radius = d; - aabb.x = _vec2.x - d; - aabb.y = _vec2.y - d; + aabb.x = world.position.x - d; + aabb.y = world.position.y - d; aabb.width = d * 2; aabb.height = d * 2; @@ -375,10 +375,10 @@ let CollisionManager = cc.Class({ for (let i = 0, l = colliders.length; i < l; i++) { let collider = colliders[i]; + debugDrawer.strokeColor = cc.Color.WHITE; if (collider instanceof cc.BoxCollider || collider instanceof cc.PolygonCollider) { let ps = collider.world.points; if (ps.length > 0) { - debugDrawer.strokeColor = cc.Color.WHITE; debugDrawer.moveTo(ps[0].x, ps[0].y); for (let j = 1; j < ps.length; j++) { debugDrawer.lineTo(ps[j].x, ps[j].y); diff --git a/cocos2d/core/components/CCCanvas.js b/cocos2d/core/components/CCCanvas.js index f0de3a7db9..f2968b2760 100644 --- a/cocos2d/core/components/CCCanvas.js +++ b/cocos2d/core/components/CCCanvas.js @@ -24,25 +24,6 @@ ****************************************************************************/ var eventManager = require('../event-manager'); -var designResolutionWrapper = { - getContentSize: function () { - // The canvas size will always the same with the screen, - // so its anchor should be (0.5, 0.5), otherwise its children will appear biased. - return CC_EDITOR ? cc.engine.getDesignResolutionSize() : cc.visibleRect; - }, - setContentSize: function (size) { - // NYI - }, - - _getWidth: function () { - return this.getContentSize().width; - }, - - _getHeight: function () { - return this.getContentSize().height; - }, -}; - /** * !#zh: 作为 UI 根节点,为所有子节点提供视窗四边的位置信息以供对齐,另外提供屏幕适配策略接口,方便从编辑器设置。 * 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。 @@ -184,10 +165,6 @@ var Canvas = cc.Class({ }, onDestroy: function () { - if (this.node._sizeProvider === designResolutionWrapper) { - this.node._sizeProvider = null; - } - cc.director.off(cc.Director.EVENT_BEFORE_VISIT, this.alignWithScreen, this); if (CC_EDITOR) { @@ -213,13 +190,13 @@ var Canvas = cc.Class({ // alignWithScreen: function () { - var designSize; + var designSize, nodeSize; if (CC_EDITOR) { - designSize = cc.engine.getDesignResolutionSize(); + nodeSize = designSize = cc.engine.getDesignResolutionSize(); this.node.setPosition(designSize.width * 0.5, designSize.height * 0.5); } else { - var canvasSize = cc.visibleRect; + var canvasSize = nodeSize = cc.visibleRect; designSize = cc.view.getDesignResolutionSize(); var clipTopRight = !this.fitHeight && !this.fitWidth; var offsetX = 0; @@ -231,8 +208,8 @@ var Canvas = cc.Class({ } this.node.setPosition(canvasSize.width * 0.5 + offsetX, canvasSize.height * 0.5 + offsetY); } - this.node.width = designSize.width; - this.node.height = designSize.height; + this.node.width = nodeSize.width; + this.node.height = nodeSize.height; }, onResized: function () { diff --git a/cocos2d/core/graphics/graphics.js b/cocos2d/core/graphics/graphics.js index c0e21c63f7..66fc58faab 100644 --- a/cocos2d/core/graphics/graphics.js +++ b/cocos2d/core/graphics/graphics.js @@ -436,8 +436,9 @@ let Graphics = cc.Class({ } else { for (let i = 0, l = datas.length; i < l; i++) { - datas[i].dataLength = 0; - datas[i]._indices.length = 0; + let data = datas[i]; + data.vertexCount = data.indiceCount = data.dataLength = 0; + data._indices.length = 0; } } }, diff --git a/cocos2d/tilemap/CCTiledLayer.js b/cocos2d/tilemap/CCTiledLayer.js index 5a617145c4..46e4dedab0 100644 --- a/cocos2d/tilemap/CCTiledLayer.js +++ b/cocos2d/tilemap/CCTiledLayer.js @@ -495,7 +495,7 @@ let TiledLayer = cc.Class({ this._texGrids.length = 0; for (let i = 0, l = tilesets.length; i < l; ++i) { let tilesetInfo = tilesets[i]; - let tex = cc.textureUtil.loadImage(tilesetInfo.sourceImage); + let tex = tilesetInfo.sourceImage; this._textures[i] = tex; this._fillTextureGrids(tilesetInfo, i); if (tileset === tilesetInfo) { diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js index 8a81ed5880..6ae1f6ce2a 100644 --- a/cocos2d/tilemap/CCTiledMap.js +++ b/cocos2d/tilemap/CCTiledMap.js @@ -444,7 +444,14 @@ let TiledMap = cc.Class({ resPath = resPath.replace(/\\/g, '/'); } - let mapInfo = new cc.TMXMapInfo(file.tmxXmlStr, resPath); + let texValues = file.textures; + let texKeys = file.textureNames; + let textures = {}; + for (let i = 0; i < texValues.length; ++i) { + textures[texKeys[i]] = texValues[i]; + } + + let mapInfo = new cc.TMXMapInfo(file.tmxXmlStr, resPath, textures); let tilesets = mapInfo.getTilesets(); if(!tilesets || tilesets.length === 0) cc.logID(7213); diff --git a/extensions/dragonbones/ArmatureDisplay.js b/extensions/dragonbones/ArmatureDisplay.js index 8221e72b2e..f9057bd35b 100644 --- a/extensions/dragonbones/ArmatureDisplay.js +++ b/extensions/dragonbones/ArmatureDisplay.js @@ -312,12 +312,12 @@ let ArmatureDisplay = cc.Class({ onEnable () { this._super(); - dragonBones.CCFactory.getFactory()._dragoneBones.clock.add(this._armature); + dragonBones.CCFactory.getFactory()._dragonBones.clock.add(this._armature); }, onDisable () { this._super(); - dragonBones.CCFactory.getFactory()._dragoneBones.clock.remove(this._armature); + dragonBones.CCFactory.getFactory()._dragonBones.clock.remove(this._armature); }, onDestroy () { diff --git a/extensions/dragonbones/CCFactory.js b/extensions/dragonbones/CCFactory.js index 26024e3466..0c50255f81 100644 --- a/extensions/dragonbones/CCFactory.js +++ b/extensions/dragonbones/CCFactory.js @@ -40,7 +40,7 @@ var CCFactory = dragonBones.CCFactory = cc.Class({ ctor () { this.__instanceId = cc.ClassManager.getNewInstanceId(); - this._dragoneBones = new dragonBones.DragonBones(); + this._dragonBones = new dragonBones.DragonBones(); if (!CC_EDITOR) { cc.director._scheduler.scheduleUpdate(this, cc.Scheduler.PRIORITY_SYSTEM, false); @@ -48,7 +48,7 @@ var CCFactory = dragonBones.CCFactory = cc.Class({ }, update (dt) { - this._dragoneBones.advanceTime(dt); + this._dragonBones.advanceTime(dt); }, buildArmatureDisplay (armatureName, dragonBonesName, comp) { @@ -141,7 +141,7 @@ var CCFactory = dragonBones.CCFactory = cc.Class({ // armature._sortSlots = this._sortSlots; armature.init(dataPackage.armature, - this._display, this._display, this._dragoneBones + this._display, this._display, this._dragonBones ); return armature;