void DrawTopBar(Rect position, BuildInfo buildReportToDisplay, BuildReportTool.FileFilterGroup fileFilterGroupToUse) { BuildReportTool.AssetList assetListUsed = GetAssetListToDisplay(buildReportToDisplay); if (assetListUsed == null) { return; } Texture2D prevArrow = GUI.skin.GetStyle(BuildReportTool.Window.Settings.BIG_LEFT_ARROW_ICON_STYLE_NAME).normal.background; Texture2D nextArrow = GUI.skin.GetStyle(BuildReportTool.Window.Settings.BIG_RIGHT_ARROW_ICON_STYLE_NAME).normal.background; GUILayout.BeginHorizontal(GUILayout.Height(11)); GUILayout.Label(" ", BuildReportTool.Window.Settings.TOP_BAR_BG_STYLE_NAME); // ------------------------------------------------------------------------------------------------------ // File Filters fileFilterGroupToUse.Draw(assetListUsed, position.width - 100); // ------------------------------------------------------------------------------------------------------ GUILayout.Space(20); // ------------------------------------------------------------------------------------------------------ // Unused Assets Batch if (IsShowingUnusedAssets) { int batchNumber = buildReportToDisplay.UnusedAssetsBatchNum + 1; if (GUILayout.Button(prevArrow, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME) && (batchNumber - 1 >= 1)) { // move to previous batch BuildReportTool.ReportGenerator.MoveUnusedAssetsBatchToPrev(buildReportToDisplay, fileFilterGroupToUse); } string batchLabel = "Batch " + batchNumber; GUILayout.Label(batchLabel, BuildReportTool.Window.Settings.TOP_BAR_LABEL_STYLE_NAME); if (GUILayout.Button(nextArrow, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME)) { // move to next batch // (possible to have no new batch anymore. if so, it will just fail silently) BuildReportTool.ReportGenerator.MoveUnusedAssetsBatchToNext(buildReportToDisplay, fileFilterGroupToUse); } } // ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------ // Paginate Buttons BuildReportTool.SizePart[] assetListToUse = assetListUsed.GetListToDisplay(fileFilterGroupToUse); int assetListLength = 0; if (assetListToUse != null) { assetListLength = assetListToUse.Length; } int viewOffset = assetListUsed.GetViewOffsetForDisplayedList(fileFilterGroupToUse); int len = Mathf.Min(viewOffset + BuildReportTool.Options.AssetListPaginationLength, assetListLength); int offsetNonZeroBased = viewOffset + (len > 0 ? 1 : 0); string NUM_STR = "D" + assetListLength.ToString().Length; if (GUILayout.Button(prevArrow, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME) && (viewOffset - BuildReportTool.Options.AssetListPaginationLength >= 0)) { assetListUsed.SetViewOffsetForDisplayedList(fileFilterGroupToUse, viewOffset - BuildReportTool.Options.AssetListPaginationLength); _assetListScrollPos.y = 0; } string paginateLabel = "Page " + offsetNonZeroBased.ToString(NUM_STR) + " - " + len.ToString(NUM_STR) + " of " + assetListLength.ToString(NUM_STR); GUILayout.Label(paginateLabel, BuildReportTool.Window.Settings.TOP_BAR_LABEL_STYLE_NAME); if (GUILayout.Button(nextArrow, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME) && (viewOffset + BuildReportTool.Options.AssetListPaginationLength < assetListLength)) { assetListUsed.SetViewOffsetForDisplayedList(fileFilterGroupToUse, viewOffset + BuildReportTool.Options.AssetListPaginationLength); _assetListScrollPos.y = 0; } // ------------------------------------------------------------------------------------------------------ GUILayout.FlexibleSpace(); _searchTextInput = GUILayout.TextField(_searchTextInput, "TextField-Search", GUILayout.MinWidth(200)); if (GUILayout.Button(string.Empty, "TextField-Search-ClearButton")) { ClearSearch(); } // ------------------------------------------------------------------------------------------------------ // Recalculate Imported sizes // (makes sense only for unused assets) if (_currentListDisplayed != ListToDisplay.UsedAssets && GUILayout.Button(Labels.RECALC_IMPORTED_SIZES, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME)) { assetListUsed.PopulateImportedSizes(); } // ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------ // Selection buttons if (GUILayout.Button(Labels.SELECT_ALL_LABEL, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME)) { assetListUsed.AddAllDisplayedToSumSelection(fileFilterGroupToUse); } if (GUILayout.Button(Labels.SELECT_NONE_LABEL, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME)) { assetListUsed.ClearSelection(); } // ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------ // Delete buttons if (ShouldShowDeleteButtons(buildReportToDisplay)) { GUI.backgroundColor = Color.red; const string delSelectedLabel = "Delete selected"; if (GUILayout.Button(delSelectedLabel, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME)) { InitiateDeleteSelectedUsed(buildReportToDisplay); } const string deleteAllLabel = "Delete all"; if (GUILayout.Button(deleteAllLabel, BuildReportTool.Window.Settings.TOP_BAR_BTN_STYLE_NAME)) { InitiateDeleteAllUnused(buildReportToDisplay); } GUI.backgroundColor = Color.white; } // ------------------------------------------------------------------------------------------------------ GUILayout.EndHorizontal(); GUILayout.Space(5); }