restructure

This commit is contained in:
tom.hempel
2025-09-30 18:03:19 +02:00
parent 69b0c79692
commit 78e5dcd53e
4821 changed files with 762 additions and 417 deletions

View File

@ -0,0 +1,15 @@
{
"name": "Unity.VSAttribution.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 81d593f1154d242f48ee3bd8c82a2eec
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,72 @@
using System;
using UnityEngine.Analytics;
namespace UnityEditor.VSAttribution
{
public static class VSAttribution
{
private const int k_VersionId = 4;
private const int k_MaxEventsPerHour = 10;
private const int k_MaxNumberOfElements = 1000;
private const string k_VendorKey = "unity.vsp-attribution";
private const string k_EventName = "vspAttribution";
private static bool RegisterEvent()
{
AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour,
k_MaxNumberOfElements, k_VendorKey, k_VersionId);
bool isResultOk = result == AnalyticsResult.Ok;
return isResultOk;
}
/// <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
{
// Are Editor Analytics enabled ? (Preferences)
if (!EditorAnalytics.enabled)
return AnalyticsResult.AnalyticsDisabled;
if (!RegisterEvent())
return AnalyticsResult.InvalidData;
// Create an expected data object
VSAttributionData eventData = new()
{
actionName = actionName,
partnerName = partnerName,
customerUid = customerUid,
extra = "{}"
};
return EditorAnalytics.SendEventWithLimit(k_EventName, eventData, k_VersionId);
}
catch
{
// Fail silently
return AnalyticsResult.AnalyticsDisabled;
}
}
#region Nested type: VSAttributionData
[Serializable]
private struct VSAttributionData
{
public string actionName;
public string partnerName;
public string customerUid;
public string extra;
}
#endregion
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cce542547dcb348169a3d805aa7c769f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: