private void OnGUI() { if (!mFlag_RefreshData) { this.RefreshDatas(); } EditorGUILayout.BeginHorizontal(GUILayout.Width(width_total)); //左边列表-source packages EditorGUILayout.BeginVertical(mStyle_box, GUILayout.Width(width_left_area)); GUILayout.Label("Source Packages:"); if (source_packages_counter > 0) { v2_list_left = EditorGUILayout.BeginScrollView(v2_list_left); foreach (var item in mDict_MainPackage_SourcePackage) { if (item.Value || mDict_Extensions_SourcePackage[item.Key]) { if (mLeft_Select_Platform != null && mLeft_Select_Platform == item.Key) { GUILayout.Label($"[{item.Key.ToString()}]", mStyle_select_label); } else { if (GUILayout.Button(item.Key.ToString())) { mLeft_Select_Platform = item.Key; } } } } EditorGUILayout.EndScrollView(); } else { GUILayout.FlexibleSpace(); GUILayout.Label(IsChinese ? "没有任何已构建的资源" : "No any built files", mStyle_center_large_label); GUILayout.FlexibleSpace(); } EditorGUILayout.EndVertical(); //中间 EditorGUILayout.BeginVertical(GUILayout.Width(width_center_area)); v2_list_center = EditorGUILayout.BeginScrollView(v2_list_center); //中间-source packages EditorGUILayout.BeginVertical(mStyle_box_center, GUILayout.MinHeight((this.position.height - 25) / 2)); if (mLeft_Select_Platform == null) { GUILayout.FlexibleSpace(); GUILayout.Label(@"(_ _)。゜zzZ"); GUILayout.FlexibleSpace(); } else { if (!mFlag_RefreshData_left || mFlag_RefreshData_left_platform == null || mFlag_RefreshData_left_platform.Value != mLeft_Select_Platform.Value) { RefreshData_Left_list(); } string platform_name = XPlatformUtil.GetNameText(mLeft_Select_Platform.Value); GUILayout.Label(IsChinese ? "已构建的资源" : "Built Assets"); GUILayout.Label((IsChinese ? "平台:" : "Platform: ") + mLeft_Select_Platform.ToString() + " / " + platform_name); if (mDict_MainPackage_SourcePackage[mLeft_Select_Platform.Value]) { if (!mDict_MainPackage_StreamingAssets[mLeft_Select_Platform.Value]) { //source有,stream没有,显示复制选项 if (GUILayout.Button(IsChinese?"复制 主包 到StreamingAssets":"Copy Main Package To StreamingAssets")) { VFSEditorUtil.CopyToStreamingAssets(VFSEditorUtil.GetSourcePackagesFolderPath(platform_name), platform_name, false, true); AssetDatabase.Refresh(); RefreshDatas(); } //source有,stream没有,显示复制选项 if (GUILayout.Button(IsChinese ? "复制 全部 到StreamingAssets" : "Copy All Packages To StreamingAssets")) { VFSEditorUtil.CopyToStreamingAssets(VFSEditorUtil.GetSourcePackagesFolderPath(platform_name), platform_name, false, false); AssetDatabase.Refresh(); RefreshDatas(); } } else { if (main_package_not_same) { EditorGUILayout.HelpBox(IsChinese?"StreamingAssets有 主包 资源,但与构建目录中的资源不一致。": "StreamingAssets has the main package resource, but it is not consistent with the resources in the build directory.", MessageType.None); //source有,stream没有,显示复制选项 if (GUILayout.Button(IsChinese ? "复制 主包 到StreamingAssets" : "Copy Main Package To StreamingAssets")) { VFSEditorUtil.CopyToStreamingAssets(VFSEditorUtil.GetSourcePackagesFolderPath(platform_name), platform_name, false, true); AssetDatabase.Refresh(); RefreshDatas(); } } } } if (mDict_Extensions_SourcePackage[mLeft_Select_Platform.Value]) { if (mDict_ExtensionGroups_Info.Count > 0) { GUILayout.Space(5); foreach (var item in mDict_ExtensionGroups_Info) { if (item.Value != 2) { if (GUILayout.Button(IsChinese ? $"复制扩展组 {item.Key} 到StreamingAssets" : $"Copy Extension Group \"{item.Key}\" To StreamingAsssets")) { string extension_group_source_path = VFSUtil.GetExtensionGroupFolder(VFSEditorUtil.GetSourcePackagesFolderPath(platform_name), item.Key); VFSEditorUtil.CopyExtensionPackageToSreamingAssets(extension_group_source_path, platform_name, item.Key); AssetDatabase.Refresh(); RefreshDatas(); RefreshData_Left_list(); Refresh_Right_list(); } } } } } } EditorGUILayout.EndVertical(); GUILayout.Space(10); //中间-streamingassets EditorGUILayout.BeginVertical(mStyle_box_center, GUILayout.MinHeight((this.position.height - 25) / 2)); if (mRight_Select_Platform == null) { GUILayout.FlexibleSpace(); GUILayout.Label(@"(๑•̀ㅂ•)و✧́"); GUILayout.FlexibleSpace(); } else { GUILayout.Label("StreamingAssets"); GUILayout.Label((IsChinese ? "平台:" : "Platform: ") + mRight_Select_Platform.ToString() + " / " + XPlatformUtil.GetNameText(mRight_Select_Platform.Value)); if (GUILayout.Button(IsChinese ? "删除资源" : "Delete Assets")) { if (EditorUtility.DisplayDialog("sure?", IsChinese?"确定要删除吗":"Are you sure to delete?", IsChinese ? "删它!" : "Delete", IsChinese ? "取消" : "Cancel")) { VFSEditorUtil.DeletePackagesFromStreamingAssets(XPlatformUtil.GetNameText(mRight_Select_Platform.Value)); mDict_Extensions_StreamingAssets[mRight_Select_Platform.Value] = false; mDict_MainPackage_StreamingAssets[mRight_Select_Platform.Value] = false; mRight_Select_Platform = null; mFlag_RefreshData_right = false; AssetDatabase.Refresh(); RefreshDatas(); RefreshData_Left_list(); } } } EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); //右边 EditorGUILayout.BeginVertical(mStyle_box, GUILayout.Width(width_right_area)); GUILayout.Label("StreamingAssets:"); if (packages_stream_counter > 0) { v2_list_right = EditorGUILayout.BeginScrollView(v2_list_right); foreach (var item in mDict_MainPackage_StreamingAssets) { if (item.Value || mDict_Extensions_StreamingAssets[item.Key]) { if (mRight_Select_Platform != null && mRight_Select_Platform == item.Key) { GUILayout.Label($"[{item.Key.ToString()}]", mStyle_select_label); } else { if (GUILayout.Button(item.Key.ToString())) { mRight_Select_Platform = item.Key; } } } } EditorGUILayout.EndScrollView(); } else { GUILayout.FlexibleSpace(); GUILayout.Label(IsChinese ? "没有任何有效的的包" : "No any valid packages", mStyle_center_large_label); GUILayout.FlexibleSpace(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
/// <summary> /// /// </summary> /// <param name="root_path">root_path下面应该就是"vfs_root","vfs_data"之类的文件</param> public void CopyToStreamingAssets(string root_path, string platform_name) { Debug.Log(" copy To \"StreamingAssets\""); VFSEditorUtil.CopyToStreamingAssets(root_path, platform_name); }