public override void OnInspectorGUI() { RectTransform rect = target as RectTransform; if (rect == null) { base.OnInspectorGUI(); return; } string assetPath = AssetDatabase.GetAssetPath(rect.gameObject); string asset = PsdLayoutTool.PsdImporter.GetRelativePath(ResDefine.GetResPath(EResType.eResUI)); if (assetPath.Contains(asset)) { base.OnInspectorGUI(); GUILayout.Space(3); GUILayout.Box(string.Empty, GUILayout.Height(1), GUILayout.MaxWidth(Screen.width - 30)); GUILayout.Space(3); GUIContent autoBind = new GUIContent("autoBindView", "auto bind view to prefab"); BindView.AutoBindView = EditorGUILayout.Toggle(autoBind, BindView.AutoBindView); //if (GUILayout.Button("Generate CS View Script")) //{ // string prefabFullPath = GetPrefabFullPath(assetPath); // if (!System.IO.File.Exists(prefabFullPath)) // { // UnityEditor.EditorUtility.DisplayDialog("提示", "没有找到prefab文件,请先生成prefab", "确定"); // return; // } // BindView.GenerateView(assetPath, ScriptType.eCSharp); //} //GUILayout.Space(3); if (GUILayout.Button("Generate Lua View Script")) { BindView.GenerateView(assetPath, ScriptType.eLua); } if (GUILayout.Button("Delete bind Script")) { //string CSAssetPath = BindView.UICSViewPath + System.IO.Path.GetFileNameWithoutExtension(assetPath); //bool ret = AssetDatabase.DeleteAsset(CSAssetPath + ".cs"); string LuaAssetPath = BindView.UILuaViewPath + System.IO.Path.GetFileNameWithoutExtension(assetPath); bool ret = AssetDatabase.DeleteAsset(LuaAssetPath + ".lua"); if (ret) { AssetDatabase.Refresh(); } } if (GUILayout.Button("Delete Repeat sprites")) { PsdLayoutTool.PsdImporter.DeleteCurrentPsdRepeatSprites(System.IO.Path.GetFileNameWithoutExtension(assetPath), false); } } else { base.OnInspectorGUI(); } }