Initialer Upload neues Unity-Projekt

This commit is contained in:
Daniel Ocks
2025-07-21 09:11:14 +02:00
commit eeca72985b
14558 changed files with 1508140 additions and 0 deletions

View File

@ -0,0 +1,85 @@
/*
* 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 System.Collections.Generic;
using System.Reflection;
using UnityEditor;
[InitializeOnLoad]
internal static class ConsoleLinkEventHandler
{
public static event Action<Dictionary<string, string>> OnConsoleLink;
#if UNITY_2021_2_OR_NEWER
// Much simpler code in 2021 as the API became public
static ConsoleLinkEventHandler()
{
EditorGUI.hyperLinkClicked += OnConsoleLinkInternal;
}
private static void OnConsoleLinkInternal(EditorWindow window, HyperLinkClickedEventArgs arguments)
{
OnConsoleLink?.Invoke(arguments.hyperLinkData);
}
#else
// Using reflection to hack into the internal hyperLinkClicked event before 2021
private static PropertyInfo _parametersProperty;
static ConsoleLinkEventHandler()
{
var evt = typeof(EditorGUI).GetEvent("hyperLinkClicked", BindingFlags.Static | BindingFlags.NonPublic);
if (evt != null)
{
var method = typeof(ConsoleLinkEventHandler).GetMethod("OnConsoleLinkInternal",
BindingFlags.Static | BindingFlags.NonPublic);
if (method != null)
{
var handler = Delegate.CreateDelegate(evt.EventHandlerType, method);
evt.AddMethod.Invoke(null, new object[] { handler });
}
}
}
private static bool InitialiseParametersProperty(EventArgs arguments)
{
if (_parametersProperty == null)
{
_parametersProperty = arguments.GetType()
.GetProperty("hyperlinkInfos", BindingFlags.Instance | BindingFlags.Public);
}
return _parametersProperty != null;
}
private static void OnConsoleLinkInternal(object sender, EventArgs arguments)
{
if (!InitialiseParametersProperty(arguments))
{
return;
}
if (_parametersProperty.GetValue(arguments) is Dictionary<string, string> argumentsAsDictionary)
{
OnConsoleLink?.Invoke(argumentsAsDictionary);
}
}
#endif
}

View File

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

View 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 System.Collections.Generic;
internal abstract class OptionalLambdaType<TLambdaArgumentType, TValueType>
{
public static OptionalLambdaType<TLambdaArgumentType, TValueType> Create(TValueType value,
Func<TLambdaArgumentType, TValueType> lambda, bool allowCache)
{
OptionalLambdaType<TLambdaArgumentType, TValueType> optionalLambdaType = null;
if (lambda != null)
{
if (allowCache)
{
optionalLambdaType = new OptionalLambdaTypeWithCachedLambda<TLambdaArgumentType, TValueType>(lambda);
}
else
{
optionalLambdaType = new OptionalLambdaTypeWithLambda<TLambdaArgumentType, TValueType>(lambda);
}
}
else
{
optionalLambdaType = new OptionalLambdaTypeWithoutLambda<TLambdaArgumentType, TValueType>(value);
}
return optionalLambdaType;
}
public static implicit operator OptionalLambdaType<TLambdaArgumentType, TValueType>(TValueType value)
{
var optionalLambdaType = new OptionalLambdaTypeWithoutLambda<TLambdaArgumentType, TValueType>(value);
return optionalLambdaType;
}
public static implicit operator OptionalLambdaType<TLambdaArgumentType, TValueType>(
Func<TLambdaArgumentType, TValueType> lambda)
{
var optionalLambdaType = new OptionalLambdaTypeWithLambda<TLambdaArgumentType, TValueType>(lambda);
return optionalLambdaType;
}
public abstract bool Valid { get; }
public abstract TValueType GetValue(TLambdaArgumentType arg);
public abstract TValueType Default { get; }
public virtual void InvalidateCache(TLambdaArgumentType arg)
{
}
}
internal class OptionalLambdaTypeWithoutLambda<TLambdaArgumentType, TValueType>
: OptionalLambdaType<TLambdaArgumentType, TValueType>
{
private readonly TValueType _value;
public OptionalLambdaTypeWithoutLambda(TValueType value)
{
_value = value;
}
public override TValueType GetValue(TLambdaArgumentType arg) => _value;
public override TValueType Default => _value;
public override bool Valid => _value != null;
}
internal class OptionalLambdaTypeWithLambda<TLambdaArgumentType, TValueType>
: OptionalLambdaType<TLambdaArgumentType, TValueType>
{
protected readonly Func<TLambdaArgumentType, TValueType> Lambda;
public OptionalLambdaTypeWithLambda(Func<TLambdaArgumentType, TValueType> lambda)
{
Lambda = lambda;
}
public override TValueType GetValue(TLambdaArgumentType arg) => Lambda.Invoke(arg);
public override TValueType Default => Lambda.Invoke(default(TLambdaArgumentType));
public override bool Valid => Lambda != null && Default != null;
}
internal class OptionalLambdaTypeWithCachedLambda<TLambdaArgumentType, TValueType>
: OptionalLambdaTypeWithLambda<TLambdaArgumentType, TValueType>
{
private readonly Dictionary<TLambdaArgumentType, TValueType> _cachedValues =
new Dictionary<TLambdaArgumentType, TValueType>();
public OptionalLambdaTypeWithCachedLambda(Func<TLambdaArgumentType, TValueType> lambda) : base(lambda)
{
}
public override TValueType GetValue(TLambdaArgumentType arg)
{
if (!_cachedValues.TryGetValue(arg, out var value))
{
value = base.GetValue(arg);
_cachedValues.Add(arg, value);
}
return value;
}
public override void InvalidateCache(TLambdaArgumentType arg)
{
_cachedValues.Remove(arg);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: eeb765bc919545b893b0c57629625f14
timeCreated: 1662026667

View File

@ -0,0 +1,62 @@
/*
* 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 System.Collections.Generic;
using UnityEngine;
[Serializable]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver
{
[SerializeField]
private List<TKey> keys = new List<TKey>();
[SerializeField]
private List<TValue> values = new List<TValue>();
// save the dictionary to lists
public void OnBeforeSerialize()
{
keys.Clear();
values.Clear();
foreach (var pair in this)
{
keys.Add(pair.Key);
values.Add(pair.Value);
}
}
// load dictionary from lists
public void OnAfterDeserialize()
{
this.Clear();
if (keys.Count != values.Count)
{
throw new System.Exception(string.Format(
"there are {0} keys and {1} values after deserialization. Make sure that both key and value types are serializable."));
}
for (var i = 0; i < keys.Count; i++)
{
this.Add(keys[i], values[i]);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 65ebc4746fe6453ba8e7d3433ba52579
timeCreated: 1663063037