mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
Merge branch 'v1.0' of github.com:fireball-x/engine into v1.0
This commit is contained in:
@@ -540,6 +540,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
if (onLaunched) {
|
||||
onLaunched(null, scene);
|
||||
}
|
||||
cc.renderer.clear();
|
||||
this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, scene);
|
||||
},
|
||||
|
||||
|
||||
@@ -742,8 +742,8 @@ _ccsg.EditBox = _ccsg.Node.extend({
|
||||
_updateEditBoxSize: function(size, height) {
|
||||
this._oldSetContentSize(size, height);
|
||||
|
||||
var newWidth = size.width || size;
|
||||
var newHeight = size.height || height;
|
||||
var newWidth = (typeof size.width === 'number') ? size.width : size;
|
||||
var newHeight = (typeof size.height === 'number') ? size.height : height;
|
||||
|
||||
this._updateBackgroundSpriteSize(newWidth, newHeight);
|
||||
this._nativeControl.setSize(newWidth, newHeight);
|
||||
|
||||
@@ -632,8 +632,8 @@ cc.BMFontHelper = {
|
||||
},
|
||||
|
||||
_setDimensions: function(size, height) {
|
||||
var newWidth = size.width || size;
|
||||
var newHeight = size.height || height;
|
||||
var newWidth = (typeof size.width === 'number') ? size.width : size;
|
||||
var newHeight = (typeof size.height === 'number') ? size.height : height;
|
||||
|
||||
_ccsg.Node.prototype.setContentSize.call(this, size, height);
|
||||
|
||||
@@ -1088,7 +1088,6 @@ cc.BMFontHelper = {
|
||||
this._fontHandle = filename;
|
||||
var self = this;
|
||||
if (this._labelType === _ccsg.Label.Type.BMFont) {
|
||||
|
||||
this._resetBMFont();
|
||||
|
||||
var texture;
|
||||
@@ -1113,7 +1112,9 @@ cc.BMFontHelper = {
|
||||
self.emit("load");
|
||||
}, self);
|
||||
} else {
|
||||
self._createSpriteBatchNode(texture);
|
||||
if (!self._spriteBatchNode) {
|
||||
self._createSpriteBatchNode(texture);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,10 +144,14 @@ JS.mixin(cc.loader, {
|
||||
singleRes = true;
|
||||
}
|
||||
// Return directly if no resources
|
||||
if (resources.length === 0 && completeCallback) {
|
||||
callInNextTick(function () {
|
||||
completeCallback.call(self, null, self._items);
|
||||
});
|
||||
if (resources.length === 0) {
|
||||
if (completeCallback) {
|
||||
callInNextTick(function () {
|
||||
completeCallback.call(self, null, self._items);
|
||||
completeCallback = null;
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve callback
|
||||
@@ -181,6 +185,7 @@ JS.mixin(cc.loader, {
|
||||
completeCallback.call(self, error, self._items);
|
||||
}
|
||||
}
|
||||
completeCallback = null;
|
||||
}
|
||||
|
||||
// Add loaded listeners
|
||||
@@ -205,14 +210,17 @@ JS.mixin(cc.loader, {
|
||||
if (totalCount === completedCount) {
|
||||
var id = resources[0].id || resources[0];
|
||||
var result = this._items.map[id];
|
||||
callInNextTick(function () {
|
||||
if (singleRes) {
|
||||
completeCallback.call(self, result.error, result.content);
|
||||
}
|
||||
else {
|
||||
completeCallback.call(self, null, self._items);
|
||||
}
|
||||
});
|
||||
if (completeCallback) {
|
||||
callInNextTick(function () {
|
||||
if (singleRes) {
|
||||
completeCallback.call(self, result.error, result.content);
|
||||
}
|
||||
else {
|
||||
completeCallback.call(self, null, self._items);
|
||||
}
|
||||
completeCallback = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.flowIn(resources);
|
||||
|
||||
@@ -941,12 +941,10 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
* @method cleanup
|
||||
*/
|
||||
cleanup: function () {
|
||||
//// actions
|
||||
//this.stopAllActions();
|
||||
//this.unscheduleAllCallbacks();
|
||||
//
|
||||
//// event
|
||||
//cc.eventManager.removeListeners(this);
|
||||
// actions
|
||||
cc.director.getActionManager().removeAllActionsFromTarget(this);
|
||||
// event
|
||||
cc.eventManager.removeListeners(this);
|
||||
|
||||
// children
|
||||
var i, len = this._children.length, node;
|
||||
|
||||
+19
-5
@@ -47,6 +47,17 @@ if (!jsbLabel.prototype.getOverflow) {
|
||||
jsbLabel.prototype.getOverflow = function(){};
|
||||
}
|
||||
|
||||
//fix jsb system font overflow
|
||||
jsbLabel.prototype._setOverflow = jsbLabel.prototype.setOverflow;
|
||||
jsbLabel.prototype.setOverflow = function(overflow) {
|
||||
this._overFlow = overflow;
|
||||
this._setOverflow(this._overFlow);
|
||||
};
|
||||
|
||||
jsbLabel.prototype.getOverflow = function() {
|
||||
return this._overFlow;
|
||||
};
|
||||
|
||||
if (!jsbLabel.prototype.isSystemFontUsed) {
|
||||
jsbLabel.prototype.isSystemFontUsed = function() {
|
||||
return this._isSystemFontUsed;
|
||||
@@ -93,17 +104,20 @@ jsbLabel.prototype.setTTFConfig = function (config) {
|
||||
this._setTTFConfig(config);
|
||||
this._ttfConfig = config;
|
||||
};
|
||||
|
||||
jsbLabel.prototype.getTTFConfig = function () {
|
||||
return this._ttfConfig;
|
||||
};
|
||||
|
||||
jsbLabel.prototype.setContentSize = function (size, height) {
|
||||
if(height !== undefined){
|
||||
this.setDimensions(size, height);
|
||||
}
|
||||
else{
|
||||
this.setDimensions(size.width, size.height);
|
||||
var newWidth = (typeof size.width === 'number') ? size.width : size;
|
||||
var newHeight = (typeof size.height === 'number') ? size.height : height;
|
||||
|
||||
if(this.getOverflow() === cc.Label.Overflow.NONE) {
|
||||
newWidth = 0;
|
||||
newHeight = 0;
|
||||
}
|
||||
this.setDimensions(newWidth, newHeight);
|
||||
};
|
||||
|
||||
jsbLabel.prototype.setFontFileOrFamily = function (fontHandle) {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ function downloadText (item, callback) {
|
||||
url = cc.Pipeline.UrlResolver.getRawUrl(url);
|
||||
|
||||
var result = jsb.fileUtils.getStringFromFile(url);
|
||||
if (typeof result === 'string') {
|
||||
if (result && typeof result === 'string') {
|
||||
callback(null, result);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user