#if ENABLE_CLOUD_SERVICES_ANALYTICS || UNITY_2023_2_OR_NEWER
using Unity.XR.CoreUtils.Editor.Analytics;
using UnityEngine.Analytics;
namespace UnityEditor.XR.Interaction.Toolkit.Analytics
{
///
abstract class XRIBaseAnalyticsEvent : EditorAnalyticsEvent where T : struct
#if UNITY_2023_2_OR_NEWER
, IAnalytic.IData
#endif
{
#if !UNITY_2023_2_OR_NEWER
///
/// Hourly limit for this event name.
///
int maxEventsPerHour { get; }
///
/// Maximum number of items in this event.
///
int maxItems { get; }
///
/// The class constructor.
///
/// This event name.
/// This event version.
/// Hourly limit for this event name.
/// Maximum number of items in this event.
protected XRIBaseAnalyticsEvent(string eventName, int eventVersion, int maxEventsPerHour, int maxItems)
: base(eventName, eventVersion)
{
this.maxEventsPerHour = maxEventsPerHour;
this.maxItems = maxItems;
}
#endif
///
protected override AnalyticsResult SendToAnalyticsServer(T parameter)
{
#if UNITY_2023_2_OR_NEWER
var result = EditorAnalytics.SendAnalytic(this);
#else
var result = EditorAnalytics.SendEventWithLimit(EventName, parameter, EventVersion);
#endif
return result;
}
///
protected override AnalyticsResult RegisterWithAnalyticsServer()
{
#if UNITY_2023_2_OR_NEWER
return AnalyticsResult.Ok;
#else
return EditorAnalytics.RegisterEventWithLimit(EventName, maxEventsPerHour, maxItems, XRIAnalytics.VendorKey, EventVersion);
#endif
}
}
}
#endif