mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
+17
-10
@@ -90,8 +90,7 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
_projectionDelegate: null,
|
||||
|
||||
_loadingScene: '',
|
||||
// The root of rendering scene graph
|
||||
_runningScene: null,
|
||||
_runningScene: null, // The root of rendering scene graph
|
||||
|
||||
// The entity-component scene
|
||||
_scene: null,
|
||||
@@ -473,6 +472,16 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
runScene: function (scene, onBeforeLoadScene) {
|
||||
cc.assert(scene, cc._LogInfos.Director.pushScene);
|
||||
|
||||
// detach persist nodes
|
||||
var i, node, game = cc.game;
|
||||
var persistNodes = game._persistRootNodes;
|
||||
for (i = persistNodes.length - 1; i >= 0; --i) {
|
||||
node = persistNodes[i];
|
||||
game._ignoreRemovePersistNode = node;
|
||||
node.parent = null;
|
||||
game._ignoreRemovePersistNode = null;
|
||||
}
|
||||
|
||||
// unload scene
|
||||
var oldScene = this._scene;
|
||||
if (cc.isValid(oldScene)) {
|
||||
@@ -488,14 +497,6 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
}
|
||||
this.emit(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, scene);
|
||||
|
||||
// Re-add persist node root
|
||||
var persistNodes = cc.game._persistRootNodes;
|
||||
for (var i = 0; i < persistNodes.length; ++i) {
|
||||
var node = persistNodes[i];
|
||||
node._parent = null;
|
||||
node.parent = scene;
|
||||
}
|
||||
|
||||
var sgScene = scene;
|
||||
|
||||
// Run an Entity Scene
|
||||
@@ -505,6 +506,12 @@ cc.Director = Class.extend(/** @lends cc.Director# */{
|
||||
|
||||
this._scene = scene;
|
||||
sgScene = scene._sgNode;
|
||||
|
||||
// Re-attach persist nodes
|
||||
for (i = 0; i < persistNodes.length; ++i) {
|
||||
node = persistNodes[i];
|
||||
node.parent = scene;
|
||||
}
|
||||
}
|
||||
|
||||
// Run or replace rendering scene
|
||||
|
||||
+13
-6
@@ -19,6 +19,7 @@ var game = /** @lends cc.game# */{
|
||||
_eventShow: null,
|
||||
|
||||
_persistRootNodes: [],
|
||||
_ignoreRemovePersistNode: null,
|
||||
|
||||
/**
|
||||
* Key of config
|
||||
@@ -282,7 +283,7 @@ var game = /** @lends cc.game# */{
|
||||
* @param {Node} node - The node to be made persistent
|
||||
*/
|
||||
addPersistRootNode: function (node) {
|
||||
if (!node instanceof cc.Node)
|
||||
if (!(node instanceof cc.Node))
|
||||
return;
|
||||
var index = this._persistRootNodes.indexOf(node);
|
||||
if (index === -1) {
|
||||
@@ -291,10 +292,14 @@ var game = /** @lends cc.game# */{
|
||||
if (!node.parent) {
|
||||
node.parent = scene;
|
||||
}
|
||||
else if (node.parent !== scene) {
|
||||
else if ( !(node.parent instanceof cc.Scene) ) {
|
||||
cc.warn('The node can not be made persist because it\'s not under root node.');
|
||||
return;
|
||||
}
|
||||
else if (node.parent !== scene) {
|
||||
cc.warn('The node can not be made persist because it\'s not in current scene.');
|
||||
return;
|
||||
}
|
||||
this._persistRootNodes.push(node);
|
||||
node._persistNode = true;
|
||||
}
|
||||
@@ -307,11 +312,13 @@ var game = /** @lends cc.game# */{
|
||||
* @param {Node} node - The node to be removed from persistent node list
|
||||
*/
|
||||
removePersistRootNode: function (node) {
|
||||
var index = this._persistRootNodes.indexOf(node);
|
||||
if (index !== -1) {
|
||||
this._persistRootNodes.splice(index, 1);
|
||||
if (node !== this._ignoreRemovePersistNode) {
|
||||
var index = this._persistRootNodes.indexOf(node);
|
||||
if (index !== -1) {
|
||||
this._persistRootNodes.splice(index, 1);
|
||||
}
|
||||
node._persistNode = false;
|
||||
}
|
||||
node._persistNode = false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,8 +50,6 @@ cc.Scene = cc.Class({
|
||||
var children = this._children;
|
||||
var DontDestroy = cc.Object.Flags.DontDestroy;
|
||||
|
||||
this._sgNode.release();
|
||||
|
||||
for (var i = 0, len = children.length; i < len; ++i) {
|
||||
var child = children[i];
|
||||
if (child.isValid) {
|
||||
|
||||
@@ -200,6 +200,22 @@ var Component = cc.Class({
|
||||
visible: false
|
||||
},
|
||||
|
||||
name: {
|
||||
get: function () {
|
||||
return this._name || this.node.name;
|
||||
//var className = cc.js.getClassName(this);
|
||||
//var index = className.lastIndexOf('.');
|
||||
//if (index >= 0) {
|
||||
// // strip prefix
|
||||
// className = className.slice(index + 1);
|
||||
//}
|
||||
//return this.node.name + '<' + className + '>';
|
||||
},
|
||||
set: function (value) {
|
||||
this._name = value;
|
||||
}
|
||||
},
|
||||
|
||||
_id: {
|
||||
default: '',
|
||||
serializable: false
|
||||
@@ -594,12 +610,11 @@ var Component = cc.Class({
|
||||
cc.assert(callback, cc._LogInfos.Node.schedule);
|
||||
cc.assert(interval >= 0, cc._LogInfos.Node.schedule_2);
|
||||
|
||||
var key = this.__instanceId;
|
||||
interval = interval || 0;
|
||||
repeat = isNaN(repeat) ? cc.REPEAT_FOREVER : repeat;
|
||||
delay = delay || 0;
|
||||
|
||||
cc.director.getScheduler().schedule(callback, this, interval, repeat, delay, !this.enabledInHierarchy, key);
|
||||
cc.director.getScheduler().scheduleCallbackForTarget(this, callback, interval, repeat, delay, !this.enabledInHierarchy);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -162,7 +162,7 @@ cc.radiansToDegress = function (angle) {
|
||||
* @constant
|
||||
* @type Number
|
||||
*/
|
||||
cc.REPEAT_FOREVER = Number.MAX_VALUE - 1;
|
||||
cc.REPEAT_FOREVER = cc.sys.isNative ? 0xffffffff : (Number.MAX_VALUE - 1);
|
||||
|
||||
/**
|
||||
* Helpful macro that setups the GL server state, the correct GL program and sets the Model View Projection matrix
|
||||
|
||||
@@ -122,8 +122,8 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
return;
|
||||
}
|
||||
var node = this._sgNode;
|
||||
if (node._parent) {
|
||||
node._parent.removeChild(node, false);
|
||||
if (node.parent) {
|
||||
node.parent.removeChild(node, false);
|
||||
}
|
||||
if (value) {
|
||||
var parent = value._sgNode;
|
||||
@@ -171,7 +171,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
*/
|
||||
uuid: {
|
||||
get: function () {
|
||||
return this._id || (this._id = Editor.uuid());
|
||||
return this._id || (this._id = window.Editor ? Editor.uuid() : '');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -402,7 +402,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
},
|
||||
set: function (value) {
|
||||
if (this._anchorPoint.x !== value) {
|
||||
var old = this._anchorPoint.clone();
|
||||
var old = cc.v2(this._anchorPoint);
|
||||
this._anchorPoint.x = value;
|
||||
this._onAnchorChanged();
|
||||
this.emit(ANCHOR_CHANGED, old);
|
||||
@@ -421,7 +421,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
},
|
||||
set: function (value) {
|
||||
if (this._anchorPoint.y !== value) {
|
||||
var old = this._anchorPoint.clone();
|
||||
var old = cc.v2(this._anchorPoint);
|
||||
this._anchorPoint.y = value;
|
||||
this._onAnchorChanged();
|
||||
this.emit(ANCHOR_CHANGED, old);
|
||||
@@ -450,7 +450,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
if (this._sizeProvider) {
|
||||
this._sizeProvider.setContentSize(value, this._sizeProvider._getHeight());
|
||||
}
|
||||
var clone = this._contentSize.clone();
|
||||
var clone = cc.v2(this._contentSize);
|
||||
this._contentSize.width = value;
|
||||
this.emit(SIZE_CHANGED, clone);
|
||||
}
|
||||
@@ -478,7 +478,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
if (this._sizeProvider) {
|
||||
this._sizeProvider.setContentSize(this._sizeProvider._getWidth(), value);
|
||||
}
|
||||
var clone = this._contentSize.clone();
|
||||
var clone = cc.v2(this._contentSize);
|
||||
this._contentSize.height = value;
|
||||
this.emit(SIZE_CHANGED, clone);
|
||||
}
|
||||
@@ -575,7 +575,7 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
set: function (value) {
|
||||
if ( !this._color.equals(value) ) {
|
||||
var color = this._color;
|
||||
var old = color.clone();
|
||||
var old = cc.color(color);
|
||||
color.r = value.r;
|
||||
color.g = value.g;
|
||||
color.b = value.b;
|
||||
@@ -752,17 +752,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
if (yValue === undefined) {
|
||||
if(locPosition.x === newPosOrxValue.x && locPosition.y === newPosOrxValue.y)
|
||||
return;
|
||||
oldPosition = locPosition.clone();
|
||||
oldPosition = cc.v2(locPosition);
|
||||
locPosition.x = newPosOrxValue.x;
|
||||
locPosition.y = newPosOrxValue.y;
|
||||
} else {
|
||||
if(locPosition.x === newPosOrxValue && locPosition.y === yValue)
|
||||
return;
|
||||
oldPosition = locPosition.clone();
|
||||
oldPosition = cc.v2(locPosition);
|
||||
locPosition.x = newPosOrxValue;
|
||||
locPosition.y = yValue;
|
||||
}
|
||||
this._sgNode.setPosition(newPosOrxValue, yValue);
|
||||
this._sgNode.setPosition(locPosition);
|
||||
|
||||
if (this.emit) {
|
||||
this.emit(POSITION_CHANGED, oldPosition);
|
||||
@@ -803,13 +803,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
if (y === undefined) {
|
||||
if ((point.x === locAnchorPoint.x) && (point.y === locAnchorPoint.y))
|
||||
return;
|
||||
old = locAnchorPoint.clone();
|
||||
old = cc.v2(locAnchorPoint);
|
||||
locAnchorPoint.x = point.x;
|
||||
locAnchorPoint.y = point.y;
|
||||
} else {
|
||||
if ((point === locAnchorPoint.x) && (y === locAnchorPoint.y))
|
||||
return;
|
||||
old = locAnchorPoint.clone();
|
||||
old = cc.v2(locAnchorPoint);
|
||||
locAnchorPoint.x = point;
|
||||
locAnchorPoint.y = y;
|
||||
}
|
||||
@@ -864,13 +864,13 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
if (height === undefined) {
|
||||
if ((size.width === locContentSize.width) && (size.height === locContentSize.height))
|
||||
return;
|
||||
clone = locContentSize.clone();
|
||||
clone = cc.size(locContentSize);
|
||||
locContentSize.width = size.width;
|
||||
locContentSize.height = size.height;
|
||||
} else {
|
||||
if ((size === locContentSize.width) && (height === locContentSize.height))
|
||||
return;
|
||||
clone = locContentSize.clone();
|
||||
clone = cc.size(locContentSize);
|
||||
locContentSize.width = size;
|
||||
locContentSize.height = height;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require('./CCValueType');
|
||||
require('./CCEnum');
|
||||
require('./CCVec2');
|
||||
require('./CCPointExtension');
|
||||
require('./CCSize');
|
||||
require('./CCRect');
|
||||
require('./CCColor');
|
||||
|
||||
@@ -20,7 +20,6 @@ var srcs = [
|
||||
"./cocos2d/core/platform/CCScreen.js",
|
||||
"./cocos2d/core/platform/CCVisibleRect.js",
|
||||
|
||||
"./cocos2d/core/support/CCPointExtension.js",
|
||||
"./cocos2d/core/support/CCVertex.js",
|
||||
"./cocos2d/core/support/TransformUtils.js",
|
||||
|
||||
|
||||
+1
-1
@@ -37,4 +37,4 @@ gulp.task('test', ['build-test', 'unit-runner'], test);
|
||||
gulp.task('visual-test', ['build-test'], shell.task([
|
||||
'sh ./test/visual-tests/run.sh'
|
||||
]));
|
||||
gulp.task('rerun-test', test);
|
||||
gulp.task('test-no-build', test);
|
||||
|
||||
+62
-18
@@ -61,6 +61,7 @@ cc.js.mixin(cc.game, {
|
||||
_sceneInfos: [],
|
||||
|
||||
_persistRootNodes: [],
|
||||
_ignoreRemovePersistNode: null,
|
||||
|
||||
CONFIG_KEY: {
|
||||
width: 'width',
|
||||
@@ -179,10 +180,14 @@ cc.js.mixin(cc.game, {
|
||||
if (!node.parent) {
|
||||
node.parent = scene;
|
||||
}
|
||||
else if (node.parent !== scene) {
|
||||
else if ( !(node.parent instanceof cc.Scene) ) {
|
||||
cc.warn('The node can not be made persist because it\'s not under root node.');
|
||||
return;
|
||||
}
|
||||
else if (node.parent !== scene) {
|
||||
cc.warn('The node can not be made persist because it\'s not in current scene.');
|
||||
return;
|
||||
}
|
||||
this._persistRootNodes.push(node);
|
||||
node._persistNode = true;
|
||||
}
|
||||
@@ -195,11 +200,13 @@ cc.js.mixin(cc.game, {
|
||||
* @param {ENode} node - The node to be removed from persistent node list
|
||||
*/
|
||||
removePersistRootNode: function (node) {
|
||||
var index = this._persistRootNodes.indexOf(node);
|
||||
if (index !== -1) {
|
||||
this._persistRootNodes.splice(index, 1);
|
||||
if (node !== this._ignoreRemovePersistNode) {
|
||||
var index = this._persistRootNodes.indexOf(node);
|
||||
if (index !== -1) {
|
||||
this._persistRootNodes.splice(index, 1);
|
||||
}
|
||||
node._persistNode = false;
|
||||
}
|
||||
node._persistNode = false;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -298,6 +305,15 @@ cc.js.mixin(cc.director, {
|
||||
this.startAnimation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the cc.AnimationManager associated with this director.
|
||||
* @method getAnimationManager
|
||||
* @return {AnimationManager}
|
||||
*/
|
||||
getAnimationManager: function () {
|
||||
return this._animationManager;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns current running Scene. Director can only run one Scene at the time.
|
||||
* @method getScene
|
||||
@@ -316,6 +332,16 @@ cc.js.mixin(cc.director, {
|
||||
runScene: function (scene, onBeforeLoadScene) {
|
||||
cc.assert(scene, cc._LogInfos.Director.pushScene);
|
||||
|
||||
// detach persist nodes
|
||||
var i, node, game = cc.game;
|
||||
var persistNodes = game._persistRootNodes;
|
||||
for (i = persistNodes.length - 1; i >= 0; --i) {
|
||||
node = persistNodes[i];
|
||||
game._ignoreRemovePersistNode = node;
|
||||
node.parent = null;
|
||||
game._ignoreRemovePersistNode = null;
|
||||
}
|
||||
|
||||
// unload scene
|
||||
var oldScene = this._scene;
|
||||
if (cc.isValid(oldScene)) {
|
||||
@@ -331,13 +357,6 @@ cc.js.mixin(cc.director, {
|
||||
}
|
||||
this.emit(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, scene);
|
||||
|
||||
// Re-add persist node root
|
||||
var persistNodes = cc.game._persistRootNodes;
|
||||
for (var i = 0; i < persistNodes.length; ++i) {
|
||||
var node = persistNodes[i];
|
||||
node.parent = scene;
|
||||
}
|
||||
|
||||
var sgScene = scene;
|
||||
|
||||
// Run an Entity Scene
|
||||
@@ -347,6 +366,12 @@ cc.js.mixin(cc.director, {
|
||||
|
||||
this._scene = scene;
|
||||
sgScene = scene._sgNode;
|
||||
|
||||
// Re-attach persist nodes
|
||||
for (i = 0; i < persistNodes.length; ++i) {
|
||||
node = persistNodes[i];
|
||||
node.parent = scene;
|
||||
}
|
||||
}
|
||||
|
||||
// Run or replace rendering scene
|
||||
@@ -508,28 +533,28 @@ cc.Director.EVENT_COMPONENT_LATE_UPDATE = 'director_component_late_update';
|
||||
// Overwrite main loop
|
||||
if (_engineNumberVersion && _engineNumberVersion >= 3.9) {
|
||||
var scheduleTarget = {
|
||||
update: function (_frameRate) {
|
||||
update: function (dt) {
|
||||
// Call start for new added components
|
||||
cc.director.emit(cc.Director.EVENT_BEFORE_UPDATE);
|
||||
// Update for components
|
||||
cc.director.emit(cc.Director.EVENT_COMPONENT_UPDATE, _frameRate);
|
||||
cc.director.emit(cc.Director.EVENT_COMPONENT_UPDATE, dt);
|
||||
}
|
||||
};
|
||||
cc.Director.getInstance().getScheduler().scheduleUpdateForTarget(scheduleTarget, -1000, false);
|
||||
}
|
||||
else {
|
||||
cc.eventManager.addCustomListener(cc.Director.EVENT_BEFORE_UPDATE, function () {
|
||||
var _frameRate = cc.game.config[cc.game.CONFIG_KEY.frameRate];
|
||||
var dt = 1 / cc.game.config[cc.game.CONFIG_KEY.frameRate];
|
||||
// Call start for new added components
|
||||
cc.director.emit(cc.Director.EVENT_BEFORE_UPDATE);
|
||||
// Update for components
|
||||
cc.director.emit(cc.Director.EVENT_COMPONENT_UPDATE, _frameRate);
|
||||
cc.director.emit(cc.Director.EVENT_COMPONENT_UPDATE, dt);
|
||||
});
|
||||
}
|
||||
cc.eventManager.addCustomListener(cc.Director.EVENT_AFTER_UPDATE, function () {
|
||||
var _frameRate = cc.game.config[cc.game.CONFIG_KEY.frameRate];
|
||||
var dt = 1 / cc.game.config[cc.game.CONFIG_KEY.frameRate];
|
||||
// Late update for components
|
||||
cc.director.emit(cc.Director.EVENT_COMPONENT_LATE_UPDATE, _frameRate);
|
||||
cc.director.emit(cc.Director.EVENT_COMPONENT_LATE_UPDATE, dt);
|
||||
// User can use this event to do things after update
|
||||
cc.director.emit(cc.Director.EVENT_AFTER_UPDATE);
|
||||
|
||||
@@ -1134,9 +1159,28 @@ cc.eventManager.addListener = function(listener, nodeOrPriority) {
|
||||
|
||||
return listener;
|
||||
};
|
||||
cc.eventManager._removeListeners = cc.eventManager.removeListeners;
|
||||
cc.eventManager.removeListeners = function (target, recursive) {
|
||||
if (target instanceof cc.Component) {
|
||||
target = target.node._sgNode;
|
||||
}
|
||||
if (target instanceof cc.Node) {
|
||||
target = target._sgNode;
|
||||
}
|
||||
this._removeListeners(target, recursive);
|
||||
};
|
||||
|
||||
// cc.Scheduler
|
||||
cc.Scheduler.prototype.scheduleUpdate = cc.Scheduler.prototype.scheduleUpdateForTarget;
|
||||
cc.Scheduler.prototype._unschedule = cc.Scheduler.prototype.unschedule;
|
||||
cc.Scheduler.prototype.unschedule = function (callback, target) {
|
||||
if (typeof target === 'function') {
|
||||
var tmp = target;
|
||||
target = callback;
|
||||
callback = tmp;
|
||||
}
|
||||
this._unschedule(target, callback);
|
||||
};
|
||||
|
||||
// cc.Scale9Sprite
|
||||
cc.Scale9Sprite.prototype.setRenderingType = function (type) {
|
||||
|
||||
@@ -55,5 +55,6 @@ if (CC_DEV) {
|
||||
|
||||
require('./cocos2d/core/platform/js');
|
||||
require('./cocos2d/core/value-types');
|
||||
require('./cocos2d/core/utils/find');
|
||||
require('./cocos2d/core/event');
|
||||
require('./CCDebugger');
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
"cocos2d/core/platform/CCScreen.js",
|
||||
"cocos2d/core/platform/CCVisibleRect.js",
|
||||
|
||||
"cocos2d/core/support/CCPointExtension.js",
|
||||
"cocos2d/core/support/CCVertex.js",
|
||||
"cocos2d/core/support/TransformUtils.js",
|
||||
"cocos2d/core/event-manager/CCTouch.js",
|
||||
|
||||
@@ -51,3 +51,45 @@
|
||||
ok(cc.engine.getInstanceById(root1.uuid) === root1, 'should register uuid to engine after scene launch');
|
||||
});
|
||||
})();
|
||||
|
||||
module('load scene', SetupEngine);
|
||||
|
||||
test('persist node with dynamic scene', function () {
|
||||
var oldScene = new cc.Scene();
|
||||
cc.director.runScene(oldScene);
|
||||
|
||||
var globalNode = new cc.Node();
|
||||
globalNode.parent = oldScene;
|
||||
var childNode = new cc.Node();
|
||||
childNode.parent = globalNode;
|
||||
|
||||
cc.game.addPersistRootNode(globalNode);
|
||||
|
||||
var newScene = new cc.Scene();
|
||||
cc.director.runScene(newScene);
|
||||
|
||||
ok(globalNode.parent === newScene, 'persist node should not be destoryed automatically when loading a new scene');
|
||||
});
|
||||
|
||||
(function () {
|
||||
if (!TestEditorExtends) {
|
||||
return;
|
||||
}
|
||||
test('persist node with loaded scene', function () {
|
||||
var oldScene = new cc.Scene();
|
||||
cc.director.runScene(oldScene);
|
||||
|
||||
var globalNode = new cc.Node();
|
||||
globalNode.parent = oldScene;
|
||||
var childNode = new cc.Node();
|
||||
childNode.parent = globalNode;
|
||||
|
||||
cc.game.addPersistRootNode(globalNode);
|
||||
|
||||
var newScene = cc.deserialize(Editor.serialize(new cc.Scene(), {stringify: false}));
|
||||
|
||||
cc.director.runScene(newScene);
|
||||
|
||||
ok(globalNode.parent === newScene, 'persist node should not be destoryed automatically when loading a new scene');
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -139,10 +139,10 @@
|
||||
|
||||
asyncTest('revert prefab', function () {
|
||||
// stub
|
||||
var restore = cc.loader.loadJson;
|
||||
cc.loader.loadJson = function (url, callback) {
|
||||
var restore = cc.loader.loadTxt;
|
||||
cc.loader.loadTxt = function (url, callback) {
|
||||
if (url.endsWith(UUID + '.json')) {
|
||||
callback(null, prefabJson);
|
||||
callback(null, JSON.stringify(prefabJson));
|
||||
}
|
||||
else {
|
||||
restore(url, callback);
|
||||
@@ -166,7 +166,7 @@
|
||||
newNode2.setSiblingIndex(0);
|
||||
|
||||
Editor.PrefabUtils.revertPrefab(testNode, function () {
|
||||
cc.loader.loadJson = restore;
|
||||
cc.loader.loadTxt = restore;
|
||||
ok(testNode.getScaleX() === 123 && testNode.getScaleY() === 432, 'Revert property of the parent node');
|
||||
ok(testNode.getComponent(TestScript).constructor === TestScript, 'Restore removed component');
|
||||
var c = testNode.children[0];
|
||||
|
||||
Reference in New Issue
Block a user