difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      层级控制器
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
window.ViewManager = cc.Class({
    cotr:function(){
    },
 
    properties: {
        node_list: [],
        self: null,
    },
 
    statics: {
        instance: null,
    },
 
    // 储存节点
    addSceneNode: function (tag, node) {
        this.node_list[tag] = node;
    },
 
    // 将节点add到指定的层
    addToSceneNode: function(node, tag) {
        if (node) {
            var scene_node = this.node_list[tag]
            if (scene_node) {
                scene_node.addChild(node);
            }
        }
    },
 
    // 获取指定节点
    getSceneNode: function(tag){
        if (tag == null){
            tag = SCENE_TAG.win;
        }
        var node = this.node_list[tag];
        return node;
    },
});
 
 
ViewManager.getInstance = function () {
    if (!ViewManager.instance) {
        ViewManager.instance = new ViewManager();
    }
    return ViewManager.instance;
}
 
module.exports = ViewManager;