GetItems() публичный Метод

public GetItems ( ) : List
Результат List
Пример #1
0
    private void OnGUI()
    {
        if (target == null || EditorApplication.isCompiling)
        {
            Close();
            DestroyImmediate(this);
            _instance = null;
        }

        if (fairGUIItems == null)
        {
            target.LoadAllAssets();
            fairGUIItems = target.GetItems();
            Debug.Log("$$ loaded assets count:" + fairGUIItems.Count);
            selectInfos = new bool[fairGUIItems.Count];
        }

        EditorGUILayout.BeginVertical();

        scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
        for (int i = 0, c = selectInfos.Length; i < c; i++)
        {
            var itemName = fairGUIItems[i].name;
            if (!string.IsNullOrEmpty(itemName))
            {
                //GUI.Button(Rect.MinMaxRect(0, 0, 600, 80), "");
                //EditorGUI.DropdownButton(Rect.MinMaxRect(0, 0, 600, 80), new GUIContent("", ""), FocusType.Passive);
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(itemName);
                selectInfos[i] = EditorGUILayout.Toggle(selectInfos[i]);

                EditorGUILayout.EndHorizontal();
            }
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        if (GUILayout.Button("生成Ctrl"))
        {
            List <FairyGUI.PackageItem> itemsToGen = new List <FairyGUI.PackageItem>();
            for (int i = 0, c = selectInfos.Length; i < c; i++)
            {
                if (selectInfos[i])
                {
                    itemsToGen.Add(fairGUIItems[i]);
                }
            }

            CodeGenerator.GenerateCtrlPartGen(itemsToGen, target);
            CodeGenerator.GenerateCtrlPartMain(itemsToGen);
        }
        EditorGUILayout.EndVertical();
    }
Пример #2
0
 static public int GetItems(IntPtr l)
 {
     try {
         FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
         var ret = self.GetItems();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #3
0
 static int GetItems(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
         System.Collections.Generic.List <FairyGUI.PackageItem> o = obj.GetItems();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #4
0
        public static ExportPipeInfo ParseExportInfo(List <FairyGUI.PackageItem> itemsToGen, FairyGUI.UIPackage pak)
        {
            //处理fairyGUI包根目录
            var allComponents = new List <FairyGUI.PackageItem>();

            pak.GetItems().ForEach((item) =>
            {
                if (item.type == FairyGUI.PackageItemType.Component)
                {
                    allComponents.Add(item);
                }
            });

            /** 需要导出的自定义组件信息*/
            var exportInfoMap = new Dictionary <string, ExportComponentInfo>();
            /** 需要导出的自定义元素信息 */
            var exportCustomElementInfoMap = new Dictionary <string, ExportCustomElementInfo>();

            itemsToGen.ForEach((item) =>
            {
                /** 处理组件 */
                if (item.type == FairyGUI.PackageItemType.Component)
                {
                    item.Load();

                    //var xml = item.componentData;
                    /** 自定控件继承的父类类型 */
                    string extention = item.objectType.ToString();//xml.GetAttribute("extention");

                    // elements
                    if (extention != "Component")
                    {
                        var TypeName = item.name;
                        // 引用了包内自定义控件
                        if (customComponentType.ContainsKey(extention))
                        {
                            // 导出自定义控件类型
                            if (!exportCustomElementInfoMap.ContainsKey(TypeName))
                            {
                                var packageName             = pak.name;
                                var exportCustomElementInfo = new ExportCustomElementInfo();
                                exportCustomElementInfo.ExportExtentionType = customComponentType[extention];
                                exportCustomElementInfo.ExportPackageName   = string.Join(".", new string[] {
                                    CodeGeneratorSetting.RootNameSpace,
                                    packageName,
                                });
                                exportCustomElementInfo.ExportTypeName = TypeName;
                                exportCustomElementInfo.pakItem        = item;
                                exportCustomElementInfo.ID             = item.id;
                                exportCustomElementInfoMap[TypeName]   = exportCustomElementInfo;
                                FillInfoRecursively(exportCustomElementInfo, exportInfoMap, exportCustomElementInfoMap, pak, allComponents);
                            }
                        }
                        // 引用了包内自定义组件
                    }
                    else //root component
                    {
                        var componentType               = new ExportComponentInfo();
                        var packageName                 = pak.name;
                        componentType.ExportTypeName    = item.name;
                        componentType.ExportPackageName = string.Join(".", new string[] {
                            CodeGeneratorSetting.RootNameSpace,
                            packageName,
                            //componentType.ExportTypeName,
                        });
                        componentType.pakItem = item;
                        componentType.ID      = item.id;
                        exportInfoMap[componentType.ExportTypeName] = componentType;

                        //递归查找component下面元素
                        FillInfoRecursively(componentType, exportInfoMap, exportCustomElementInfoMap, pak, allComponents);

                        /*
                         * foreach (var kv in exportInfoMap)
                         * {
                         *  LogB("1$$ customComponent type to export:" + kv.Key);
                         *
                         *  kv.Value.ExportInfos.ForEach((info) =>
                         *  {
                         *      LogB("1.1$$ export Category" + info.ExportCategory.ToString() + " name:" + info.ExportName + " type: " + info.ExportTypeName);
                         *  });
                         *
                         * }
                         *
                         * foreach (var kv in exportCustomElementInfoMap)
                         * {
                         *  LogB("2$$ customElement type to export:" + kv.Key);
                         * }
                         */
                    }
                }
            });

            ExportPipeInfo exportPipeInfo = new ExportPipeInfo()
            {
                ExportComponentInfoMap     = exportInfoMap,
                ExportCustomElementInfoMap = exportCustomElementInfoMap
            };

            return(exportPipeInfo);
        }