using Unity.Cloud.UserReporting.Client; using UnityEngine; namespace Unity.Cloud.UserReporting.Plugin { /// /// Provides a starting point for Unity User Reporting. /// public static class UnityUserReporting { #region Static Fields private static UserReportingClient currentClient; #endregion #region Static Properties /// /// Gets the current client. /// public static UserReportingClient CurrentClient { get { if (UnityUserReporting.currentClient == null) { UnityUserReporting.Configure(); } return UnityUserReporting.currentClient; } private set { UnityUserReporting.currentClient = value; } } #endregion #region Static Methods /// /// Configures Unity User Reporting. /// /// The endpoint. /// The project identifier. /// The plaform. /// The configuration. public static void Configure(string endpoint, string projectIdentifier, IUserReportingPlatform platform, UserReportingClientConfiguration configuration) { UnityUserReporting.CurrentClient = new UserReportingClient(endpoint, projectIdentifier, platform, configuration); } /// /// Configures Unity User Reporting. /// /// /// /// public static void Configure(string endpoint, string projectIdentifier, UserReportingClientConfiguration configuration) { UnityUserReporting.CurrentClient = new UserReportingClient(endpoint, projectIdentifier, UnityUserReporting.GetPlatform(), configuration); } /// /// Configures Unity User Reporting. /// /// /// public static void Configure(string projectIdentifier, UserReportingClientConfiguration configuration) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", projectIdentifier, UnityUserReporting.GetPlatform(), configuration); } /// /// Configures Unity User Reporting. /// /// public static void Configure(string projectIdentifier) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", projectIdentifier, UnityUserReporting.GetPlatform(), new UserReportingClientConfiguration()); } /// /// Configures Unity User Reporting. /// public static void Configure() { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", Application.cloudProjectId, UnityUserReporting.GetPlatform(), new UserReportingClientConfiguration()); } /// /// Configures Unity User Reporting. /// /// public static void Configure(UserReportingClientConfiguration configuration) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", Application.cloudProjectId, UnityUserReporting.GetPlatform(), configuration); } /// /// Configures Unity User Reporting. /// /// /// /// public static void Configure(string projectIdentifier, IUserReportingPlatform platform, UserReportingClientConfiguration configuration) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", projectIdentifier, platform, configuration); } /// /// Configures Unity User Reporting. /// /// /// public static void Configure(IUserReportingPlatform platform, UserReportingClientConfiguration configuration) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", Application.cloudProjectId, platform, configuration); } /// /// Configures Unity User Reporting. /// /// public static void Configure(IUserReportingPlatform platform) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", Application.cloudProjectId, platform, new UserReportingClientConfiguration()); } /// /// Gets the platform. /// /// The platform. private static IUserReportingPlatform GetPlatform() { return new UnityUserReportingPlatform(); } /// /// Uses an existing client. /// /// The client. public static void Use(UserReportingClient client) { if (client != null) { UnityUserReporting.CurrentClient = client; } } #endregion } }