using System.Collections;
using UnityEngine;
namespace Unity.Cloud.UserReporting.Plugin
{
///
/// Helps with updating the Unity User Reporting client.
///
public class UnityUserReportingUpdater : IEnumerator
{
#region Constructors
///
/// Creates a new instance of the class.
///
public UnityUserReportingUpdater()
{
this.waitForEndOfFrame = new WaitForEndOfFrame();
}
#endregion
#region Fields
private int step;
private WaitForEndOfFrame waitForEndOfFrame;
#endregion
#region Properties
///
/// Gets the current item.
///
public object Current { get; private set; }
#endregion
#region Methods
///
/// Moves to the next item.
///
/// A value indicating whether the move was successful.
public bool MoveNext()
{
if (this.step == 0)
{
UnityUserReporting.CurrentClient.Update();
this.Current = null;
this.step = 1;
return true;
}
if (this.step == 1)
{
this.Current = this.waitForEndOfFrame;
this.step = 2;
return true;
}
if (this.step == 2)
{
UnityUserReporting.CurrentClient.UpdateOnEndOfFrame();
this.Current = null;
this.step = 3;
return false;
}
return false;
}
///
/// Resets the updater.
///
public void Reset()
{
this.step = 0;
}
#endregion
}
}