初始化

This commit is contained in:
2026-06-05 22:12:05 +08:00
commit d7146f87ac
1999 changed files with 221608 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 94e8069bc988f754daa2540ec5849063
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,183 @@
#if UNITY_EDITOR
namespace BuildReportTool.Window
{
public static class Labels
{
// GUI messages, labels
public const string WAITING_FOR_BUILD_TO_COMPLETE_MSG =
"Waiting for build to complete... Click this window if not in focus to refresh.";
public const string NO_BUILD_INFO_FOUND_MSG =
"No Build Info.\n\nClick \"Get Log\" to retrieve the last build info from the Editor log.\n\nClick Open to manually open a previously saved build report file.";
public const string FOUND_NO_LOG_ARGUMENT_MSG =
"Warning: Unity was launched with the -nolog argument. Build Report Tool can't obtain build info if there are no logs. To generate build reports, relaunch Unity without the -nolog argument.";
public const string MONO_DLLS_LABEL = "System DLLs:";
public const string UNITY_ENGINE_DLLS_LABEL = "UnityEngine DLLs:";
public const string SCRIPT_DLLS_LABEL = "Script DLLs:";
public const string TIME_OF_BUILD_LABEL = "Time of Build:";
public const string UNUSED_TOTAL_SIZE_LABEL = "Total Unused\nAssets Size:";
public const string USED_TOTAL_SIZE_LABEL = "Total Used\nAssets Size:";
public const string STREAMING_ASSETS_TOTAL_SIZE_LABEL = "Streaming\nAssets Size:";
public const string BUILD_TOTAL_SIZE_LABEL = "Total Build Size:";
public const string BUILD_XCODE_SIZE_LABEL = "Size of Xcode Project Folder";
public const string WEB_UNITY3D_FILE_SIZE_LABEL = "Size of .unity3d File:";
public const string ANDROID_APK_FILE_SIZE_LABEL = "Size of .apk File:";
public const string ANDROID_OBB_FILE_SIZE_LABEL = "Size of .obb File:";
public const string UNUSED_TOTAL_SIZE_DESC = "Total size of project assets not included in the build.";
public const string UNUSED_TOTAL_IS_FROM_BATCH = "This size only accounts for the first {0:N0} assets in the project due to the <b><color=white>Unused Assets batching</color></b>. You can turn this off from the Options (under the <b><color=white>In Unused Assets List</color></b> section) then regenerate the Build Report.";
public const string USED_TOTAL_SIZE_DESC =
"Total size of the used assets before being packed.\nAlso includes size of compiled Mono scripts.\nDoes not include size of files in StreamingAssets.";
public const string STREAMING_ASSETS_SIZE_DESC = "Total size of all files in the StreamingAssets folder.";
public const string BUILD_SIZE_STANDALONE_DESC =
"File size of the executable file and the accompanying Data folder.";
public const string BUILD_SIZE_WINDOWS_DESC = "File size of the .exe file and the accompanying Data folder.";
public const string BUILD_SIZE_MACOSX_DESC = "File size of the .app file.";
public const string BUILD_SIZE_LINUX_UNIVERSAL_DESC =
"File size of both 32-bit and 64-bit executables, plus the accompanying Data folder.";
public const string BUILD_SIZE_WEB_DESC = "File size of the whole web build folder.";
public const string BUILD_SIZE_IOS_DESC = "File size of the Xcode project folder.";
public const string BUILD_SIZE_ANDROID_DESC = "File size of resulting .apk file.";
public const string BUILD_SIZE_ANDROID_WITH_OBB_DESC = "File size of resulting .apk and .obb files.";
public const string BUILD_SIZE_ANDROID_WITH_PROJECT_DESC = "File size of generated Eclipse project folder.";
public const string OPEN_SERIALIZED_BUILD_INFO_TITLE = "Open Build Report XML File";
public const string TOTAL_SIZE_BREAKDOWN_LABEL = "Used Assets Size Breakdown:";
public const string ASSET_SIZE_BREAKDOWN_LABEL = "Asset Breakdown:";
public const string ASSET_SIZE_BREAKDOWN_MSG_PRE_BOLD = "Sorted by";
public const string ASSET_SIZE_BREAKDOWN_MSG_BOLD = "uncompressed";
public const string ASSET_SIZE_BREAKDOWN_MSG_POST_BOLD =
"size. Click on an asset's name to include it in size calculations or batch deletions. Shift-click to select many. Ctrl-click to toggle selection.";
public const string TOTAL_SIZE_BREAKDOWN_MSG_PRE_BOLD = "Based on";
public const string TOTAL_SIZE_BREAKDOWN_MSG_BOLD = "uncompressed";
public const string TOTAL_SIZE_BREAKDOWN_MSG_POST_BOLD = "build size";
public const string NO_FILES_FOR_THIS_CATEGORY_LABEL = "None";
public const string NON_APPLICABLE_PERCENTAGE_LABEL = "N/A";
public const string OVERVIEW_CATEGORY_LABEL = "Overview";
public const string BUILD_SETTINGS_CATEGORY_LABEL = "Project Settings";
public const string SIZE_STATS_CATEGORY_LABEL = "Total Size";
public const string USED_ASSETS_CATEGORY_LABEL = "Used Assets";
public const string UNUSED_ASSETS_CATEGORY_LABEL = "Unused Assets";
public const string EXTRA_DATA_CATEGORY_LABEL = "Extra Data";
public const string OPTIONS_CATEGORY_LABEL = "Options";
public const string HELP_CATEGORY_LABEL = "Help & Info";
public const string REFRESH_LABEL = "Get Log";
public const string OPEN_LABEL = "Open";
public const string SAVE_LABEL = "Save";
public const string SAVE_MSG = "Save Build Report to XML";
public const string RECALC_RAW_SIZES = "Recalculate Raw Sizes";
public const string RECALC_IMPORTED_SIZES = "Recalculate Imported Sizes";
public const string RECALC_SIZE_BEFORE_BUILD = "Recalculate Size Before Build";
public const string SELECT_ALL_LABEL = "Select All";
public const string SELECT_NONE_LABEL = "Select None";
public const string SELECTED_QTY_LABEL = "Selected: ";
public const string SELECTED_SIZE_LABEL = "Total size: ";
public const string SELECTED_PERCENT_LABEL = "Total percentage: ";
public const string BUILD_TYPE_PREFIX_MSG = "For ";
public const string BUILD_TYPE_SUFFIX_MSG = "";
public const string UNITY_VERSION_PREFIX_MSG = ", built in ";
public const string COLLECT_BUILD_INFO_LABEL =
"Automatically collect and save build info after building (does not include batchmode builds)";
public const string SHOW_AFTER_BUILD_LABEL = "Show Build Report Window automatically after building";
public const string INCLUDE_SVN_LABEL = "Include SVN metadata when creating Unused Assets list";
public const string INCLUDE_GIT_LABEL = "Include Git metadata when creating Unused Assets list";
public const string INCLUDE_BRT_LABEL = "Include Build Report Tool assets when creating Unused Assets list";
public const string FILE_FILTER_DISPLAY_TYPE_LABEL = "Draw file filters as:";
public const string FILE_FILTER_DISPLAY_TYPE_DROP_DOWN_LABEL = "Dropdown box";
public const string FILE_FILTER_DISPLAY_TYPE_BUTTONS_LABEL = "Buttons";
public const string SAVE_PATH_LABEL = "Current Build Report save path: ";
public const string SAVE_FOLDER_NAME_LABEL = "Folder name for Build Reports:";
public const string SAVE_PATH_TYPE_LABEL = "Save build reports:";
public const string SAVE_PATH_TYPE_PERSONAL_DEFAULT_LABEL = "In user's personal folder";
public const string SAVE_PATH_TYPE_PERSONAL_WIN_LABEL = "In \"My Documents\" folder";
public const string SAVE_PATH_TYPE_PERSONAL_MAC_LABEL = "In Home folder";
public const string SAVE_PATH_TYPE_PROJECT_LABEL = "Beside project folder";
public const string EDITOR_LOG_LABEL = "Unity Editor.log path ";
public const string DEFAULT_EDITOR_LOG_NOT_FOUND_MSG = "Warning: Unity Editor Log file not found.";
public const string OVERRIDE_LOG_NOT_FOUND_MSG =
"Specified log file not found. Please change the path by clicking \"Set Override Log\"";
public const string SET_OVERRIDE_LOG_LABEL = "Set Override Log";
public const string CLEAR_OVERRIDE_LOG_LABEL = "Clear Override Log";
public const string FILTER_GROUP_TO_USE_LABEL = "File Filter Group To Use:";
public const string FILTER_GROUP_FILE_PATH_LABEL = "Configured File Filter Group: ";
public const string FILTER_GROUP_TO_USE_CONFIGURED_LABEL = "Always use configured file filter group";
public const string FILTER_GROUP_TO_USE_EMBEDDED_LABEL =
"Use file filter group embedded in file if available\n(when opening build report files)";
public const string OPEN_IN_FILE_BROWSER_DEFAULT_LABEL = "Open in file browser";
public const string OPEN_IN_FILE_BROWSER_WIN_LABEL = "Show in Explorer";
public const string OPEN_IN_FILE_BROWSER_MAC_LABEL = "Reveal in Finder";
public const string CALCULATION_LEVEL_FULL_NAME = "4 - Full Report (complete calculations)";
public const string CALCULATION_LEVEL_FULL_DESC =
"Calculate everything. Will show size breakdown, \"Used Assets\", and \"Unused Assets\" list.\n\nThis can be slow if you have a large project with thousands of files or objects in scenes. If you get out of memory errors, try the lower calculation levels.";
public const string CALCULATION_LEVEL_NO_PREFAB_NAME = "3 - Do not calculate unused prefabs";
public const string CALCULATION_LEVEL_NO_PREFAB_DESC =
"Will calculate everything, except that it will not determine whether a prefab is unused. It will still show which other assets are unused.\n\nIf you have scenes that use hundreds to thousands of prefabs and you get an out of memory error when generating a build report, try this setting.";
public const string CALCULATION_LEVEL_NO_UNUSED_NAME = "2 - Do not calculate unused assets";
public const string CALCULATION_LEVEL_NO_UNUSED_DESC =
"Will display overview data and \"Used Assets\" list only. It will not determine which assets are unused.\n\nIt will not show Streaming Assets files in your Used Assets list, but their total size will still be shown in the Overview.";
public const string CALCULATION_LEVEL_MINIMAL_NAME = "1 - Overview only (minimum calculations)";
public const string CALCULATION_LEVEL_MINIMAL_DESC =
"Will display overview data only. This is the fastest but also shows the least information.";
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 591e9cd014f62054a85ab359ad5f5918
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,90 @@
#if UNITY_EDITOR
namespace BuildReportTool.Window
{
public static class Settings
{
// GUI Settings
public const string DEFAULT_GUI_SKIN_FILENAME = "BuildReportWindow.guiskin";
public const string DARK_GUI_SKIN_FILENAME = "BuildReportWindowDark.guiskin";
// list normal is a list style with normal font size
public const string LIST_NORMAL_STYLE_NAME = "ListNormal";
public const string LIST_NORMAL_ALT_STYLE_NAME = "ListAltNormal";
public const string LIST_NORMAL_SELECTED_NAME = "ListAltNormalSelected";
// list normal is a list style with normal font size
public const string LIST_ICON_STYLE_NAME = "ListIcon";
public const string LIST_ICON_ALT_STYLE_NAME = "ListAltIcon";
// list small is a list style with smaller font size (for the asset list)
public const string LIST_SMALL_STYLE_NAME = "List";
public const string LIST_SMALL_ALT_STYLE_NAME = "ListAlt";
public const string LIST_SMALL_SELECTED_NAME = "ListAltSelected";
public const string TOOLBAR_LEFT_STYLE_NAME = "ToolbarLeft";
public const string TOOLBAR_MIDDLE_STYLE_NAME = "ToolbarMiddle";
public const string TOOLBAR_RIGHT_STYLE_NAME = "ToolbarRight";
public const string TAB_LEFT_STYLE_NAME = "TabLeft";
public const string TAB_MIDDLE_STYLE_NAME = "TabMiddle";
public const string TAB_RIGHT_STYLE_NAME = "TabRight";
public const string STATUS_BAR_BG_STYLE_NAME = "StatusBarBg";
public const string STATUS_BAR_LABEL_STYLE_NAME = "StatusBarLabel";
public const string VERSION_STYLE_NAME = "Version";
public const string TOP_BAR_LABEL_STYLE_NAME = "TopBarLabel";
public const string TOP_BAR_BTN_STYLE_NAME = "TopBarButton";
public const string TOP_BAR_BG_STYLE_NAME = "TopBarBg";
public const string LIST_COLUMN_HEADER_STYLE_NAME = "ListColumnHeader";
public const string LIST_COLUMN_HEADER_ASC_STYLE_NAME = "ListColumnHeader-Asc";
public const string LIST_COLUMN_HEADER_DESC_STYLE_NAME = "ListColumnHeader-Desc";
public const string FILE_FILTER_POPUP_STYLE_NAME = "TopBarPopup";
public const string LIST_FILENAME_STYLE = "button";
public const string LIST_FILEPATH_STYLE = "button";
public const string HIDDEN_SCROLLBAR_STYLE_NAME = "HiddenScrollbar";
public const string MAIN_TITLE_STYLE_NAME = "Title";
public const string MAIN_SUBTITLE_STYLE_NAME = "Subtitle";
public const string TINY_HELP_STYLE_NAME = "TinyHelp";
public const string BOXED_LABEL_STYLE_NAME = "Text-Boxed";
public const string INFO_TITLE_STYLE_NAME = "Big1";
public const string SUB_TITLE_STYLE_NAME = "Big3";
public const string INFO_SUBTITLE_STYLE_NAME = "Header2";
public const string INFO_SUBTITLE_BOLD_STYLE_NAME = "Header2Bold";
public const string BIG_NUMBER_STYLE_NAME = "Big2";
public const string INFO_TEXT_STYLE_NAME = "TextInfo";
public const string SETTING_NAME_STYLE_NAME = "TextBold";
public const string SETTING_VALUE_STYLE_NAME = "Text";
public const string SETTING_VALUE_NO_WRAP_STYLE_NAME = "TextNoWrap";
public const float CATEGORY_VERTICAL_SPACING = 40;
public const float CATEGORY_HORIZONTAL_SPACING = 30;
public const string BIG_LEFT_ARROW_ICON_STYLE_NAME = "Icon-ArrowBig-Left";
public const string BIG_RIGHT_ARROW_ICON_STYLE_NAME = "Icon-ArrowBig-Right";
public const string COLUMN_ICON_STYLE_NAME = "Icon-Toolbar-Column";
}
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6c68d32e125434fd4a5e31f854d379af
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,177 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace BuildReportTool.Window
{
public static class Utility
{
public static void DrawCentralMessage(Rect position, string msg)
{
float w = 300;
float h = 100;
float x = (position.width - w) * 0.5f;
float y = (position.height - h) * 0.25f;
GUI.Label(new Rect(x, y, w, h), msg);
}
public static Texture AssemblyIcon
{
get
{
var assemblyGuiContent = EditorGUIUtility.IconContent("Assembly Icon");
if (assemblyGuiContent != null)
{
return assemblyGuiContent.image;
}
return null;
}
}
public static Texture GetIcon(string assetPath)
{
if (assetPath.IsAnAssembly())
{
// an assembly (dll) doesn't exist yet in the library,
// so we'll use a hardcoded icon
return AssemblyIcon;
}
else
{
return AssetDatabase.GetCachedIcon(assetPath);
}
}
public static void PingSelectedAssets(AssetList list)
{
var newSelection = new List<UnityEngine.Object>(list.GetSelectedCount());
var iterator = list.GetSelectedEnumerator();
while (iterator.MoveNext())
{
var loadedObject =
AssetDatabase.LoadAssetAtPath(iterator.Current.Key, typeof(UnityEngine.Object));
if (loadedObject != null)
{
newSelection.Add(loadedObject);
}
}
Selection.objects = newSelection.ToArray();
}
public static void PingAssetInProject(string file)
{
if (string.IsNullOrEmpty(file))
{
return;
}
if (!file.StartsWith("Assets/") && !file.StartsWith("Packages/"))
{
return;
}
// thanks to http://answers.unity3d.com/questions/37180/how-to-highlight-or-select-an-asset-in-project-win.html
var asset = AssetDatabase.LoadMainAssetAtPath(file);
if (asset != null)
{
GUISkin temp = GUI.skin;
GUI.skin = null;
//EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(file, typeof(Object)));
EditorGUIUtility.PingObject(asset);
Selection.activeObject = asset;
EditorUtility.FocusProjectWindow();
GUI.skin = temp;
}
}
public static string GetProperBuildSizeDesc(BuildInfo buildReportToDisplay)
{
BuildReportTool.BuildPlatform buildPlatform =
BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
buildReportToDisplay.BuildTargetUsed);
switch (buildPlatform)
{
case BuildReportTool.BuildPlatform.MacOSX32:
return Labels.BUILD_SIZE_MACOSX_DESC;
case BuildReportTool.BuildPlatform.MacOSX64:
return Labels.BUILD_SIZE_MACOSX_DESC;
case BuildReportTool.BuildPlatform.MacOSXUniversal:
return Labels.BUILD_SIZE_MACOSX_DESC;
case BuildReportTool.BuildPlatform.Windows32:
return Labels.BUILD_SIZE_WINDOWS_DESC;
case BuildReportTool.BuildPlatform.Windows64:
return Labels.BUILD_SIZE_WINDOWS_DESC;
case BuildReportTool.BuildPlatform.Linux32:
return Labels.BUILD_SIZE_STANDALONE_DESC;
case BuildReportTool.BuildPlatform.Linux64:
return Labels.BUILD_SIZE_STANDALONE_DESC;
case BuildReportTool.BuildPlatform.LinuxUniversal:
return Labels.BUILD_SIZE_LINUX_UNIVERSAL_DESC;
case BuildReportTool.BuildPlatform.Android:
if (buildReportToDisplay.AndroidCreateProject)
{
return Labels.BUILD_SIZE_ANDROID_WITH_PROJECT_DESC;
}
if (buildReportToDisplay.AndroidUseAPKExpansionFiles)
{
return Labels.BUILD_SIZE_ANDROID_WITH_OBB_DESC;
}
return Labels.BUILD_SIZE_ANDROID_DESC;
case BuildReportTool.BuildPlatform.iOS:
return Labels.BUILD_SIZE_IOS_DESC;
case BuildReportTool.BuildPlatform.Web:
return Labels.BUILD_SIZE_WEB_DESC;
}
return "";
}
public static void DrawLargeSizeDisplay(string label, string desc, string value)
{
if (string.IsNullOrEmpty(value))
{
return;
}
var labelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (labelStyle == null)
{
labelStyle = GUI.skin.label;
}
var descStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.TINY_HELP_STYLE_NAME);
if (descStyle == null)
{
descStyle = GUI.skin.label;
}
var valueStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
if (valueStyle == null)
{
valueStyle = GUI.skin.label;
}
GUILayout.BeginVertical();
GUILayout.Label(label, labelStyle);
GUILayout.Label(desc, descStyle);
GUILayout.Label(value, valueStyle);
GUILayout.EndVertical();
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b35f23d62e95e9441801ecf6c9a2ae8a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 157891036ec1dd44583e0c4445ce30c4

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5a70a05257d97424cbf31865798b753e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d550d5e908734d6499daded04dac1812
timeCreated: 1558433314
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,301 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
namespace BuildReportTool.Window.Screen
{
public partial class AssetList
{
bool ShouldShowDeleteButtons(BuildInfo buildReportToDisplay)
{
return
(IsShowingUnusedAssets && buildReportToDisplay.HasUnusedAssets) ||
(buildReportToDisplay.HasUsedAssets && BuildReportTool.Options.AllowDeletingOfUsedAssets);
}
void InitiateDeleteSelectedUsed(BuildInfo buildReportToDisplay)
{
BuildReportTool.AssetList listToDeleteFrom = GetAssetListToDisplay(buildReportToDisplay);
InitiateDeleteSelectedInAssetList(buildReportToDisplay, listToDeleteFrom);
}
void InitiateDeleteSelectedInAssetList(BuildInfo buildReportToDisplay, BuildReportTool.AssetList listToDeleteFrom)
{
if (listToDeleteFrom.IsNothingSelected)
{
return;
}
BuildReportTool.SizePart[] all = listToDeleteFrom.All;
int numOfFilesRequestedToDelete = listToDeleteFrom.GetSelectedCount();
int numOfFilesToDelete = numOfFilesRequestedToDelete;
int systemDeletionFileCount = 0;
int brtFilesSelectedForDelete = 0;
// filter out files that shouldn't be deleted
// and identify unrecoverable files
for (int n = 0, len = all.Length; n < len; ++n)
{
BuildReportTool.SizePart b = all[n];
bool isThisFileToBeDeleted = listToDeleteFrom.InSumSelection(b);
if (isThisFileToBeDeleted)
{
if (BuildReportTool.Util.IsFileInBuildReportFolder(b.Name) &&
!BuildReportTool.Util.IsUselessFile(b.Name))
{
//Debug.Log("BRT file? " + b.Name);
--numOfFilesToDelete;
++brtFilesSelectedForDelete;
}
else if (BuildReportTool.Util.HaveToUseSystemForDelete(b.Name))
{
++systemDeletionFileCount;
}
}
}
if (numOfFilesToDelete <= 0)
{
if (brtFilesSelectedForDelete > 0)
{
EditorApplication.Beep();
EditorUtility.DisplayDialog("Can't delete!",
"Take note that for safety, Build Report Tool assets themselves will not be included for deletion.",
"OK");
}
return;
}
// prepare warning message for user
bool deletingSystemFilesOnly = (systemDeletionFileCount == numOfFilesToDelete);
bool deleteIsRecoverable = !deletingSystemFilesOnly;
string plural = "";
if (numOfFilesToDelete > 1)
{
plural = "s";
}
string message;
if (numOfFilesRequestedToDelete != numOfFilesToDelete)
{
message = "Among " + numOfFilesRequestedToDelete + " file" + plural + " requested to be deleted, only " +
numOfFilesToDelete + " will be deleted.";
}
else
{
message = "This will delete " + numOfFilesToDelete + " asset" + plural + " in your project.";
}
// add warning about BRT files that are skipped
if (brtFilesSelectedForDelete > 0)
{
message += "\n\nTake note that for safety, " + brtFilesSelectedForDelete + " file" +
((brtFilesSelectedForDelete > 1) ? "s" : "") +
" found to be Build Report Tool assets are not included for deletion.";
}
// add warning about unrecoverable files
if (systemDeletionFileCount > 0)
{
if (deletingSystemFilesOnly)
{
message += "\n\nThe deleted file" + plural + " will not be recoverable from the " +
BuildReportTool.Util.NameOfOSTrashFolder + ", unless you have your own backup.";
}
else
{
message += "\n\nAmong the " + numOfFilesToDelete + " file" + plural + " for deletion, " +
systemDeletionFileCount + " will not be recoverable from the " +
BuildReportTool.Util.NameOfOSTrashFolder + ", unless you have your own backup.";
}
message +=
"\n\nThis is a limitation in Unity and .NET code. To ensure deleting will move the files to the " +
BuildReportTool.Util.NameOfOSTrashFolder +
" instead, delete your files the usual way using your project view.";
}
else
{
message += "\n\nThe deleted file" + plural + " can be recovered from your " +
BuildReportTool.Util.NameOfOSTrashFolder + ".";
}
message +=
"\n\nDeleting a large number of files may take a long time as Unity will rebuild the project's Library folder.\n\nProceed with deleting?";
EditorApplication.Beep();
if (!EditorUtility.DisplayDialog("Delete?", message, "Yes", "No"))
{
return;
}
List<BuildReportTool.SizePart> allList = new List<BuildReportTool.SizePart>(all);
List<BuildReportTool.SizePart> toRemove = new List<BuildReportTool.SizePart>(all.Length / 4);
// finally, delete the files
int deletedCount = 0;
for (int n = 0, len = allList.Count; n < len; ++n)
{
BuildReportTool.SizePart b = allList[n];
bool okToDelete = BuildReportTool.Util.IsUselessFile(b.Name) ||
!BuildReportTool.Util.IsFileInBuildReportFolder(b.Name);
if (listToDeleteFrom.InSumSelection(b) && okToDelete)
{
// delete this
if (BuildReportTool.Util.ShowFileDeleteProgress(deletedCount, numOfFilesToDelete, b.Name,
deleteIsRecoverable))
{
return;
}
BuildReportTool.Util.DeleteSizePartFile(b);
toRemove.Add(b);
++deletedCount;
}
}
EditorUtility.ClearProgressBar();
// refresh the asset lists
allList.RemoveAll(i => toRemove.Contains(i));
BuildReportTool.SizePart[] allWithRemoved = allList.ToArray();
// recreate per category list (maybe just remove from existing per category lists instead?)
BuildReportTool.SizePart[][] perCategoryOfList =
BuildReportTool.ReportGenerator.SegregateAssetSizesPerCategory(allWithRemoved,
buildReportToDisplay.FileFilters);
listToDeleteFrom.Reinit(allWithRemoved, perCategoryOfList,
IsShowingUsedAssets
? BuildReportTool.Options.NumberOfTopLargestUsedAssetsToShow
: BuildReportTool.Options.NumberOfTopLargestUnusedAssetsToShow);
listToDeleteFrom.ClearSelection();
// print info about the delete operation to console
string finalMessage = string.Format("{0} file{1} removed from your project.", deletedCount.ToString(), plural);
if (deleteIsRecoverable)
{
finalMessage += " They can be recovered from your " + BuildReportTool.Util.NameOfOSTrashFolder + ".";
}
EditorApplication.Beep();
EditorUtility.DisplayDialog("Delete successful", finalMessage, "OK");
Debug.LogWarning(finalMessage);
}
void InitiateDeleteAllUnused(BuildInfo buildReportToDisplay)
{
BuildReportTool.AssetList list = buildReportToDisplay.UnusedAssets;
BuildReportTool.SizePart[] all = list.All;
int filesToDeleteCount = 0;
for (int n = 0, len = all.Length; n < len; ++n)
{
BuildReportTool.SizePart b = all[n];
bool okToDelete = BuildReportTool.Util.IsFileOkForDeleteAllOperation(b.Name);
if (okToDelete)
{
//Debug.Log("added " + b.Name + " for deletion");
++filesToDeleteCount;
}
}
if (filesToDeleteCount == 0)
{
const string NOTHING_TO_DELETE =
"Take note that for safety, Build Report Tool assets, Unity editor assets, version control metadata, and Unix-style hidden files will not be included for deletion.\n\nYou can force deleting them by selecting them (via the checkbox) and using \"Delete selected\", or simply delete them the normal way in your project view.";
EditorApplication.Beep();
EditorUtility.DisplayDialog("Nothing to delete!", NOTHING_TO_DELETE, "Ok");
return;
}
string plural = "";
if (filesToDeleteCount > 1)
{
plural = "s";
}
EditorApplication.Beep();
if (!EditorUtility.DisplayDialog("Delete?",
string.Format(
"Among {0} file{1} in your project, {2} will be deleted.\n\nBuild Report Tool assets themselves, Unity editor assets, version control metadata, and Unix-style hidden files will not be included for deletion. You can force-delete those by selecting them (via the checkbox) and use \"Delete selected\", or simply delete them the normal way in your project view.\n\nDeleting a large number of files may take a long time as Unity will rebuild the project's Library folder.\n\nAre you sure about this?\n\nThe file{1} can be recovered from your {3}.",
all.Length.ToString(), plural, filesToDeleteCount.ToString(),
BuildReportTool.Util.NameOfOSTrashFolder), "Yes", "No"))
{
return;
}
List<BuildReportTool.SizePart> newAll = new List<BuildReportTool.SizePart>();
int deletedCount = 0;
for (int n = 0, len = all.Length; n < len; ++n)
{
BuildReportTool.SizePart b = all[n];
bool okToDelete = BuildReportTool.Util.IsFileOkForDeleteAllOperation(b.Name);
if (okToDelete)
{
// delete this
if (BuildReportTool.Util.ShowFileDeleteProgress(deletedCount, filesToDeleteCount, b.Name, true))
{
return;
}
BuildReportTool.Util.DeleteSizePartFile(b);
++deletedCount;
}
else
{
//Debug.Log("added " + b.Name + " to new list");
newAll.Add(b);
}
}
EditorUtility.ClearProgressBar();
BuildReportTool.SizePart[] newAllArr = newAll.ToArray();
BuildReportTool.SizePart[][] perCategoryUnused =
BuildReportTool.ReportGenerator.SegregateAssetSizesPerCategory(newAllArr, buildReportToDisplay.FileFilters);
list.Reinit(newAllArr, perCategoryUnused,
IsShowingUsedAssets
? BuildReportTool.Options.NumberOfTopLargestUsedAssetsToShow
: BuildReportTool.Options.NumberOfTopLargestUnusedAssetsToShow);
list.ClearSelection();
string finalMessage = string.Format(
"{0} file{1} removed from your project. They can be recovered from your {2}.",
filesToDeleteCount.ToString(), plural, BuildReportTool.Util.NameOfOSTrashFolder);
Debug.LogWarning(finalMessage);
EditorApplication.Beep();
EditorUtility.DisplayDialog("Delete successful", finalMessage, "OK");
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: efebaeab01dc93649b337f28445f59cf
timeCreated: 1558438027
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using FuzzyString;
namespace BuildReportTool.Window.Screen
{
public partial class AssetList
{
BuildReportTool.SizePart[] _searchResults;
const double SEARCH_DELAY = 0.75f;
double _lastSearchTime;
string _lastSearchText = string.Empty;
string _searchTextInput = string.Empty;
int _searchViewOffset;
bool _showSearchOptions;
Rect _searchTextfieldRect;
// Search algorithms that will weigh in for the comparison
readonly FuzzyStringComparisonOptions[] _searchOptions =
{
FuzzyStringComparisonOptions.UseOverlapCoefficient,
FuzzyStringComparisonOptions.UseLongestCommonSubsequence,
FuzzyStringComparisonOptions.UseLongestCommonSubstring
};
void ClearSearch()
{
_searchTextInput = "";
_lastSearchText = null;
_searchResults = null;
}
void UpdateSearch(double timeNow, BuildInfo buildReportToDisplay)
{
if (string.IsNullOrEmpty(_searchTextInput) && !string.IsNullOrEmpty(_lastSearchText))
{
// cancel search
ClearSearch();
if (buildReportToDisplay != null)
{
buildReportToDisplay.FlagOkToRefresh();
}
_searchViewOffset = 0;
}
else if ((timeNow - _lastSearchTime >= SEARCH_DELAY) &&
!_searchTextInput.Equals(_lastSearchText, StringComparison.Ordinal))
{
UpdateSearchNow(buildReportToDisplay);
_lastSearchTime = timeNow;
}
}
public void UpdateSearchNow(BuildInfo buildReportToDisplay)
{
if (string.IsNullOrEmpty(_searchTextInput))
{
return;
}
// update search
_lastSearchText = _searchTextInput;
_lastSearchTime = EditorApplication.timeSinceStartup;
if (buildReportToDisplay != null)
{
Search(_lastSearchText, BuildReportTool.Options.SearchType, BuildReportTool.Options.SearchFilenameOnly, BuildReportTool.Options.SearchCaseSensitive, buildReportToDisplay);
buildReportToDisplay.FlagOkToRefresh();
}
_searchViewOffset = 0;
_currentSortType = BuildReportTool.AssetList.SortType.None;
}
void Search(string searchText, SearchType searchType, bool searchFilenameOnly, bool caseSensitive, BuildInfo buildReportToDisplay)
{
if (string.IsNullOrEmpty(searchText))
{
_searchResults = null;
return;
}
BuildReportTool.AssetList list = GetAssetListToDisplay(buildReportToDisplay);
BuildReportTool.FileFilterGroup filter = buildReportToDisplay.FileFilters;
if (BuildReportTool.Options.ShouldUseConfiguredFileFilters())
{
filter = _configuredFileFilterGroup;
}
List<BuildReportTool.SizePart> searchResults = new List<BuildReportTool.SizePart>();
BuildReportTool.SizePart[] assetListToSearchFrom = list.GetListToDisplay(filter);
var options = caseSensitive ? System.Text.RegularExpressions.RegexOptions.None : System.Text.RegularExpressions.RegexOptions.IgnoreCase;
for (int n = 0; n < assetListToSearchFrom.Length; ++n)
{
string input;
if (searchFilenameOnly)
{
input = assetListToSearchFrom[n].Name.GetFileNameOnly();
}
else
{
input = assetListToSearchFrom[n].Name;
}
bool assetIsMatch;
if (string.IsNullOrEmpty(input))
{
assetIsMatch = false;
}
else
{
switch (searchType)
{
case SearchType.Regex:
try
{
assetIsMatch = System.Text.RegularExpressions.Regex.IsMatch(input, searchText, options);
}
catch (ArgumentException)
{
assetIsMatch = false;
}
break;
case SearchType.Fuzzy:
assetIsMatch = IsANearStringMatch(input, searchText);
break;
default:
// default is SearchType.Basic
assetIsMatch = System.Text.RegularExpressions.Regex.IsMatch(input, BuildReportTool.Util.WildCardToRegex(searchText), options);
break;
}
}
if (assetIsMatch)
{
searchResults.Add(assetListToSearchFrom[n]);
}
}
if (searchResults.Count > 0)
{
searchResults.Sort((a, b) =>
GetFuzzyEqualityScore(searchText, a.Name).CompareTo(GetFuzzyEqualityScore(searchText, b.Name)));
}
_searchResults = searchResults.ToArray();
}
void SortBySearchRank(BuildReportTool.SizePart[] assetList, string searchText)
{
if (assetList.Length <= 0)
{
return;
}
System.Array.Sort(assetList, (entry1, entry2) =>
GetFuzzyEqualityScore(searchText, entry1.Name)
.CompareTo(GetFuzzyEqualityScore(searchText, entry2.Name)));
}
bool IsANearStringMatch(string source, string target)
{
if (string.IsNullOrEmpty(target))
{
return false;
}
// Choose the relative strength of the comparison - is it almost exactly equal? or is it just close?
const FuzzyStringComparisonTolerance TOLERANCE = FuzzyStringComparisonTolerance.Strong;
// Get a boolean determination of approximate equality
return source.ApproximatelyEquals(target, TOLERANCE, _searchOptions);
}
double GetFuzzyEqualityScore(string source, string target)
{
if (string.IsNullOrEmpty(target))
{
return 0;
}
return source.GetFuzzyEqualityScore(target, _searchOptions);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ff62cfa86a1e48b4a8e515cf84089be5
timeCreated: 1558436086
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using UnityEngine;
namespace BuildReportTool.Window.Screen
{
public abstract class BaseScreen
{
public abstract string Name { get; }
public abstract void RefreshData(BuildInfo buildReport, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData, UnityBuildReport unityBuildReport);
public abstract void DrawGUI(Rect position,
BuildInfo buildReportToDisplay, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData,
UnityBuildReport unityBuildReport, BuildReportTool.ExtraData extraData,
out bool requestRepaint);
public virtual void Update(double timeNow, double deltaTime, BuildInfo buildReportToDisplay,
AssetDependencies assetDependencies)
{
}
protected void DrawCentralMessage(Rect position, string msg)
{
float w = 300;
float h = 100;
float x = (position.width - w) * 0.5f;
float y = (position.height - h) * 0.35f;
GUI.Label(new Rect(x, y, w, h), msg);
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0c71aee836c3a1f4cb66debe8a94495d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9f63c3db014dad04a8a0b65ae2ac44e3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca162eceac09e3a40942072a422784ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,65 @@
using UnityEngine;
namespace BuildReportTool.Window.Screen
{
public class ExtraData : BaseScreen
{
Vector2 _scrollPos = Vector2.zero;
public override string Name
{
get { return Labels.EXTRA_DATA_CATEGORY_LABEL; }
}
public override void RefreshData(BuildInfo buildReport, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData, UnityBuildReport unityBuildReport)
{
}
public override void DrawGUI(Rect position,
BuildInfo buildReportToDisplay, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData,
UnityBuildReport unityBuildReport, BuildReportTool.ExtraData extraData,
out bool requestRepaint)
{
if (buildReportToDisplay == null || string.IsNullOrEmpty(extraData.Contents))
{
requestRepaint = false;
return;
}
requestRepaint = false;
var textStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.SETTING_VALUE_STYLE_NAME);
if (textStyle == null)
{
textStyle = GUI.skin.label;
}
GUILayout.Space(2); // top padding for scrollbar
_scrollPos = GUILayout.BeginScrollView(_scrollPos);
GUILayout.BeginHorizontal();
GUILayout.Space(10); // extra left padding
GUILayout.BeginVertical();
GUILayout.Space(10); // top padding
GUILayout.Label(extraData.Contents, textStyle);
GUILayout.Space(10); // bottom padding
GUILayout.EndVertical();
GUILayout.Space(20); // extra right padding
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e7327b12fdfe098469e599f517b20202
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,153 @@
using UnityEngine;
using UnityEditor;
namespace BuildReportTool.Window.Screen
{
public class Help : BaseScreen
{
public override string Name
{
get { return Labels.HELP_CATEGORY_LABEL; }
}
const int LABEL_LENGTH = 16000;
public override void RefreshData(BuildInfo buildReport, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData, UnityBuildReport unityBuildReport)
{
const string README_FILENAME = "README.txt";
string readmeContents = BuildReportTool.Util.GetPackageFileContents(README_FILENAME);
const string CHANGELOG_FILENAME = "VERSION.txt";
string changelogContents = BuildReportTool.Util.GetPackageFileContents(CHANGELOG_FILENAME);
if (!string.IsNullOrEmpty(readmeContents) && readmeContents.Length > LABEL_LENGTH)
{
readmeContents = readmeContents.Substring(0, LABEL_LENGTH);
}
if (!string.IsNullOrEmpty(changelogContents) && changelogContents.Length > LABEL_LENGTH)
{
changelogContents = changelogContents.Substring(0, LABEL_LENGTH);
}
if (_readmeGuiContent == null)
{
_readmeGuiContent = new GUIContent();
}
if (!string.IsNullOrEmpty(readmeContents))
{
_readmeGuiContent.text = readmeContents;
}
else
{
_readmeGuiContent.text = "README.txt not found";
}
_needToUpdateReadmeHeight = true;
if (_changelogGuiContent == null)
{
_changelogGuiContent = new GUIContent();
}
if (!string.IsNullOrEmpty(changelogContents))
{
_changelogGuiContent.text = changelogContents;
}
else
{
_changelogGuiContent.text = "VERSION.txt not found";
}
_needToUpdateChangelogHeight = true;
}
static readonly GUILayoutOption[] ButtonsLayout = { GUILayout.Width(230), GUILayout.Height(60) };
public override void DrawGUI(Rect position,
BuildInfo buildReportToDisplay, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData,
UnityBuildReport unityBuildReport, BuildReportTool.ExtraData extraData,
out bool requestRepaint)
{
requestRepaint = false;
var helpTextStyle = GUI.skin.FindStyle(HELP_CONTENT_GUI_STYLE);
if (helpTextStyle == null)
{
helpTextStyle = GUI.skin.label;
}
if (_needToUpdateReadmeHeight)
{
_readmeHeight = helpTextStyle.CalcHeight(_readmeGuiContent, HELP_CONTENT_WIDTH);
_needToUpdateReadmeHeight = false;
}
if (_needToUpdateChangelogHeight)
{
_changelogHeight = helpTextStyle.CalcHeight(_changelogGuiContent, HELP_CONTENT_WIDTH);
_needToUpdateChangelogHeight = false;
}
GUI.SetNextControlName("BRT_HelpUnfocuser");
GUI.TextField(new Rect(-100, -100, 10, 10), "");
GUILayout.Space(10); // extra top padding
GUILayout.BeginHorizontal();
int newSelectedHelpIdx = GUILayout.SelectionGrid(_selectedHelpContentsIdx, _helpTypeLabels, 1, ButtonsLayout);
if (newSelectedHelpIdx != _selectedHelpContentsIdx)
{
GUI.FocusControl("BRT_HelpUnfocuser");
}
_selectedHelpContentsIdx = newSelectedHelpIdx;
//GUILayout.Space((position.width - HELP_CONTENT_WIDTH) * 0.5f);
if (_selectedHelpContentsIdx == HELP_TYPE_README_IDX)
{
_readmeScrollPos = GUILayout.BeginScrollView(
_readmeScrollPos);
EditorGUILayout.SelectableLabel(_readmeGuiContent.text, helpTextStyle,
GUILayout.Width(HELP_CONTENT_WIDTH), GUILayout.Height(_readmeHeight));
GUILayout.EndScrollView();
}
else if (_selectedHelpContentsIdx == HELP_TYPE_CHANGELOG_IDX)
{
_changelogScrollPos = GUILayout.BeginScrollView(
_changelogScrollPos);
EditorGUILayout.SelectableLabel(_changelogGuiContent.text, helpTextStyle,
GUILayout.Width(HELP_CONTENT_WIDTH), GUILayout.Height(_changelogHeight));
GUILayout.EndScrollView();
}
GUILayout.EndHorizontal();
}
int _selectedHelpContentsIdx;
const int HELP_TYPE_README_IDX = 0;
const int HELP_TYPE_CHANGELOG_IDX = 1;
const string HELP_CONTENT_GUI_STYLE = "label";
const int HELP_CONTENT_WIDTH = 500;
readonly string[] _helpTypeLabels = {"Help (README)", "Version Changelog"};
Vector2 _readmeScrollPos;
float _readmeHeight;
bool _needToUpdateReadmeHeight;
Vector2 _changelogScrollPos;
float _changelogHeight;
bool _needToUpdateChangelogHeight;
GUIContent _readmeGuiContent;
GUIContent _changelogGuiContent;
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cc69ea23bc7ed484cb7609b6e3779145
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a070a9f986a60664c8dd6e5beb865cd8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,706 @@
using System.Globalization;
using UnityEngine;
using UnityEditor;
namespace BuildReportTool.Window.Screen
{
public class Overview : BaseScreen
{
Vector2 _scrollPos = Vector2.zero;
bool _showTopUsed;
bool _showTopUnused;
int _assetUsedEntryHoveredIdx = -1;
int _assetUnusedEntryHoveredIdx = -1;
bool _shouldShowThumbnailOnHoveredAsset;
public override string Name
{
get { return Labels.OVERVIEW_CATEGORY_LABEL; }
}
public override void RefreshData(BuildInfo buildReport, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData, UnityBuildReport unityBuildReport)
{
}
public override void DrawGUI(Rect position,
BuildInfo buildReportToDisplay, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData,
UnityBuildReport unityBuildReport, BuildReportTool.ExtraData extraData,
out bool requestRepaint)
{
if (buildReportToDisplay == null)
{
requestRepaint = false;
return;
}
var titleStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.MAIN_TITLE_STYLE_NAME);
if (titleStyle == null)
{
titleStyle = GUI.skin.label;
}
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
var bigValueStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
if (bigValueStyle == null)
{
bigValueStyle = GUI.skin.label;
}
var bigNumberStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
if (bigNumberStyle == null)
{
bigNumberStyle = GUI.skin.label;
}
var smallLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.SETTING_NAME_STYLE_NAME);
if (smallLabelStyle == null)
{
smallLabelStyle = GUI.skin.label;
}
var smallValueStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.SETTING_VALUE_STYLE_NAME);
if (smallValueStyle == null)
{
smallValueStyle = GUI.skin.label;
}
var helpDescriptionStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.TINY_HELP_STYLE_NAME);
if (helpDescriptionStyle == null)
{
helpDescriptionStyle = GUI.skin.label;
}
var infoDescriptionStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TEXT_STYLE_NAME);
if (infoDescriptionStyle == null)
{
infoDescriptionStyle = GUI.skin.label;
}
GUILayout.Space(2); // top padding for scrollbar
_scrollPos = GUILayout.BeginScrollView(_scrollPos);
GUILayout.BeginHorizontal();
GUILayout.Space(10); // extra left padding
GUILayout.BeginVertical();
GUILayout.Space(10); // top padding
// report title
GUILayout.Label(buildReportToDisplay.SuitableTitle, titleStyle);
GUILayout.Space(10);
// two-column layout
GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
// 1st column
GUILayout.BeginVertical(GUILayout.MaxWidth(350));
GUILayout.Label(Labels.TIME_OF_BUILD_LABEL, bigLabelStyle);
GUILayout.Label(buildReportToDisplay.GetTimeReadable(), bigValueStyle);
GUILayout.Space(10);
GUILayout.Label("Project building took:", bigLabelStyle);
GUILayout.Label("How long the project building took. This is the time between <b>OnPreprocessBuild</b> and <b>OnPostprocessBuild</b>.", helpDescriptionStyle);
GUILayout.Label(buildReportToDisplay.BuildDurationTime.ToString(), bigValueStyle);
GUILayout.Space(10);
GUILayout.Label("Report generation took:", bigLabelStyle);
GUILayout.Label("How long the Build Report Generation took.", helpDescriptionStyle);
GUILayout.Label(buildReportToDisplay.ReportGenerationTime.ToString(), bigValueStyle);
if (!string.IsNullOrEmpty(buildReportToDisplay.TotalBuildSize) &&
!string.IsNullOrEmpty(buildReportToDisplay.BuildFilePath))
{
GUILayout.Space(10);
GUILayout.BeginVertical();
GUILayout.Label(Labels.BUILD_TOTAL_SIZE_LABEL, bigLabelStyle);
GUILayout.Label(BuildReportTool.Util.GetBuildSizePathDescription(buildReportToDisplay), helpDescriptionStyle);
GUILayout.Label(buildReportToDisplay.TotalBuildSize, bigNumberStyle);
GUILayout.EndVertical();
}
GUILayout.Space(20);
string emphasisColor = "black";
if (EditorGUIUtility.isProSkin || BRT_BuildReportWindow.FORCE_USE_DARK_SKIN)
{
emphasisColor = "white";
}
string largestAssetCategoryLabel = string.Format(
"<color={0}><size=20><b>{1}</b></size></color> are the largest,\ntaking up <color={0}><size=20><b>{2}%</b></size></color> of the build{3}",
emphasisColor, buildReportToDisplay.BuildSizes[0].Name,
buildReportToDisplay.BuildSizes[0].Percentage.ToString(CultureInfo.InvariantCulture),
(!buildReportToDisplay.HasStreamingAssets
? "\n<size=12>(not counting streaming assets)</size>"
: ""));
GUILayout.Label(largestAssetCategoryLabel, infoDescriptionStyle);
GUILayout.Space(20);
GUILayout.EndVertical();
GUILayout.Space(20);
// 2nd column
GUILayout.BeginVertical(GUILayout.MaxWidth(250));
GUILayout.Label("Made for:", bigLabelStyle);
GUILayout.Label(buildReportToDisplay.BuildType, bigValueStyle);
GUILayout.Space(10);
GUILayout.Label("Built in:", bigLabelStyle);
GUILayout.Label(buildReportToDisplay.UnityVersionDisplayed, bigValueStyle);
GUILayout.EndVertical();
DrawScenesInBuild(buildReportToDisplay.ScenesInBuild);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
var numberOfTopUsed =
buildReportToDisplay.HasUsedAssets ? buildReportToDisplay.UsedAssets.NumberOfTopLargest : 0;
var numberOfTopUnused = buildReportToDisplay.HasUnusedAssets
? buildReportToDisplay.UnusedAssets.NumberOfTopLargest
: 0;
if (Event.current.type == EventType.Layout)
{
_showTopUsed = numberOfTopUsed > 0 && buildReportToDisplay.UsedAssets.TopLargest != null;
_showTopUnused = numberOfTopUnused > 0 && buildReportToDisplay.UnusedAssets.TopLargest != null;
}
// 1st column
GUILayout.BeginVertical();
if (_showTopUsed)
{
GUILayout.Label(string.Format("Top {0} largest in build:", numberOfTopUsed.ToString()),
bigLabelStyle);
GUILayout.Space(4);
if (!BuildReportTool.Options.AutoResortAssetsWhenUnityEditorRegainsFocus &&
GUILayout.Button("Refresh", GUILayout.Height(20), GUILayout.MaxWidth(520)))
{
buildReportToDisplay.RecategorizeUsedAssets();
buildReportToDisplay.FlagOkToRefresh();
}
DrawAssetList(buildReportToDisplay.UsedAssets, true, buildReportToDisplay, assetDependencies);
}
GUILayout.EndVertical();
GUILayout.Space(50);
// 2nd column
GUILayout.BeginVertical();
if (_showTopUnused)
{
GUILayout.Label(string.Format("Top {0} largest not in build:", numberOfTopUnused.ToString()),
bigLabelStyle);
GUILayout.Space(4);
if (!BuildReportTool.Options.AutoResortAssetsWhenUnityEditorRegainsFocus &&
GUILayout.Button("Refresh", GUILayout.Height(20), GUILayout.MaxWidth(520)))
{
buildReportToDisplay.RecategorizeUnusedAssets();
buildReportToDisplay.FlagOkToRefresh();
}
DrawAssetList(buildReportToDisplay.UnusedAssets, false, buildReportToDisplay, assetDependencies);
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.Space(20);
if (assetDependencies != null && !string.IsNullOrEmpty(assetDependencies.SavedPath))
{
GUILayout.Label("Asset Dependencies file used:", smallLabelStyle);
GUILayout.Label(assetDependencies.SavedPath, smallValueStyle);
GUILayout.Space(10);
}
if (textureData != null && !string.IsNullOrEmpty(textureData.SavedPath))
{
GUILayout.Label("Texture Data file used:", smallLabelStyle);
GUILayout.Label(textureData.SavedPath, smallValueStyle);
GUILayout.Space(10);
}
if (unityBuildReport != null && !string.IsNullOrEmpty(unityBuildReport.SavedPath))
{
GUILayout.Label("Additional Unity Build Report file used:", smallLabelStyle);
GUILayout.Label(unityBuildReport.SavedPath, smallValueStyle);
GUILayout.Space(10);
}
if (!string.IsNullOrEmpty(extraData.Contents))
{
GUILayout.Label("Extra Data file used:", smallLabelStyle);
GUILayout.Label(extraData.SavedPath, smallValueStyle);
GUILayout.Space(10);
}
GUILayout.Space(20);
GUILayout.EndVertical();
GUILayout.Space(20); // extra right padding
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
// ------------------------------------------------------
// Continually request repaint, since we need to check the rects
// generated by the GUILayout (using GUILayoutUtility.GetLastRect())
// to make the hover checks work. That's because GetLastRect() only
// works during repaint event.
//
// Later checks below can set requestRepaint to false if there's no
// need to repaint, to help lessen cpu usage.
requestRepaint = true;
if (Event.current.mousePosition.y >= position.height ||
Event.current.mousePosition.y <= 0 ||
Event.current.mousePosition.x <= 0 ||
Event.current.mousePosition.x >= position.width)
{
// mouse is outside the window, no need to repaint, can't show tooltip anyway
// set requestRepaint to false to help lessen cpu usage
requestRepaint = false;
}
var showThumbnailNow = BuildReportTool.Options.ShowTooltipThumbnail &&
_shouldShowThumbnailOnHoveredAsset &&
(_assetUsedEntryHoveredIdx != -1 || _assetUnusedEntryHoveredIdx != -1);
var zoomInChanged = false;
if (showThumbnailNow)
{
var prevZoomedIn = BRT_BuildReportWindow.ZoomedInThumbnails;
// if thumbnail is currently showing, we process the inputs
// (ctrl zooms in on thumbnail, alt toggles alpha blend)
BRT_BuildReportWindow.ProcessThumbnailControls();
if (prevZoomedIn != BRT_BuildReportWindow.ZoomedInThumbnails)
{
zoomInChanged = true;
}
}
else
{
// no thumbnail currently shown. ensure the controls that
// need to be reset to initial state are reset
BRT_BuildReportWindow.ResetThumbnailControls();
}
if (!zoomInChanged && !Event.current.alt &&
!BRT_BuildReportWindow.MouseMovedNow && !BRT_BuildReportWindow.LastMouseMoved)
{
// mouse hasn't moved, and no request to zoom-in thumbnail or toggle thumbnail alpha
// no need to repaint because nothing has changed
// set requestRepaint to false to help lessen cpu usage
requestRepaint = false;
}
var shouldShowAssetEndUsersTooltipNow = BuildReportTool.Options.ShowAssetPrimaryUsersInTooltipIfAvailable &&
BRT_BuildReportWindow.ShouldHoveredAssetShowEndUserTooltip(
assetDependencies) &&
(_assetUsedEntryHoveredIdx != -1 || _assetUnusedEntryHoveredIdx != -1);
if (Event.current.type == EventType.Repaint)
{
if (showThumbnailNow && shouldShowAssetEndUsersTooltipNow)
{
// draw thumbnail and end users below it
BRT_BuildReportWindow.DrawThumbnailEndUsersTooltip(position, assetDependencies, textureData);
}
else if (shouldShowAssetEndUsersTooltipNow)
{
// draw only end users in tooltip
BRT_BuildReportWindow.DrawEndUsersTooltip(position, assetDependencies);
}
else if (showThumbnailNow)
{
// draw only thumbnail in tooltip
BRT_BuildReportWindow.DrawThumbnailTooltip(position, textureData);
}
}
}
void DrawAssetList(BuildReportTool.AssetList assetList, bool usedAssets, BuildInfo buildReportToDisplay,
AssetDependencies assetDependencies)
{
if (assetList == null || assetList.TopLargest == null)
{
//Debug.LogError("no top ten largest");
return;
}
BuildReportTool.SizePart[] assetsToShow = assetList.TopLargest;
if (assetsToShow == null)
{
//Debug.LogError("no top ten largest");
return;
}
var listNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME);
if (listNormalStyle == null)
{
listNormalStyle = GUI.skin.label;
}
var listAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME);
if (listAltStyle == null)
{
listAltStyle = GUI.skin.label;
}
var listIconNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_ICON_STYLE_NAME);
if (listIconNormalStyle == null)
{
listIconNormalStyle = GUI.skin.label;
}
var listIconAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_ICON_ALT_STYLE_NAME);
if (listIconAltStyle == null)
{
listIconAltStyle = GUI.skin.label;
}
var iconHoveredStyle = GUI.skin.FindStyle("IconHovered");
if (iconHoveredStyle == null)
{
iconHoveredStyle = GUI.skin.label;
}
bool useAlt = true;
var newEntryHoveredIdx = -1;
BuildReportTool.SizePart newEntryHovered = null;
Rect newEntryHoveredRect = new Rect();
Rect iconRect = new Rect();
var hoveringOverIcon = false;
//var hoveringOverLabel = false;
GUILayout.BeginHorizontal();
// 1st column: name
GUILayout.BeginVertical();
for (int n = 0; n < assetsToShow.Length; ++n)
{
BuildReportTool.SizePart b = assetsToShow[n];
var styleToUse = useAlt ? listAltStyle : listNormalStyle;
var iconStyleToUse = useAlt ? listIconAltStyle : listIconNormalStyle;
if (styleToUse == null)
{
styleToUse = GUI.skin.label;
}
if (iconStyleToUse == null)
{
iconStyleToUse = GUI.skin.label;
}
Texture icon = AssetDatabase.GetCachedIcon(b.Name);
GUILayout.BeginHorizontal();
if (icon == null)
{
// no icon, just add space so it aligns with the other entries
GUILayout.Label(string.Empty, iconStyleToUse, BRT_BuildReportWindow.Layout28x30);
}
else
{
GUILayout.Button(icon, iconStyleToUse, BRT_BuildReportWindow.Layout28x30);
}
if (Event.current.type == EventType.Repaint)
{
iconRect = GUILayoutUtility.GetLastRect();
// if mouse is hovering over asset entry's icon (not the label)
// draw a border on the asset icon
if (iconRect.Contains(Event.current.mousePosition))
{
hoveringOverIcon = true;
newEntryHoveredIdx = n;
newEntryHovered = b;
newEntryHoveredRect = iconRect;
GUI.Box(iconRect, icon, iconHoveredStyle);
}
}
string prettyName = string.Format(" {0}. {1}", (n + 1).ToString(), BuildReportTool.Util.GetAssetFilename(b.Name));
if (GUILayout.Button(prettyName, styleToUse, BRT_BuildReportWindow.Layout100To400x30))
{
Utility.PingAssetInProject(b.Name);
}
if (newEntryHoveredIdx == -1 && Event.current.type == EventType.Repaint)
{
var labelRect = GUILayoutUtility.GetLastRect();
// if mouse is hovering over asset entry's label
// draw a border on the asset icon
if (labelRect.Contains(Event.current.mousePosition))
{
//hoveringOverLabel = true;
newEntryHoveredIdx = n;
newEntryHovered = b;
newEntryHoveredRect = labelRect;
GUI.Box(iconRect, icon, iconHoveredStyle);
}
}
GUILayout.EndHorizontal();
useAlt = !useAlt;
}
GUILayout.EndVertical();
if (Event.current.type == EventType.Repaint)
{
if (usedAssets)
{
_assetUsedEntryHoveredIdx = newEntryHoveredIdx;
}
else
{
_assetUnusedEntryHoveredIdx = newEntryHoveredIdx;
}
if (newEntryHoveredIdx != -1)
{
string hoveredAssetPath = newEntryHovered != null ? newEntryHovered.Name : null;
// ----------------
// update what is considered the hovered asset, for use later on
// when the tooltip will be drawn
BRT_BuildReportWindow.UpdateHoveredAsset(hoveredAssetPath, newEntryHoveredRect,
usedAssets, buildReportToDisplay, assetDependencies);
// ----------------
// if mouse is hovering over the correct area, we signify that
// the tooltip thumbnail should be drawn
if (BuildReportTool.Options.ShowTooltipThumbnail &&
(BuildReportTool.Options.ShowThumbnailOnHoverLabelToo || hoveringOverIcon) &&
BRT_BuildReportWindow.GetAssetPreview(hoveredAssetPath) != null)
{
_shouldShowThumbnailOnHoveredAsset = true;
}
else
{
_shouldShowThumbnailOnHoveredAsset = false;
}
}
}
// 2nd column: size
var useRawSize = (usedAssets && !BuildReportTool.Options.ShowImportedSizeForUsedAssets) || !usedAssets;
useAlt = true;
GUILayout.BeginVertical();
for (int n = 0; n < assetsToShow.Length; ++n)
{
BuildReportTool.SizePart b = assetsToShow[n];
var styleToUse = useAlt ? listAltStyle : listNormalStyle;
GUILayout.Label(useRawSize ? b.RawSize : b.ImportedSize, styleToUse, BRT_BuildReportWindow.LayoutTo100x30);
useAlt = !useAlt;
}
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
void DrawScenesInBuild(BuildReportTool.BuildInfo.SceneInBuild[] scenesInBuild)
{
if (scenesInBuild == null || scenesInBuild.Length == 0)
{
//Debug.LogError("no top ten largest");
return;
}
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
var listNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME);
if (listNormalStyle == null)
{
listNormalStyle = GUI.skin.label;
}
var listAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME);
if (listAltStyle == null)
{
listAltStyle = GUI.skin.label;
}
var listIconNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_ICON_STYLE_NAME);
if (listIconNormalStyle == null)
{
listIconNormalStyle = GUI.skin.label;
}
var listIconAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_ICON_ALT_STYLE_NAME);
if (listIconAltStyle == null)
{
listIconAltStyle = GUI.skin.label;
}
bool useAlt = true;
GUILayout.BeginVertical(BRT_BuildReportWindow.LayoutExpandWidth);
GUILayout.Label("Scenes in Build:", bigLabelStyle);
var prevColor = GUI.contentColor;
//GUILayout.BeginHorizontal();
// 1st column: name
GUILayout.BeginVertical(BRT_BuildReportWindow.LayoutExpandWidth);
var usedIdx = -1;
for (int n = 0; n < scenesInBuild.Length; ++n)
{
if (scenesInBuild[n].Enabled)
{
++usedIdx;
}
var styleToUse = useAlt ? listAltStyle : listNormalStyle;
var iconStyleToUse = useAlt ? listIconAltStyle : listIconNormalStyle;
Texture icon = AssetDatabase.GetCachedIcon(scenesInBuild[n].Path);
GUILayout.BeginHorizontal(styleToUse, BRT_BuildReportWindow.LayoutExpandWidth);
// enabled status
//GUILayout.Toggle(scenesInBuild[n].Enabled, string.Empty, GUILayout.Width(20), GUILayout.Height(30));
// icon
if (icon == null)
{
//GUILayout.Space(22);
GUILayout.Label(string.Empty, iconStyleToUse, BRT_BuildReportWindow.Layout28x30);
}
else
{
if (!scenesInBuild[n].Enabled)
{
GUI.contentColor = new Color(1.0f, 1.0f, 1.0f, 0.4f);
}
GUILayout.Button(icon, iconStyleToUse, BRT_BuildReportWindow.Layout28x30);
if (!scenesInBuild[n].Enabled)
{
GUI.contentColor = prevColor;
}
}
// scene index
if (scenesInBuild[n].Enabled)
{
if (GUILayout.Button(usedIdx.ToString(), styleToUse, BRT_BuildReportWindow.Layout20x30))
{
Utility.PingAssetInProject(scenesInBuild[n].Path);
}
}
else
{
GUILayout.Label(string.Empty, iconStyleToUse, BRT_BuildReportWindow.Layout20x30);
}
// path
string prettyName;
if (string.IsNullOrEmpty(scenesInBuild[n].Path))
{
prettyName = string.Format("<color=#{0}><i>Missing</i></color>",
BuildReportTool.Window.Screen.AssetList.GetPathColor(false));
}
else
{
var pathName = BuildReportTool.Util.GetAssetPath(scenesInBuild[n].Path);
var fileName = scenesInBuild[n].Path.GetFileNameOnly();
if (scenesInBuild[n].Enabled)
{
prettyName = string.Format("<color=#{0}>{1}</color><b>{2}</b>",
BuildReportTool.Window.Screen.AssetList.GetPathColor(false),
pathName, fileName);
}
else
{
prettyName = string.Format("<color=#{0}>{1}<b>{2}</b></color>",
BuildReportTool.Window.Screen.AssetList.GetPathColor(false),
pathName, fileName);
}
}
if (GUILayout.Button(prettyName, styleToUse, BRT_BuildReportWindow.Layout100x30))
{
Utility.PingAssetInProject(scenesInBuild[n].Path);
}
GUILayout.EndHorizontal();
useAlt = !useAlt;
}
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
//GUILayout.EndHorizontal();
GUILayout.Space(5); // bottom padding
GUILayout.EndVertical();
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b2dde6e05918e124c9bfb66365e31e49
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

View File

@@ -0,0 +1,489 @@
using System.Globalization;
using UnityEngine;
namespace BuildReportTool.Window.Screen
{
public class SizeStats : BaseScreen
{
public override string Name
{
get { return Labels.SIZE_STATS_CATEGORY_LABEL; }
}
public override void RefreshData(BuildInfo buildReport, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData, UnityBuildReport unityBuildReport)
{
}
Vector2 _assetListScrollPos;
bool _hasTotalBuildSize;
bool _hasUsedAssetsTotalSize;
bool _hasBuildSizes;
bool _hasCompressedBuildSize;
bool _hasMonoDLLsToDisplay;
bool _hasUnityEngineDLLsToDisplay;
bool _hasScriptDLLsToDisplay;
public override void DrawGUI(Rect position,
BuildInfo buildReportToDisplay, AssetDependencies assetDependencies,
TextureData textureData, MeshData meshData, PrefabData prefabData,
UnityBuildReport unityBuildReport, BuildReportTool.ExtraData extraData,
out bool requestRepaint)
{
if (buildReportToDisplay == null)
{
requestRepaint = false;
return;
}
requestRepaint = false;
if (Event.current.type == EventType.Layout)
{
_hasTotalBuildSize = !string.IsNullOrEmpty(buildReportToDisplay.TotalBuildSize) &&
!string.IsNullOrEmpty(buildReportToDisplay.BuildFilePath);
_hasUsedAssetsTotalSize = !string.IsNullOrEmpty(buildReportToDisplay.UsedTotalSize);
_hasCompressedBuildSize = !string.IsNullOrEmpty(buildReportToDisplay.CompressedBuildSize);
_hasBuildSizes = buildReportToDisplay.BuildSizes != null;
_hasMonoDLLsToDisplay = buildReportToDisplay.MonoDLLs != null && buildReportToDisplay.MonoDLLs.Length > 0;
_hasUnityEngineDLLsToDisplay = buildReportToDisplay.UnityEngineDLLs != null &&
buildReportToDisplay.UnityEngineDLLs.Length > 0;
_hasScriptDLLsToDisplay =
buildReportToDisplay.ScriptDLLs != null && buildReportToDisplay.ScriptDLLs.Length > 0;
}
GUILayout.Space(2); // top padding for scrollbar
_assetListScrollPos = GUILayout.BeginScrollView(_assetListScrollPos);
GUILayout.Space(10); // top padding for content
GUILayout.BeginHorizontal();
GUILayout.Space(10); // extra left padding
DrawTotalSize(buildReportToDisplay);
GUILayout.Space(BuildReportTool.Window.Settings.CATEGORY_HORIZONTAL_SPACING);
GUILayout.BeginVertical();
DrawBuildSizes(buildReportToDisplay);
GUILayout.Space(BuildReportTool.Window.Settings.CATEGORY_VERTICAL_SPACING);
DrawDLLList(buildReportToDisplay);
GUILayout.EndVertical();
GUILayout.Space(20); // extra right padding
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
}
void DrawTotalSize(BuildReportTool.BuildInfo buildReportToDisplay)
{
GUILayout.BeginVertical();
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
var descStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.TINY_HELP_STYLE_NAME);
if (descStyle == null)
{
descStyle = GUI.skin.label;
}
var valueStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
if (valueStyle == null)
{
valueStyle = GUI.skin.label;
}
if (buildReportToDisplay.HasOldSizeValues)
{
// in old sizes:
// TotalBuildSize is really the used assets size
// CompressedBuildSize if present is the total build size
BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.USED_TOTAL_SIZE_LABEL,
Labels.USED_TOTAL_SIZE_DESC, buildReportToDisplay.TotalBuildSize);
GUILayout.Space(40);
BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.BUILD_TOTAL_SIZE_LABEL,
BuildReportTool.Window.Utility.GetProperBuildSizeDesc(buildReportToDisplay),
buildReportToDisplay.CompressedBuildSize);
}
else
{
// Total Build Size
if (_hasTotalBuildSize)
{
GUILayout.BeginVertical();
var buildPlatform =
BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
buildReportToDisplay.BuildTargetUsed);
GUILayout.Label(
buildPlatform == BuildPlatform.iOS ? Labels.BUILD_XCODE_SIZE_LABEL : Labels.BUILD_TOTAL_SIZE_LABEL,
bigLabelStyle);
GUILayout.Label(BuildReportTool.Util.GetBuildSizePathDescription(buildReportToDisplay),
descStyle);
GUILayout.Label(buildReportToDisplay.TotalBuildSize, valueStyle);
GUILayout.EndVertical();
DrawAuxiliaryBuildSizes(buildReportToDisplay);
GUILayout.Space(40);
}
// Used Assets
if (_hasUsedAssetsTotalSize)
{
BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.USED_TOTAL_SIZE_LABEL,
Labels.USED_TOTAL_SIZE_DESC, buildReportToDisplay.UsedTotalSize);
GUILayout.Space(40);
}
// Unused Assets
if (buildReportToDisplay.UnusedAssetsIncludedInCreation)
{
BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.UNUSED_TOTAL_SIZE_LABEL,
Labels.UNUSED_TOTAL_SIZE_DESC, buildReportToDisplay.UnusedTotalSize);
if (buildReportToDisplay.ProcessUnusedAssetsInBatches)
{
GUILayout.Space(10);
GUILayout.BeginHorizontal();
var warning = GUI.skin.FindStyle("Icon-Warning");
if (warning != null)
{
var warningIcon = warning.normal.background;
var iconWidth = warning.fixedWidth;
var iconHeight = warning.fixedHeight;
GUI.DrawTexture(GUILayoutUtility.GetRect(iconWidth, iconHeight), warningIcon);
}
GUILayout.Label(string.Format(Labels.UNUSED_TOTAL_IS_FROM_BATCH, buildReportToDisplay.UnusedAssetsEntriesPerBatch), descStyle);
GUILayout.EndHorizontal();
}
}
}
GUILayout.EndVertical();
}
void DrawAuxiliaryBuildSizes(BuildReportTool.BuildInfo buildReportToDisplay)
{
BuildReportTool.BuildPlatform buildPlatform =
BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
buildReportToDisplay.BuildTargetUsed);
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
var medLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
if (medLabelStyle == null)
{
medLabelStyle = GUI.skin.label;
}
var valueStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
if (valueStyle == null)
{
valueStyle = GUI.skin.label;
}
if (buildPlatform == BuildReportTool.BuildPlatform.Web)
{
GUILayout.Space(20);
GUILayout.BeginVertical();
GUILayout.Label(Labels.WEB_UNITY3D_FILE_SIZE_LABEL, medLabelStyle);
GUILayout.Label(buildReportToDisplay.WebFileBuildSize, valueStyle);
GUILayout.EndVertical();
}
else if (buildPlatform == BuildReportTool.BuildPlatform.Android)
{
if (!buildReportToDisplay.AndroidCreateProject && buildReportToDisplay.AndroidUseAPKExpansionFiles)
{
GUILayout.Space(20);
GUILayout.BeginVertical();
GUILayout.Label(Labels.ANDROID_APK_FILE_SIZE_LABEL, medLabelStyle);
GUILayout.Label(buildReportToDisplay.AndroidApkFileBuildSize, bigLabelStyle);
GUILayout.EndVertical();
GUILayout.Space(20);
GUILayout.BeginVertical();
GUILayout.Label(Labels.ANDROID_OBB_FILE_SIZE_LABEL, medLabelStyle);
GUILayout.Label(buildReportToDisplay.AndroidObbFileBuildSize, bigLabelStyle);
GUILayout.EndVertical();
}
else if (buildReportToDisplay.AndroidCreateProject && buildReportToDisplay.AndroidUseAPKExpansionFiles)
{
GUILayout.Space(20);
GUILayout.BeginVertical();
GUILayout.Label(Labels.ANDROID_OBB_FILE_SIZE_LABEL, medLabelStyle);
GUILayout.Label(buildReportToDisplay.AndroidObbFileBuildSize, bigLabelStyle);
GUILayout.EndVertical();
}
}
// Streaming Assets
if (buildReportToDisplay.HasStreamingAssets)
{
GUILayout.Space(20);
BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.STREAMING_ASSETS_TOTAL_SIZE_LABEL,
Labels.STREAMING_ASSETS_SIZE_DESC, buildReportToDisplay.StreamingAssetsSize);
}
}
void DrawBuildSizes(BuildReportTool.BuildInfo buildReportToDisplay)
{
if (_hasCompressedBuildSize)
{
GUILayout.BeginVertical();
}
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
var medLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
if (medLabelStyle == null)
{
medLabelStyle = GUI.skin.label;
}
var labelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
if (labelStyle == null)
{
labelStyle = GUI.skin.label;
}
GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_LABEL, bigLabelStyle);
if (_hasCompressedBuildSize)
{
GUILayout.BeginHorizontal();
GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_MSG_PRE_BOLD, labelStyle);
GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_MSG_BOLD, medLabelStyle);
GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_MSG_POST_BOLD, labelStyle);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
if (_hasBuildSizes)
{
GUILayout.BeginHorizontal(BRT_BuildReportWindow.LayoutMaxWidth500);
DrawNames(buildReportToDisplay.BuildSizes);
DrawReadableSizes(buildReportToDisplay.BuildSizes);
DrawPercentages(buildReportToDisplay.BuildSizes);
GUILayout.EndHorizontal();
}
}
void DrawDLLList(BuildReportTool.BuildInfo buildReportToDisplay)
{
BuildReportTool.BuildPlatform buildPlatform =
BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
buildReportToDisplay.BuildTargetUsed);
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
GUILayout.BeginHorizontal();
// column 1
GUILayout.BeginVertical();
if (_hasMonoDLLsToDisplay)
{
GUILayout.Label(Labels.MONO_DLLS_LABEL, bigLabelStyle);
{
GUILayout.BeginHorizontal(BRT_BuildReportWindow.LayoutMaxWidth500);
DrawNames(buildReportToDisplay.MonoDLLs);
DrawReadableSizes(buildReportToDisplay.MonoDLLs);
GUILayout.EndHorizontal();
}
GUILayout.Space(20);
}
if (_hasUnityEngineDLLsToDisplay)
{
DrawScriptDLLsList(buildReportToDisplay, buildPlatform);
}
GUILayout.EndVertical();
GUILayout.Space(15);
// column 2
GUILayout.BeginVertical();
if (_hasUnityEngineDLLsToDisplay)
{
GUILayout.Label(Labels.UNITY_ENGINE_DLLS_LABEL, bigLabelStyle);
{
GUILayout.BeginHorizontal(BRT_BuildReportWindow.LayoutMaxWidth500);
DrawNames(buildReportToDisplay.UnityEngineDLLs);
DrawReadableSizes(buildReportToDisplay.UnityEngineDLLs);
GUILayout.EndHorizontal();
}
}
else
{
DrawScriptDLLsList(buildReportToDisplay, buildPlatform);
}
GUILayout.Space(20);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
void DrawScriptDLLsList(BuildReportTool.BuildInfo buildReportToDisplay,
BuildReportTool.BuildPlatform buildPlatform)
{
if (!_hasScriptDLLsToDisplay)
{
return;
}
var bigLabelStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
if (bigLabelStyle == null)
{
bigLabelStyle = GUI.skin.label;
}
GUILayout.Label(Labels.SCRIPT_DLLS_LABEL, bigLabelStyle);
{
GUILayout.BeginHorizontal(BRT_BuildReportWindow.LayoutMaxWidth500);
DrawNames(buildReportToDisplay.ScriptDLLs);
DrawReadableSizes(buildReportToDisplay.ScriptDLLs);
GUILayout.EndHorizontal();
}
}
void DrawNames(BuildReportTool.SizePart[] list)
{
if (list == null)
{
return;
}
var listNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME);
if (listNormalStyle == null)
{
listNormalStyle = GUI.skin.label;
}
var listAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME);
if (listAltStyle == null)
{
listAltStyle = GUI.skin.label;
}
GUILayout.BeginVertical();
bool useAlt = false;
foreach (BuildReportTool.SizePart b in list)
{
if (b.IsTotal) continue;
var styleToUse = useAlt ? listAltStyle : listNormalStyle;
GUILayout.Label(b.Name, styleToUse);
useAlt = !useAlt;
}
GUILayout.EndVertical();
}
void DrawReadableSizes(BuildReportTool.SizePart[] list)
{
if (list == null)
{
return;
}
var listNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME);
if (listNormalStyle == null)
{
listNormalStyle = GUI.skin.label;
}
var listAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME);
if (listAltStyle == null)
{
listAltStyle = GUI.skin.label;
}
GUILayout.BeginVertical();
bool useAlt = false;
foreach (BuildReportTool.SizePart b in list)
{
if (b.IsTotal) continue;
var styleToUse = useAlt ? listAltStyle : listNormalStyle;
GUILayout.Label(b.Size, styleToUse);
useAlt = !useAlt;
}
GUILayout.EndVertical();
}
void DrawPercentages(BuildReportTool.SizePart[] list)
{
if (list == null)
{
return;
}
var listNormalStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME);
if (listNormalStyle == null)
{
listNormalStyle = GUI.skin.label;
}
var listAltStyle = GUI.skin.FindStyle(BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME);
if (listAltStyle == null)
{
listAltStyle = GUI.skin.label;
}
GUILayout.BeginVertical();
bool useAlt = false;
foreach (BuildReportTool.SizePart b in list)
{
if (b.IsTotal) continue;
var styleToUse = useAlt ? listAltStyle : listNormalStyle;
GUILayout.Label(string.Format("{0}%", b.Percentage.ToString(CultureInfo.InvariantCulture)), styleToUse);
useAlt = !useAlt;
}
GUILayout.EndVertical();
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a1eddc9758ce9e145be925a22b65fd09
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}