in Source/Assets/AppCenterEditorExtensions/Editor/Scripts/Components/ProgressBar.cs [40:155]
public static void Draw()
{
var progressMaxWidth = AppCenterEditor.InnerContainerWidth;
pbarBgStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarBg");
if (currentProgressBarState == ProgressBarStates.off)
{
stTime = 0;
endTime = 0;
progressWidth = 0;
lastUpdateTime = 0;
isReveresed = false;
progressWidth = progressMaxWidth;
pbarStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarClear");
pbarBgStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarClear");
//return;
}
else if (EditorWindow.focusedWindow != AppCenterEditor.window)
{
// pause draw while we are in the bg
return;
}
else if (currentProgressBarState == ProgressBarStates.success)
{
if ((float)EditorApplication.timeSinceStartup - stTime < animationSpeed)
{
progressWidth = progressMaxWidth;
pbarStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarSuccess");
}
else if (AppCenterEditor.blockingRequests.Count > 0)
{
UpdateState(ProgressBarStates.spin);
}
else
{
UpdateState(ProgressBarStates.off);
}
}
else if (currentProgressBarState == ProgressBarStates.warning)
{
if ((float)EditorApplication.timeSinceStartup - stTime < animationSpeed)
{
progressWidth = progressMaxWidth;
pbarStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarWarn");
}
else if (AppCenterEditor.blockingRequests.Count > 0)
{
UpdateState(ProgressBarStates.spin);
}
else
{
UpdateState(ProgressBarStates.off);
}
}
else if (currentProgressBarState == ProgressBarStates.error)
{
if ((float)EditorApplication.timeSinceStartup - stTime < animationSpeed)
{
progressWidth = progressMaxWidth;
pbarStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarError");
}
else if (AppCenterEditor.blockingRequests.Count > 0)
{
UpdateState(ProgressBarStates.spin);
}
else
{
UpdateState(ProgressBarStates.off);
}
}
else
{
if ((float)EditorApplication.timeSinceStartup - lastUpdateTime > tickRate)
{
lastUpdateTime = (float)EditorApplication.timeSinceStartup;
pbarStyle = AppCenterEditorHelper.uiStyle.GetStyle("progressBarFg");
if (currentProgressBarState == ProgressBarStates.on)
{
progressWidth = progressMaxWidth * progress;
}
else if (currentProgressBarState == ProgressBarStates.spin)
{
var currentTime = (float)EditorApplication.timeSinceStartup;
if (currentTime < endTime && !isReveresed)
{
UpdateProgress((currentTime - stTime) / animationSpeed);
progressWidth = progressMaxWidth * progress;
}
else if (currentTime < endTime && isReveresed)
{
UpdateProgress((currentTime - stTime) / animationSpeed);
progressWidth = progressMaxWidth - progressMaxWidth * progress;
}
else
{
isReveresed = !isReveresed;
stTime = (float)EditorApplication.timeSinceStartup;
endTime = stTime + animationSpeed;
}
}
}
}
using (new AppCenterGuiFieldHelper.UnityHorizontal(pbarBgStyle))
{
if (isReveresed)
{
GUILayout.FlexibleSpace();
}
EditorGUILayout.LabelField("", pbarStyle, GUILayout.Width(progressWidth));
}
}