Merge pull request #2293 from 2youyou2/next

fixed some bugs
This commit is contained in:
pandamicro
2018-01-30 10:01:47 +08:00
committed by GitHub
7 changed files with 25 additions and 40 deletions
+3 -3
View File
@@ -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);
+5 -28
View File
@@ -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 () {
+3 -2
View File
@@ -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;
}
}
},
+1 -1
View File
@@ -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) {
+8 -1
View File
@@ -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);
+2 -2
View File
@@ -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 () {
+3 -3
View File
@@ -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;