void OnGUI()
{
if (Event.current.type == EventType.Layout)
{
_noGuiSkinFound = _usedSkin == null;
_loadingValuesFromThread = !string.IsNullOrEmpty(GetValueMessage);
_buildInfoHasNoContentsToDisplay = !BuildReportTool.Util.BuildInfoHasContents(_buildInfo);
}
//GUI.Label(new Rect(5, 100, 800, 20), "BuildReportTool.Util.ShouldReload: " + BuildReportTool.Util.ShouldReload + " EditorApplication.isCompiling: " + EditorApplication.isCompiling);
if (_noGuiSkinFound)
{
GUI.Label(new Rect(20, 20, 500, 100), BuildReportTool.Options.BUILD_REPORT_PACKAGE_MISSING_MSG);
return;
}
GUI.skin = _usedSkin;
DrawTopRowButtons();
GUI.Label(new Rect(0, 0, position.width, 20), BuildReportTool.Info.ReadableVersion,
BuildReportTool.Window.Settings.VERSION_STYLE_NAME);
// loading message
if (LoadingValuesFromThread)
{
DrawCentralMessage(GetValueMessage);
return;
}
bool requestRepaint = false;
// content to show when there is no build report on display
if (_buildInfoHasNoContentsToDisplay)
{
if (IsInOptionsCategory)
{
GUILayout.Space(40);
_optionsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaint);
}
else if (IsInHelpCategory)
{
GUILayout.Space(40);
_helpScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaint);
}
else if (IsWaitingForBuildCompletionToGenerateBuildReport)
{
DrawCentralMessage(Labels.WAITING_FOR_BUILD_TO_COMPLETE_MSG);
}
else
{
DrawCentralMessage(Labels.NO_BUILD_INFO_FOUND_MSG);
if (ReportGenerator.CheckIfUnityHasNoLogArgument())
{
DrawWarningMessage(Labels.FOUND_NO_LOG_ARGUMENT_MSG);
}
}
if (requestRepaint)
{
Repaint();
}
return;
}
GUILayout.Space(50); // top padding (top row buttons are 40 pixels)
var mouseHasMoved = Mathf.Abs(Event.current.mousePosition.x - _lastMousePos.x) > 0 ||
Mathf.Abs(Event.current.mousePosition.y - _lastMousePos.y) > 0;
// category buttons
int oldSelectedCategoryIdx = _selectedCategoryIdx;
GUILayout.BeginHorizontal();
if (GUILayout.Toggle(IsInOverviewCategory, "Overview", BuildReportTool.Window.Settings.TAB_LEFT_STYLE_NAME,
GUILayout.ExpandWidth(true)))
{
_selectedCategoryIdx = OVERVIEW_IDX;
}
if (GUILayout.Toggle(IsInBuildSettingsCategory, "Project Settings",
BuildReportTool.Window.Settings.TAB_MIDDLE_STYLE_NAME, GUILayout.ExpandWidth(true)))
{
_selectedCategoryIdx = BUILD_SETTINGS_IDX;
}
if (GUILayout.Toggle(IsInSizeStatsCategory, "Size Stats", BuildReportTool.Window.Settings.TAB_MIDDLE_STYLE_NAME,
GUILayout.ExpandWidth(true)))
{
_selectedCategoryIdx = SIZE_STATS_IDX;
}
if (GUILayout.Toggle(IsInUsedAssetsCategory, "Used Assets", BuildReportTool.Window.Settings.TAB_MIDDLE_STYLE_NAME,
GUILayout.ExpandWidth(true)))
{
_selectedCategoryIdx = USED_ASSETS_IDX;
}
if (GUILayout.Toggle(IsInUnusedAssetsCategory, "Unused Assets",
BuildReportTool.Window.Settings.TAB_RIGHT_STYLE_NAME, GUILayout.ExpandWidth(true)))
{
_selectedCategoryIdx = UNUSED_ASSETS_IDX;
}
/*GUILayout.Space(20);
*
* if (GUILayout.Toggle(IsInOptionsCategory, _toolbarLabelOptions, BuildReportTool.Window.Settings.TAB_LEFT_STYLE_NAME, GUILayout.ExpandWidth(true)))
* {
* _selectedCategoryIdx = OPTIONS_IDX;
* }
* if (GUILayout.Toggle(IsInHelpCategory, _toolbarLabelHelp, BuildReportTool.Window.Settings.TAB_RIGHT_STYLE_NAME, GUILayout.ExpandWidth(true)))
* {
* _selectedCategoryIdx = HELP_IDX;
* }*/
GUILayout.EndHorizontal();
if (oldSelectedCategoryIdx != OPTIONS_IDX && _selectedCategoryIdx == OPTIONS_IDX)
{
// moving into the options screen
_fileFilterGroupToUseOnOpeningOptionsWindow = BuildReportTool.Options.FilterToUseInt;
}
else if (oldSelectedCategoryIdx == OPTIONS_IDX && _selectedCategoryIdx != OPTIONS_IDX)
{
// moving away from the options screen
_fileFilterGroupToUseOnClosingOptionsWindow = BuildReportTool.Options.FilterToUseInt;
if (_fileFilterGroupToUseOnOpeningOptionsWindow != _fileFilterGroupToUseOnClosingOptionsWindow)
{
RecategorizeDisplayedBuildInfo();
}
}
bool requestRepaintOnTabs = false;
// main content
GUILayout.BeginHorizontal();
//GUILayout.Space(3); // left padding
GUILayout.BeginVertical();
if (IsInOverviewCategory)
{
_overviewScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
else if (IsInBuildSettingsCategory)
{
_buildSettingsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
else if (IsInSizeStatsCategory)
{
_sizeStatsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
else if (IsInUsedAssetsCategory)
{
_usedAssetsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
else if (IsInUnusedAssetsCategory)
{
_unusedAssetsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
else if (IsInOptionsCategory)
{
_optionsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
else if (IsInHelpCategory)
{
_helpScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs);
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
//GUILayout.Space(5); // right padding
GUILayout.EndHorizontal();
//GUILayout.Space(10); // bottom padding
if (requestRepaintOnTabs)
{
_buildInfo.FlagOkToRefresh();
}
_lastMousePos = Event.current.mousePosition;
_lastMouseMoved = mouseHasMoved;
}