mirror of https://github.com/axmolengine/axmol.git
add loadWithVisibleSize js function.
This commit is contained in:
parent
224f392a9c
commit
83f5f85f56
|
@ -193,6 +193,36 @@ ccs.load = function(file, path){
|
||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Analysis of studio JSON file and layout ui widgets by visible size.
|
||||||
|
* The incoming file name, parse out the corresponding object
|
||||||
|
* Temporary support file list:
|
||||||
|
* ui 1.*
|
||||||
|
* node 1.* - 2.*
|
||||||
|
* action 1.* - 2.*
|
||||||
|
* scene 0.* - 1.*
|
||||||
|
* @param {String} file
|
||||||
|
* @param {String} [path=] Resource path
|
||||||
|
* @returns {{node: cc.Node, action: cc.Action}}
|
||||||
|
*/
|
||||||
|
ccs.loadWithVisibleSize = function(file, path){
|
||||||
|
var object = {
|
||||||
|
node: null,
|
||||||
|
action: null
|
||||||
|
};
|
||||||
|
|
||||||
|
object.node = ccs._load(file, null, path);
|
||||||
|
var size = cc.director.getVisibleSize();
|
||||||
|
if(object.node && size){
|
||||||
|
object.node.setContentSize(size.width, size.height);
|
||||||
|
ccui.helper.doLayout(object.node);
|
||||||
|
}
|
||||||
|
object.action = ccs._load(file, "action", path);
|
||||||
|
if(object.action && object.action.tag === -1 && object.node)
|
||||||
|
object.action.tag = object.node.tag;
|
||||||
|
return object;
|
||||||
|
};
|
||||||
|
|
||||||
//Forward compatible interface
|
//Forward compatible interface
|
||||||
|
|
||||||
ccs.actionTimelineCache = {
|
ccs.actionTimelineCache = {
|
||||||
|
|
Loading…
Reference in New Issue