void OnProgressStateChanged(SetProgressStateAction.ProgressState newData) { if (!m_Initialized) { return; } switch (newData) { case SetProgressStateAction.ProgressState.NoPendingRequest: { m_ProgressIndicatorControl.StopLooping(); break; } case SetProgressStateAction.ProgressState.PendingIndeterminate: { m_ProgressIndicatorControl.StartLooping(); break; } case SetProgressStateAction.ProgressState.PendingDeterminate: { float percent = 1; if (m_ProgressTotalCountGetter.GetValue() != 0) { percent = (float)m_ProgressCurrentGetter.GetValue() / m_ProgressTotalCountGetter.GetValue(); } m_ProgressIndicatorControl.SetProgress(percent); break; } } }
void OnStateDataChanged(UIStateData data) { if (m_CurrentProgressData != data.progressData) { switch (data.progressData.progressState) { case ProgressData.ProgressState.NoPendingRequest: { m_ProgressIndicatorControl.StopLooping(); break; } case ProgressData.ProgressState.PendingIndeterminate: { m_ProgressIndicatorControl.StartLooping(); break; } case ProgressData.ProgressState.PendingDeterminate: { float percent = 1; if (data.progressData.totalCount != 0) { percent = (float)data.progressData.currentProgress / data.progressData.totalCount; } m_ProgressIndicatorControl.SetProgress(percent); break; } } m_CurrentProgressData = data.progressData; } }
public void SetStatus(Status status) { GameObject selected = null; switch (status) { case Status.AvailableForDownload: selected = m_DownloadButton.gameObject; break; case Status.AvailableOffline: selected = m_AvailableOffline; break; case Status.UpdateAvailable: selected = m_UpdateAvailable.gameObject; break; case Status.QueuedForDownload: selected = m_QueuedForDownload; break; case Status.Downloading: selected = m_DownloadIndicator.gameObject; break; case Status.DownloadError: selected = m_DownloadError; break; case Status.QueuedForDelete: selected = m_QueuedForDelete; break; case Status.Deleting: selected = m_DeleteIndicator.gameObject; break; case Status.DeleteError: selected = m_DeleteError; break; case Status.ConnectionError: selected = m_ConnectionError; break; case Status.Unknown: default: selected = m_Unknown; break; } if (m_Active == selected) { return; } if (m_Active != null) { m_Active.SetActive(false); } m_Active = selected; if (m_Active != null) { m_Active.SetActive(true); } if (status == Status.Downloading) { m_DownloadIndicator.StartLooping(); } else { m_DownloadIndicator.StopLooping(); } if (status == Status.Deleting) { m_DeleteIndicator.StartLooping(); } else { m_DeleteIndicator.StopLooping(); } }