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(); }
static int LoadAllAssets(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1); obj.LoadAllAssets(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }