updated: hot reload to 1.13.7
This commit is contained in:
@@ -1,6 +1,86 @@
|
||||
using System;
|
||||
using UnityEngine.Analytics;
|
||||
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
namespace UnityEditor.VSAttribution.HotReload
|
||||
{
|
||||
internal static class VSAttribution
|
||||
{
|
||||
|
||||
const int k_VersionId = 4;
|
||||
const int k_MaxEventsPerHour = 10;
|
||||
const int k_MaxNumberOfElements = 1000;
|
||||
|
||||
const string k_VendorKey = "unity.vsp-attribution";
|
||||
const string k_EventName = "vspAttribution";
|
||||
|
||||
[Serializable]
|
||||
private class VSAttributionData : IAnalytic.IData {
|
||||
public string actionName;
|
||||
public string partnerName;
|
||||
public string customerUid;
|
||||
public string extra;
|
||||
}
|
||||
|
||||
[AnalyticInfo(k_EventName, k_VendorKey, k_VersionId, k_MaxEventsPerHour, k_MaxNumberOfElements)]
|
||||
class VSAttributionAnalytics : IAnalytic {
|
||||
private VSAttributionData m_Data;
|
||||
|
||||
private VSAttributionAnalytics(
|
||||
string actionName,
|
||||
string partnerName,
|
||||
string customerUid,
|
||||
string extra
|
||||
) {
|
||||
this.m_Data = new VSAttributionData {
|
||||
actionName = actionName,
|
||||
partnerName = partnerName,
|
||||
customerUid = customerUid,
|
||||
extra = extra
|
||||
};
|
||||
}
|
||||
|
||||
public bool TryGatherData(out IAnalytic.IData data, out Exception error) {
|
||||
data = this.m_Data;
|
||||
error = null;
|
||||
return this.m_Data != null;
|
||||
}
|
||||
|
||||
public static AnalyticsResult SendEvent(
|
||||
string actionName,
|
||||
string partnerName,
|
||||
string customerUid,
|
||||
string extra
|
||||
) {
|
||||
return EditorAnalytics.SendAnalytic(new VSAttributionAnalytics(actionName,
|
||||
partnerName,
|
||||
customerUid,
|
||||
extra
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers and attempts to send a Verified Solutions Attribution event.
|
||||
/// </summary>
|
||||
/// <param name="actionName">Name of the action, identifying a place this event was called from.</param>
|
||||
/// <param name="partnerName">Identifiable Verified Solutions Partner's name.</param>
|
||||
/// <param name="customerUid">Unique identifier of the customer using Partner's Verified Solution.</param>
|
||||
public static AnalyticsResult SendAttributionEvent(string actionName, string partnerName, string customerUid)
|
||||
{
|
||||
try
|
||||
{
|
||||
return VSAttributionAnalytics.SendEvent(actionName, partnerName, customerUid, "{}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fail silently
|
||||
return AnalyticsResult.AnalyticsDisabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace UnityEditor.VSAttribution.HotReload
|
||||
{
|
||||
internal static class VSAttribution
|
||||
@@ -66,3 +146,4 @@ namespace UnityEditor.VSAttribution.HotReload
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user