Initialer Upload neues Unity-Projekt
This commit is contained in:
165
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetry.cs
Normal file
165
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetry.cs
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !(UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || (UNITY_ANDROID && !UNITY_EDITOR))
|
||||
#define OVRPLUGIN_UNSUPPORTED_PLATFORM
|
||||
#endif
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
internal static partial class OVRTelemetry
|
||||
{
|
||||
private static bool IsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
#if OVRPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
||||
return OVRRuntimeSettings.Instance.TelemetryEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly TelemetryClient InactiveClient = new NullTelemetryClient();
|
||||
public static readonly TelemetryClient ActiveClient = new QPLTelemetryClient();
|
||||
public static TelemetryClient Client => IsActive ? ActiveClient : InactiveClient;
|
||||
|
||||
public readonly struct MarkerPoint : IDisposable
|
||||
{
|
||||
public int NameHandle { get; }
|
||||
|
||||
public MarkerPoint(string name)
|
||||
{
|
||||
Client.CreateMarkerHandle(name, out var nameHandle);
|
||||
NameHandle = nameHandle;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Client.DestroyMarkerHandle(NameHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class TelemetryClient
|
||||
{
|
||||
public abstract void MarkerStart(int markerId, int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey,
|
||||
long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs);
|
||||
|
||||
public abstract void MarkerPointCached(int markerId, int nameHandle,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey, long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs);
|
||||
|
||||
public abstract void MarkerAnnotation(int markerId, string annotationKey,
|
||||
string annotationValue, int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey);
|
||||
|
||||
public abstract void MarkerEnd(int markerId,
|
||||
OVRPlugin.Qpl.ResultType resultTypeId = OVRPlugin.Qpl.ResultType.Success,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey, long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs);
|
||||
|
||||
public abstract bool CreateMarkerHandle(string name, out int nameHandle);
|
||||
public abstract bool DestroyMarkerHandle(int nameHandle);
|
||||
}
|
||||
|
||||
private class NullTelemetryClient : TelemetryClient
|
||||
{
|
||||
public override void MarkerStart(int markerId, int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey,
|
||||
long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
}
|
||||
|
||||
public override void MarkerPointCached(int markerId, int nameHandle,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey, long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
}
|
||||
|
||||
public override void MarkerAnnotation(int markerId, string annotationKey,
|
||||
string annotationValue, int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey)
|
||||
{
|
||||
}
|
||||
|
||||
public override void MarkerEnd(int markerId,
|
||||
OVRPlugin.Qpl.ResultType resultTypeId = OVRPlugin.Qpl.ResultType.Success,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey, long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CreateMarkerHandle(string name, out int nameHandle)
|
||||
{
|
||||
nameHandle = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool DestroyMarkerHandle(int nameHandle) => false;
|
||||
}
|
||||
|
||||
private class QPLTelemetryClient : TelemetryClient
|
||||
{
|
||||
public override void MarkerStart(int markerId, int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey,
|
||||
long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
OVRPlugin.Qpl.MarkerStart(markerId, instanceKey, timestampMs);
|
||||
}
|
||||
|
||||
public override void MarkerPointCached(int markerId, int nameHandle,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey, long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
OVRPlugin.Qpl.MarkerPointCached(markerId, nameHandle, instanceKey, timestampMs);
|
||||
}
|
||||
|
||||
public override void MarkerAnnotation(int markerId, string annotationKey,
|
||||
string annotationValue, int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey)
|
||||
{
|
||||
OVRPlugin.Qpl.MarkerAnnotation(markerId, annotationKey, annotationValue, instanceKey);
|
||||
}
|
||||
|
||||
public override void MarkerEnd(int markerId,
|
||||
OVRPlugin.Qpl.ResultType resultTypeId = OVRPlugin.Qpl.ResultType.Success,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey, long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
OVRPlugin.Qpl.MarkerEnd(markerId, resultTypeId, instanceKey, timestampMs);
|
||||
}
|
||||
|
||||
public override bool CreateMarkerHandle(string name, out int nameHandle)
|
||||
{
|
||||
return OVRPlugin.Qpl.CreateMarkerHandle(name, out nameHandle);
|
||||
}
|
||||
|
||||
public override bool DestroyMarkerHandle(int nameHandle)
|
||||
{
|
||||
return OVRPlugin.Qpl.DestroyMarkerHandle(nameHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public static OVRTelemetryMarker Start(int markerId,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey,
|
||||
long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
return new OVRTelemetryMarker(markerId, instanceKey, timestampMs);
|
||||
}
|
||||
|
||||
public static void SendEvent(int markerId,
|
||||
OVRPlugin.Qpl.ResultType result = OVRPlugin.Qpl.ResultType.Success)
|
||||
{
|
||||
Start(markerId).SetResult(result).Send();
|
||||
}
|
||||
}
|
||||
11
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetry.cs.meta
Normal file
11
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetry.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2910acaedb0d75342835391e582976d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using MarkerPoint = OVRTelemetry.MarkerPoint;
|
||||
|
||||
internal static class OVRTelemetryConstants
|
||||
{
|
||||
public static class OVRManager
|
||||
{
|
||||
public static class MarkerId
|
||||
{
|
||||
public const int Init = 163069401;
|
||||
public const int Consent = 163056770;
|
||||
}
|
||||
|
||||
public static class AnnotationTypes
|
||||
{
|
||||
public const string Origin = "Origin";
|
||||
public const string EngineVersion = "developer_platform_version";
|
||||
}
|
||||
|
||||
public enum ConsentOrigins
|
||||
{
|
||||
Popup,
|
||||
Settings,
|
||||
Legacy
|
||||
}
|
||||
|
||||
public static readonly MarkerPoint InitializeInsightPassthrough =
|
||||
new MarkerPoint("InitializeInsightPassthrough");
|
||||
|
||||
public static readonly MarkerPoint InitPermissionRequest = new MarkerPoint("InitPermissionRequest");
|
||||
}
|
||||
|
||||
public static class Scene
|
||||
{
|
||||
public static class MarkerId
|
||||
{
|
||||
public const int SpatialAnchorSetComponentStatus = 163055742;
|
||||
public const int SpatialAnchorSave = 163056007;
|
||||
public const int SpatialAnchorQuery = 163057870;
|
||||
public const int SpatialAnchorErase = 163059334;
|
||||
public const int SpatialAnchorCreate = 163068641;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Editor
|
||||
{
|
||||
public const int Start = 163067235;
|
||||
}
|
||||
|
||||
public static class BB
|
||||
{
|
||||
public static class MarkerId
|
||||
{
|
||||
public const int OpenWindow = 163062905;
|
||||
public const int AddBlock = 163060420;
|
||||
public const int UpdateBlock = 163064521;
|
||||
public const int RunBlock = 163063912;
|
||||
public const int InstallSDK = 163067801;
|
||||
public const int RemoveSDK = 163067560;
|
||||
public const int InstallBlockData = 163065449;
|
||||
public const int OpenSceneWithBlock = 163063649;
|
||||
}
|
||||
|
||||
public static class AnnotationType
|
||||
{
|
||||
public const string BlockId = "BlockId";
|
||||
public const string BlockName = "BlockName";
|
||||
public const string InstanceId = "InstanceId";
|
||||
public const string Version = "Version";
|
||||
public const string ActionTrigger = "action_trigger";
|
||||
public const string Error = "error";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d9b29931a92f8c4ab7821d7bea55f2b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetryMarker.cs
Normal file
127
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetryMarker.cs
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using static OVRTelemetry;
|
||||
|
||||
internal struct OVRTelemetryMarker : IDisposable
|
||||
{
|
||||
internal struct OVRTelemetryMarkerState
|
||||
{
|
||||
public bool Sent { get; set; }
|
||||
public OVRPlugin.Qpl.ResultType Result { get; set; }
|
||||
|
||||
public OVRTelemetryMarkerState(bool sent, OVRPlugin.Qpl.ResultType result)
|
||||
{
|
||||
Result = result;
|
||||
Sent = sent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private OVRTelemetryMarkerState State { get; set; }
|
||||
|
||||
public bool Sent => State.Sent;
|
||||
public OVRPlugin.Qpl.ResultType Result => State.Result;
|
||||
|
||||
public int MarkerId { get; }
|
||||
public int InstanceKey { get; }
|
||||
|
||||
private readonly TelemetryClient _client;
|
||||
|
||||
public OVRTelemetryMarker(
|
||||
int markerId,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey,
|
||||
long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
: this(
|
||||
OVRTelemetry.Client,
|
||||
markerId,
|
||||
instanceKey,
|
||||
timestampMs)
|
||||
{
|
||||
}
|
||||
|
||||
internal OVRTelemetryMarker(
|
||||
TelemetryClient client,
|
||||
int markerId,
|
||||
int instanceKey = OVRPlugin.Qpl.DefaultInstanceKey,
|
||||
long timestampMs = OVRPlugin.Qpl.AutoSetTimestampMs)
|
||||
{
|
||||
MarkerId = markerId;
|
||||
InstanceKey = instanceKey;
|
||||
_client = client;
|
||||
State = new OVRTelemetryMarkerState(false, OVRPlugin.Qpl.ResultType.Success);
|
||||
|
||||
_client.MarkerStart(markerId, instanceKey, timestampMs);
|
||||
}
|
||||
|
||||
public OVRTelemetryMarker SetResult(OVRPlugin.Qpl.ResultType result)
|
||||
{
|
||||
State = new OVRTelemetryMarkerState(Sent, result);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OVRTelemetryMarker AddAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
_client.MarkerAnnotation(MarkerId, annotationKey, annotationValue, InstanceKey);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OVRTelemetryMarker AddAnnotationIfNotNullOrEmpty(string annotationKey, string annotationValue)
|
||||
{
|
||||
return string.IsNullOrEmpty(annotationValue) ? this : AddAnnotation(annotationKey, annotationValue);
|
||||
}
|
||||
|
||||
public OVRTelemetryMarker Send()
|
||||
{
|
||||
|
||||
AddAnnotation(OVRTelemetryConstants.OVRManager.AnnotationTypes.EngineVersion, Application.unityVersion);
|
||||
|
||||
State = new OVRTelemetryMarkerState(true, Result);
|
||||
_client.MarkerEnd(MarkerId, Result, InstanceKey);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OVRTelemetryMarker SendIf(bool condition)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
return Send();
|
||||
}
|
||||
|
||||
State = new OVRTelemetryMarkerState(true, Result);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OVRTelemetryMarker AddPoint(OVRTelemetry.MarkerPoint point)
|
||||
{
|
||||
_client.MarkerPointCached(MarkerId, point.NameHandle, InstanceKey);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!Sent)
|
||||
{
|
||||
Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12346e489d1e4e4486812e77113174b9
|
||||
timeCreated: 1679668683
|
||||
34
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetryUtils.cs
Normal file
34
Assets/Oculus/VR/Scripts/OVRTelemetry/OVRTelemetryUtils.cs
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
internal static partial class OVRTelemetry
|
||||
{
|
||||
private static string _sdkVersionString;
|
||||
|
||||
public static OVRTelemetryMarker AddSDKVersionAnnotation(this OVRTelemetryMarker marker)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_sdkVersionString))
|
||||
{
|
||||
_sdkVersionString = OVRPlugin.version.ToString();
|
||||
}
|
||||
|
||||
return marker.AddAnnotation("sdk_version", _sdkVersionString);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f23eceec74ac2974b8e71cb36b701fa7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user