File size: 1,009 Bytes
18a519f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | using UnityEngine;
namespace UnityEditor.Performance.ProfileAnalyzer
{
internal class ProgressBarDisplay
{
int m_TotalFrames;
int m_CurrentFrame;
string m_Title;
string m_Description;
public void InitProgressBar(string title, string description, int frames)
{
m_CurrentFrame = 0;
m_TotalFrames = frames;
m_Title = title;
m_Description = description;
EditorUtility.DisplayProgressBar(m_Title, m_Description, m_CurrentFrame);
}
public void AdvanceProgressBar()
{
m_CurrentFrame++;
int currentFrame = Mathf.Clamp(0, m_CurrentFrame, m_TotalFrames);
float progress = m_TotalFrames > 0 ? (float)currentFrame / m_TotalFrames : 0f;
EditorUtility.DisplayProgressBar(m_Title, m_Description, progress);
}
public void ClearProgressBar()
{
EditorUtility.ClearProgressBar();
}
}
}
|