Ejemplo n.º 1
0
        public static string Generate(string jsonName, InputParam param_)
        {
            JsonData data = KAssetManager.GetUIJsonData(jsonName);

            //1.创建canvas
            GameObject root = new GameObject("Canvas_" + jsonName);

            root.layer = LayerMask.NameToLayer("UI");
            AddCanvas(root, jsonName);  //canvas组件

            //2.构建go
            ComponentCreator creator = ComponentCreatorFactory.GetTypeCreator("Container");
            GameObject       panel   = creator.Create(data, root); //创建对象

            AddPanelToRoot(panel, root);

            //3.执行builder
            //AddPanelBuilder(root);
            //RemoveAllBuildHelper(panel);

            //4.创建预制
            GenPrefabs(root, param_.isBuildAssetbundle);

            return(string.Empty);
        }
Ejemplo n.º 2
0
        protected GameObject CreateChild(GameObject parent, JsonData data)
        {
            string           type    = (string)data["type"];
            string           name    = (string)data["name"];
            ComponentCreator creator = ComponentCreatorFactory.GetCustomCreator(type, name);    //先从自定义里取

            if (creator == null)
            {
                creator = ComponentCreatorFactory.GetTypeCreator(type);
            }
            return(creator.Create(data, parent));    //在这里递归调用creator
        }