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,8 @@
fileFormatVersion: 2
guid: 7a3c99cde6e983d4c9bf1c8d7f82befd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
namespace Oculus.Platform
{
using UnityEditor;
using UnityEngine;
class GUIHelper {
public delegate void Worker();
static void InOut(Worker begin, Worker body, Worker end) {
try {
begin();
body();
} finally {
end();
}
}
public static void HInset(int pixels, Worker worker) {
InOut(
() => {
GUILayout.BeginHorizontal();
GUILayout.Space(pixels);
GUILayout.BeginVertical();
},
worker,
() => {
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
);
}
public delegate T ControlWorker<T>();
public static T MakeControlWithLabel<T>(GUIContent label, ControlWorker<T> worker) {
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label);
var result = worker();
EditorGUILayout.EndHorizontal();
return result;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 19bb2c637ba6e9c459e3db36b2ec10c3
timeCreated: 1523486797
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
namespace Oculus.Platform
{
using System;
using System.Collections.Generic;
[Serializable]
public class HorizonProfileTokenResponse
{
public DataModel data;
}
[Serializable]
public class DataModel {
public XfrCreateProfileTokenModel xfr_create_profile_token;
}
[Serializable]
public class XfrCreateProfileTokenModel {
public List<ProfileTokenModel> profile_tokens;
}
[Serializable]
public class ProfileTokenModel {
public string profile_id;
public string access_token;
}
}

View File

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

View File

@ -0,0 +1,30 @@
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
namespace Oculus.Platform
{
using System;
using System.Collections.Generic;
[Serializable]
public class MetaGraphVariablesParam
{
public MetaGraphInputParam input;
public MetaGraphVariablesParam(string client_mutation_id, string profile_type, string app_id) {
input = new MetaGraphInputParam(client_mutation_id, profile_type, app_id);
}
}
[Serializable]
public class MetaGraphInputParam {
public string client_mutation_id;
public string profile_type;
public string app_id;
public MetaGraphInputParam(string client_mutation_id, string profile_type, string app_id) {
this.client_mutation_id = client_mutation_id;
this.profile_type = profile_type;
this.app_id = app_id;
}
}
}

View File

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

View File

@ -0,0 +1,25 @@
{
"name": "Oculus.Platform.Editor",
"references": [
"Oculus.Platform"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"versionDefines": [
{
"name": "com.unity.xr.management",
"expression": "",
"define": "USING_XR_MANAGEMENT"
},
{
"name": "com.unity.xr.oculus",
"expression": "",
"define": "USING_XR_SDK_OCULUS"
}
]
}

View File

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

View File

@ -0,0 +1,520 @@
#if USING_XR_MANAGEMENT && USING_XR_SDK_OCULUS
#define USING_XR_SDK
#endif
namespace Oculus.Platform
{
using System;
using System.IO;
using System.Collections.Generic;
using System.Threading;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
// This classes implements a UI to edit the PlatformSettings class.
// The UI is accessible from a the menu bar via: Oculus Platform -> Edit Settings
[CustomEditor(typeof(PlatformSettings))]
public class OculusPlatformSettingsEditor : Editor
{
private const string DEFAULT_OCULUS_GRAPH_PREFIX = "https://graph.oculus.com";
private const string DEFAULT_META_GRAPH_PREFIX = "https://meta.graph.meta.com";
private bool isUnityEditorSettingsExpanded;
private bool isBuildSettingsExpanded;
private UnityWebRequest getAccessTokenRequest;
private void OnEnable()
{
isUnityEditorSettingsExpanded = true;
isBuildSettingsExpanded = true;
}
[UnityEditor.MenuItem("Oculus/Platform/Edit Settings")]
public static void Edit()
{
UnityEditor.Selection.activeObject = PlatformSettings.Instance;
}
public override void OnInspectorGUI()
{
//
// Application IDs section
//
EditorGUILayout.LabelField("Application ID:");
GUIContent riftAppIDLabel = new GUIContent("Oculus Rift [?]", "This AppID will be used when building to the Windows target.");
GUIContent mobileAppIDLabel = new GUIContent("Meta Quest/2/Pro [?]", "This AppID will be used when building to the Android target");
PlatformSettings.AppID = MakeTextBox(riftAppIDLabel, PlatformSettings.AppID);
PlatformSettings.MobileAppID = MakeTextBox(mobileAppIDLabel, PlatformSettings.MobileAppID);
if (GUILayout.Button("Create / Find your app on https://developer.oculus.com/manage/"))
{
UnityEngine.Application.OpenURL("https://developer.oculus.com/manage/");
}
#if UNITY_ANDROID
if (String.IsNullOrEmpty(PlatformSettings.MobileAppID))
{
EditorGUILayout.HelpBox("Please enter a valid App ID for the Meta Quest line of products", MessageType.Error);
}
else
{
var msg = "Configured to connect with App ID " + PlatformSettings.MobileAppID;
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
#else
if (String.IsNullOrEmpty(PlatformSettings.AppID))
{
EditorGUILayout.HelpBox("Please enter a valid Oculus Rift App ID.", MessageType.Error);
}
else
{
var msg = "Configured to connect with App ID " + PlatformSettings.AppID;
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
#endif
EditorGUILayout.Separator();
//
// Unity Editor Settings section
//
isUnityEditorSettingsExpanded = EditorGUILayout.Foldout(isUnityEditorSettingsExpanded, "Unity Editor Settings");
if (isUnityEditorSettingsExpanded)
{
GUIHelper.HInset(6, () =>
{
bool HasTestAccessToken = !String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserAccessToken);
if (PlatformSettings.UseStandalonePlatform)
{
if (!HasTestAccessToken &&
(String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserEmail) ||
String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserPassword)))
{
EditorGUILayout.HelpBox("Please enter a valid user credentials.", MessageType.Error);
}
else
{
var msg = "The Unity editor will use the supplied test user credentials and operate in standalone mode. Some user data will be mocked.";
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
}
else
{
var msg = "The Unity editor will use the user credentials from the Oculus application.";
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
var useStandaloneLabel = "Use Standalone Platform [?]";
var useStandaloneHint = "If this is checked your app will use a debug platform with the User info below. "
+ "Otherwise your app will connect to the Oculus Platform. This setting only applies to the Unity Editor on Windows";
PlatformSettings.UseStandalonePlatform =
MakeToggle(new GUIContent(useStandaloneLabel, useStandaloneHint), PlatformSettings.UseStandalonePlatform);
GUI.enabled = PlatformSettings.UseStandalonePlatform;
if (!HasTestAccessToken)
{
var emailLabel = "Test User Email: ";
var emailHint = "Test users can be configured at " +
"https://developer.oculus.com/manage/organizations/<your org ID>/testusers " +
"however any valid Oculus account email may be used.";
StandalonePlatformSettings.OculusPlatformTestUserEmail =
MakeTextBox(new GUIContent(emailLabel, emailHint), StandalonePlatformSettings.OculusPlatformTestUserEmail);
var passwdLabel = "Test User Password: ";
var passwdHint = "Password associated with the email address.";
StandalonePlatformSettings.OculusPlatformTestUserPassword =
MakePasswordBox(new GUIContent(passwdLabel, passwdHint), StandalonePlatformSettings.OculusPlatformTestUserPassword);
var isLoggingIn = (getAccessTokenRequest != null);
var loginLabel = (!isLoggingIn) ? "Login" : "Logging in...";
GUI.enabled = !isLoggingIn;
if (GUILayout.Button(loginLabel)) {
// Retrieve FRL Account access token
var frlAccountAccessToken = getFRLAccountAccessToken();
if (!String.IsNullOrEmpty(frlAccountAccessToken)) {
// Retrieve Horizon Profile access token
var horizonProfileAccessToken = getHorizonProfileAccessToken(frlAccountAccessToken);
if (!String.IsNullOrEmpty(horizonProfileAccessToken)) {
StandalonePlatformSettings.OculusPlatformTestUserAccessToken = horizonProfileAccessToken;
}
}
// Failed, attempt to retrieve Oculus account access token
if (String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserAccessToken)) {
var oculusAccountAccessToken = getOculusAccountAccessToken();
if (!String.IsNullOrEmpty(oculusAccountAccessToken)) {
StandalonePlatformSettings.OculusPlatformTestUserAccessToken = oculusAccountAccessToken;
}
}
StandalonePlatformSettings.OculusPlatformTestUserPassword = "";
getAccessTokenRequest.Dispose();
getAccessTokenRequest = null;
}
GUI.enabled = true;
}
else
{
var loggedInMsg = "Currently using the credentials associated with " + StandalonePlatformSettings.OculusPlatformTestUserEmail;
EditorGUILayout.HelpBox(loggedInMsg, MessageType.Info);
var logoutLabel = "Clear Credentials";
if (GUILayout.Button(logoutLabel))
{
StandalonePlatformSettings.OculusPlatformTestUserAccessToken = "";
}
}
GUI.enabled = true;
});
}
EditorGUILayout.Separator();
//
// Build Settings section
//
isBuildSettingsExpanded = EditorGUILayout.Foldout(isBuildSettingsExpanded, "Build Settings");
if (isBuildSettingsExpanded)
{
GUIHelper.HInset(6, () => {
#if !USING_XR_SDK
#if UNITY_2020_1_OR_NEWER
EditorGUILayout.HelpBox("The Oculus XR Plugin isn't enabled from XR Plugin Management in Project Settings", MessageType.Warning);
#else
if (!PlayerSettings.virtualRealitySupported)
{
EditorGUILayout.HelpBox("VR Support isn't enabled in the Player Settings", MessageType.Warning);
}
PlayerSettings.virtualRealitySupported = MakeToggle(new GUIContent("Virtual Reality Support"), PlayerSettings.virtualRealitySupported);
#endif
#endif
PlayerSettings.bundleVersion = MakeTextBox(new GUIContent("Bundle Version"), PlayerSettings.bundleVersion);
#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5
PlayerSettings.bundleIdentifier = MakeTextBox(new GUIContent("Bundle Identifier"), PlayerSettings.bundleIdentifier);
#else
BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
PlayerSettings.SetApplicationIdentifier(
buildTargetGroup,
MakeTextBox(
new GUIContent("Bundle Identifier"),
PlayerSettings.GetApplicationIdentifier(buildTargetGroup)));
#endif
bool canEnableARM64Support = false;
#if UNITY_2018_1_OR_NEWER
canEnableARM64Support = true;
#endif
if (!canEnableARM64Support)
{
var msg = "Update your Unity Editor to 2018.1.x or newer to enable Arm64 support";
EditorGUILayout.HelpBox(msg, MessageType.Warning);
if (IsArm64PluginPlatformEnabled())
{
DisablePluginPlatform(PluginPlatform.Android64);
}
}
else
{
if (!IsArm64PluginPlatformEnabled())
{
EnablePluginPlatform(PluginPlatform.Android64);
}
}
GUI.enabled = true;
});
}
EditorGUILayout.Separator();
#if UNITY_EDITOR_WIN
EditorGUILayout.HelpBox("For full Unity logs, please check C:\\Users\\<username>\\AppData\\Local\\Unity\\Editor\\Editor.log", MessageType.Info);
#endif
}
private string getFRLAccountAccessToken() {
WWWForm form = new WWWForm();
form.AddField("access_token", "FRL|778542610035039|2e189079414d3a6e5642a789322b1940");
form.AddField("contact_point_type", "EMAIL_ADDRESS");
form.AddField("contact_point", StandalonePlatformSettings.OculusPlatformTestUserEmail);
form.AddField("password", StandalonePlatformSettings.OculusPlatformTestUserPassword);
getAccessTokenRequest = UnityWebRequest.Post(DEFAULT_META_GRAPH_PREFIX + "/accounts_login", form);
getAccessTokenRequest.SendWebRequest();
for (var retries = 0; !getAccessTokenRequest.isDone && retries < 100; retries++)
{
retries++;
Thread.Sleep(200);
}
if (String.IsNullOrEmpty(getAccessTokenRequest.error)) {
var Response = JsonUtility.FromJson<OculusStandalonePlatformResponse>(getAccessTokenRequest.downloadHandler.text);
return Response.access_token;
}
return "";
}
private string getHorizonProfileAccessToken(String frlAccountAccessToken) {
var doc = "mutation FRLNuxCreateProfileTokenMutation($input: XFRCreateProfileTokenData!) { xfr_create_profile_token(data: $input) { profile_tokens { profile_id, access_token } } }";
MetaGraphVariablesParam variables = new MetaGraphVariablesParam("", "vr", "1141595335965881");
WWWForm form = new WWWForm();
form.AddField("access_token", frlAccountAccessToken);
form.AddField("doc", doc);
form.AddField("variables", JsonUtility.ToJson(variables));
getAccessTokenRequest.Dispose();
getAccessTokenRequest = UnityWebRequest.Post(DEFAULT_META_GRAPH_PREFIX + "/graphql", form);
getAccessTokenRequest.SendWebRequest();
for (var retries = 0; !getAccessTokenRequest.isDone && retries < 100; retries++)
{
retries++;
Thread.Sleep(200);
}
if (String.IsNullOrEmpty(getAccessTokenRequest.error)){
var result = JsonUtility.FromJson<HorizonProfileTokenResponse>(getAccessTokenRequest.downloadHandler.text);
var list = result.data.xfr_create_profile_token.profile_tokens;
if (list != null && list.Count > 0) {
return list[0].access_token;
}
}
return "";
}
private string getOculusAccountAccessToken() {
WWWForm form = new WWWForm();
form.AddField("email", StandalonePlatformSettings.OculusPlatformTestUserEmail);
form.AddField("password", StandalonePlatformSettings.OculusPlatformTestUserPassword);
getAccessTokenRequest.Dispose();
getAccessTokenRequest = UnityWebRequest.Post(DEFAULT_OCULUS_GRAPH_PREFIX + "/login", form);
getAccessTokenRequest.SetRequestHeader("Authorization", "Bearer OC|1141595335965881|");
getAccessTokenRequest.SendWebRequest();
for (var retries = 0; !getAccessTokenRequest.isDone && retries < 100; retries++)
{
retries++;
Thread.Sleep(200);
}
if (String.IsNullOrEmpty(getAccessTokenRequest.error)){
var Response = JsonUtility.FromJson<OculusStandalonePlatformResponse>(getAccessTokenRequest.downloadHandler.text);
return Response.access_token;
}
return "";
}
private string MakeTextBox(GUIContent label, string variable)
{
return GUIHelper.MakeControlWithLabel(label, () => {
GUI.changed = false;
var result = EditorGUILayout.TextField(variable);
SetDirtyOnGUIChange();
return result;
});
}
private string MakePasswordBox(GUIContent label, string variable)
{
return GUIHelper.MakeControlWithLabel(label, () => {
GUI.changed = false;
var result = EditorGUILayout.PasswordField(variable);
SetDirtyOnGUIChange();
return result;
});
}
private bool MakeToggle(GUIContent label, bool variable)
{
return GUIHelper.MakeControlWithLabel(label, () => {
GUI.changed = false;
var result = EditorGUILayout.Toggle(variable);
SetDirtyOnGUIChange();
return result;
});
}
private void SetDirtyOnGUIChange()
{
if (GUI.changed)
{
EditorUtility.SetDirty(PlatformSettings.Instance);
GUI.changed = false;
}
}
// TODO: Merge this with core utilities plugin updater functionality. Piggybacking here to avoid an orphaned delete in the future.
private const string PluginSubPathAndroid32 = @"/Plugins/Android32/libovrplatformloader.so";
private const string PluginSubPathAndroid64 = @"/Plugins/Android64/libovrplatformloader.so";
private const string PluginDisabledSuffix = @".disabled";
public enum PluginPlatform
{
Android32,
Android64
}
private static string GetCurrentProjectPath()
{
return Directory.GetParent(UnityEngine.Application.dataPath).FullName;
}
private static string GetPlatformRootPath()
{
// use the path to OculusPluginUpdaterStub as a relative path anchor point
var so = ScriptableObject.CreateInstance(typeof(OculusPluginUpdaterStub));
var script = MonoScript.FromScriptableObject(so);
string assetPath = AssetDatabase.GetAssetPath(script);
string editorDir = Directory.GetParent(assetPath).FullName;
string platformDir = Directory.GetParent(editorDir).FullName;
return platformDir;
}
private static string GetPlatformPluginPath(PluginPlatform platform)
{
string path = GetPlatformRootPath();
switch (platform)
{
case PluginPlatform.Android32:
path += PluginSubPathAndroid32;
break;
case PluginPlatform.Android64:
path += PluginSubPathAndroid64;
break;
default:
throw new ArgumentException("Attempted to enable platform support for unsupported platform: " + platform);
}
return path;
}
//[UnityEditor.MenuItem("Oculus/Platform/EnforcePluginPlatformSettings")]
public static void EnforcePluginPlatformSettings()
{
EnforcePluginPlatformSettings(PluginPlatform.Android32);
EnforcePluginPlatformSettings(PluginPlatform.Android64);
}
public static void EnforcePluginPlatformSettings(PluginPlatform platform)
{
string path = GetPlatformPluginPath(platform);
if (!Directory.Exists(path) && !File.Exists(path))
{
path += PluginDisabledSuffix;
}
if ((Directory.Exists(path)) || (File.Exists(path)))
{
string basePath = GetCurrentProjectPath();
string relPath = path.Substring(basePath.Length + 1);
PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
if (pi == null)
{
return;
}
// Disable support for all platforms, then conditionally enable desired support below
pi.SetCompatibleWithEditor(false);
pi.SetCompatibleWithAnyPlatform(false);
pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
#if !UNITY_2019_2_OR_NEWER
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#endif
#if UNITY_2017_3_OR_NEWER
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
#endif
switch (platform)
{
case PluginPlatform.Android32:
pi.SetCompatibleWithPlatform(BuildTarget.Android, true);
pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
break;
case PluginPlatform.Android64:
pi.SetCompatibleWithPlatform(BuildTarget.Android, true);
pi.SetPlatformData(BuildTarget.Android, "CPU", "ARM64");
break;
default:
throw new ArgumentException("Attempted to enable platform support for unsupported platform: " + platform);
}
AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
AssetDatabase.SaveAssets();
}
}
public static bool IsArm64PluginPlatformEnabled()
{
string path = GetPlatformPluginPath(PluginPlatform.Android64);
bool pathAlreadyExists = Directory.Exists(path) || File.Exists(path);
return pathAlreadyExists;
}
public static void EnablePluginPlatform(PluginPlatform platform)
{
string path = GetPlatformPluginPath(platform);
string disabledPath = path + PluginDisabledSuffix;
bool pathAlreadyExists = Directory.Exists(path) || File.Exists(path);
bool disabledPathDoesNotExist = !Directory.Exists(disabledPath) && !File.Exists(disabledPath);
if (pathAlreadyExists || disabledPathDoesNotExist)
{
return;
}
string basePath = GetCurrentProjectPath();
string relPath = path.Substring(basePath.Length + 1);
string relDisabledPath = relPath + PluginDisabledSuffix;
AssetDatabase.MoveAsset(relDisabledPath, relPath);
AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
AssetDatabase.SaveAssets();
// Force reserialization of platform settings meta data
EnforcePluginPlatformSettings(platform);
}
public static void DisablePluginPlatform(PluginPlatform platform)
{
string path = GetPlatformPluginPath(platform);
string disabledPath = path + PluginDisabledSuffix;
bool pathDoesNotExist = !Directory.Exists(path) && !File.Exists(path);
bool disabledPathAlreadyExists = Directory.Exists(disabledPath) || File.Exists(disabledPath);
if (pathDoesNotExist || disabledPathAlreadyExists)
{
return;
}
string basePath = GetCurrentProjectPath();
string relPath = path.Substring(basePath.Length + 1);
string relDisabledPath = relPath + PluginDisabledSuffix;
AssetDatabase.MoveAsset(relPath, relDisabledPath);
AssetDatabase.ImportAsset(relDisabledPath, ImportAssetOptions.ForceUpdate);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
AssetDatabase.SaveAssets();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 03780432f190e734dba71a2337880cdb
timeCreated: 1523486796
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
using UnityEngine;
using System.Collections;
public class OculusPluginUpdaterStub : ScriptableObject
{
// Stub helper class to locate script paths through Unity Editor API.
// Required to be a standalone class in a separate file or else MonoScript.FromScriptableObject() returns an empty string path.
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: af1b0142a3500574289a5ff8ae25dfa4
timeCreated: 1543975087
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
namespace Oculus.Platform
{
using System;
[Serializable]
public sealed class OculusStandalonePlatformResponse
{
public string access_token;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 81f0418e197774a4e8d643b56923cb90
timeCreated: 1523486799
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
{
"name": "Oculus.Platform",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"versionDefines": [
{
"name": "com.unity.xr.management",
"expression": "",
"define": "USING_XR_MANAGEMENT"
},
{
"name": "com.unity.xr.oculus",
"expression": "",
"define": "USING_XR_SDK_OCULUS"
}
]
}

View File

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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7d7bfdd78757d394c984c5278533cb00
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b337e7d0498c0cb419c1dc6f085cd373
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 7bbac53c3edcbf74397dbe8346c7d748
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 22e8db81c17f9364080c09419324fb63
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: a65920506fb12e54987ab0cdb5ea8b5e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARM64
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 77e9e5fd5fb83734b975f691bb43e87f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: af712c7cd7aa47a43ab6a3422bba02a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,100 @@
using System;
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
namespace Oculus.Platform.Samples.EntitlementCheck
{
public class EntitlementCheck : MonoBehaviour
{
// Implements a default behavior for entitlement check failures by simply exiting the app.
// Set to false if the app wants to provide custom logic to handle entitlement check failures.
// For example, the app can instead display a modal dialog to the user and exit gracefully.
public bool exitAppOnFailure = true;
// The app can optionally subscribe to these events to do custom entitlement check logic.
public static event Action UserFailedEntitlementCheck;
public static event Action UserPassedEntitlementCheck;
void Start()
{
try
{
// Init the Oculust Platform SDK and send an entitlement check request.
if (!Oculus.Platform.Core.IsInitialized())
{
Oculus.Platform.Core.Initialize();
}
Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementCheckCallback);
}
catch
{
// Treat any potential initialization exceptions as an entitlement check failure.
HandleEntitlementCheckResult(false);
}
}
// Called when the Oculus Platform completes the async entitlement check request and a result is available.
void EntitlementCheckCallback(Message msg)
{
// If the user passed the entitlement check, msg.IsError will be false.
// If the user failed the entitlement check, msg.IsError will be true.
HandleEntitlementCheckResult(msg.IsError == false);
}
void HandleEntitlementCheckResult(bool result)
{
if (result) // User passed entitlement check
{
Debug.Log("Oculus user entitlement check successful.");
try
{
// Raise the user passed entitlement check event if the app subscribed a handler to it.
if (UserPassedEntitlementCheck != null)
{
UserPassedEntitlementCheck();
}
}
catch
{
// Suppressing any exceptions to avoid potential exceptions in the app-provided event handler.
Debug.LogError("Suppressed exception in app-provided UserPassedEntitlementCheck() event handler.");
}
}
else // User failed entitlement check
{
try
{
// Raise the user failed entitlement check event if the app subscribed a handler to it.
if (UserFailedEntitlementCheck != null)
{
UserFailedEntitlementCheck();
}
}
catch
{
// Suppressing any exceptions to avoid potential exceptions in the app-provided event handler.
// Ensures the default entitlement check behavior will still execute, if enabled.
Debug.LogError("Suppressed exception in app-provided UserFailedEntitlementCheck() event handler.");
}
if (exitAppOnFailure)
{
// Implements a default behavior for an entitlement check failure -- log the failure and exit the app.
Debug.LogError("Oculus user entitlement check failed. Exiting now.");
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
UnityEngine.Application.Quit();
#endif
}
else
{
Debug.LogError("Oculus user entitlement check failed.");
}
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 75ccf1814f335d94ab1902064233299e
timeCreated: 1543369724
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Oculus/Platform/Samples/EntitlementCheck/Main.unity (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9df623f348e176845a764b6c2e269451
timeCreated: 1543369713
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: acbf00a215eae834ea596a48492bc446
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b881d95ad5c5ae4c84f4fdd765dd60f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a7de3e5619aa4f94c86abdaa1aad343b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0ef25c4b7b1aede43b95eeac5a1c8717
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 44e30fce5a7e2fd4db7c4fedc096ccf3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 31ecfbcb5ab27e945948d9ad4b2e316f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,477 @@
// Uncomment this if you have the Touch controller classes in your project
//#define USE_OVRINPUT
using System;
using Oculus.Platform;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/**
* This class shows a very simple way to integrate setting the Group Presence
* with a destination and how to respond to a user's app launch details that
* include the destination they wish to travel to.
*/
public class GroupPresenceSample : MonoBehaviour
{
/**
* Sets extra fields on the rich presence
*/
// A boolean to indicate whether the destination is joinable. You can check
// the current capacity against the max capacity to determine whether the room
// is joinable.
public bool IsJoinable = true;
// Users with the same destination + session ID are considered together by Oculus
// Users with the same destination and different session IDs are not
public string LobbySessionID;
public string MatchSessionID;
// Users can be suggested as part of the invite flow
public UInt64 SuggestedUserID;
public Text InVRConsole;
public Text DestinationsConsole;
private List<string> DestinationAPINames = new List<string>();
private ulong LoggedInUserID = 0;
// Start is called before the first frame update
void Start()
{
UpdateConsole("Init Oculus Platform SDK...");
Core.AsyncInitialize().OnComplete(message => {
if (message.IsError)
{
// Init failed, nothing will work
UpdateConsole(message.GetError().Message);
}
else
{
UpdateConsole("Init complete!");
/**
* Get and cache the Logged in User ID for future queries
*/
Users.GetLoggedInUser().OnComplete(OnLoggedInUser);
/**
* Get the list of destinations defined for this app from the developer portal
*/
RichPresence.GetDestinations().OnComplete(OnGetDestinations);
/**
* Listen for future join intents that might come in
*/
GroupPresence.SetJoinIntentReceivedNotificationCallback(OnJoinIntentChangeNotif);
/**
* Listen for future leave that might come in
*/
GroupPresence.SetLeaveIntentReceivedNotificationCallback(OnLeaveIntentChangeNotif);
/**
* Listen for the list of users that the current users have invitted
*/
GroupPresence.SetInvitationsSentNotificationCallback(OnInviteSentNotif);
}
});
}
/**
* Setting the group presence
*/
void SetPresence()
{
var options = new GroupPresenceOptions();
options.SetDestinationApiName(DestinationAPINames[DestinationIndex]);
if (!string.IsNullOrEmpty(MatchSessionID))
{
options.SetMatchSessionId(MatchSessionID);
}
if (!string.IsNullOrEmpty(LobbySessionID))
{
options.SetLobbySessionId(LobbySessionID);
}
// Set is Joinable to let other players deeplink and join this user via the presence
options.SetIsJoinable(IsJoinable);
UpdateConsole("Setting Group Presence to " + DestinationAPINames[DestinationIndex] + " ...");
// Here we are setting the group presence then fetching it after we successfully set it
GroupPresence.Set(options).OnComplete(message => {
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
}
else
{
// Note that Users.GetLoggedInUser() does not do a server fetch and will
// not get an updated presence status
Users.Get(LoggedInUserID).OnComplete(message2 =>
{
if (message2.IsError)
{
UpdateConsole("Success! But presence is unknown!");
}
else
{
UpdateConsole("Group Presence set to:\n" + message2.Data.Presence + "\n" + message2.Data.PresenceDeeplinkMessage + "\n" + message2.Data.PresenceDestinationApiName);
}
});
}
});
}
/**
* Clearing the rich presence
*/
void ClearPresence()
{
UpdateConsole("Clearing Group Presence...");
GroupPresence.Clear().OnComplete(message => {
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
}
else
{
// Clearing the rich presence then fetching the user's presence afterwards
Users.Get(LoggedInUserID).OnComplete(message2 =>
{
if (message2.IsError)
{
UpdateConsole("Group Presence cleared! But rich presence is unknown!");
}
else
{
UpdateConsole("Group Presence cleared!\n" + message2.Data.Presence + "\n");
}
});
}
});
}
/**
* Launch the invite panel
*/
void LaunchInvitePanel()
{
UpdateConsole("Launching Invite Panel...");
var options = new InviteOptions();
if (SuggestedUserID != 0)
{
options.AddSuggestedUser(SuggestedUserID);
}
GroupPresence.LaunchInvitePanel(options).OnComplete(message =>
{
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
}
});
}
/**
* Launch the roster panel
*/
void LaunchRosterPanel()
{
UpdateConsole("Launching Roster Panel...");
var options = new RosterOptions();
if (SuggestedUserID != 0)
{
options.AddSuggestedUser(SuggestedUserID);
}
GroupPresence.LaunchRosterPanel(options).OnComplete(message =>
{
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
}
});
}
// User has interacted with a deeplink outside this app
void OnJoinIntentChangeNotif(Message<Oculus.Platform.Models.GroupPresenceJoinIntent> message)
{
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
} else
{
var joinIntent = message.Data;
// The deeplink message, this should give enough info on how to go the
// destination in the app.
var deeplinkMessage = joinIntent.DeeplinkMessage;
// The API Name of the destination. You can set the user to this after
// navigating to the app
var destinationApiName = joinIntent.DestinationApiName;
var matchSessionID = joinIntent.MatchSessionId;
var lobbySessionID = joinIntent.LobbySessionId;
var detailsString = "-Deeplink Message:\n" + deeplinkMessage + "\n-Api Name:\n" + destinationApiName + "\n-Lobby Session Id:\n" + lobbySessionID + "\n-Match Session Id:\n" + matchSessionID;
detailsString += "\n";
UpdateConsole("Got updated Join Intent & setting the user's presence:\n" + detailsString);
var options = new GroupPresenceOptions();
if (!string.IsNullOrEmpty(destinationApiName))
{
options.SetDestinationApiName(destinationApiName);
}
if (!string.IsNullOrEmpty(matchSessionID))
{
options.SetMatchSessionId(matchSessionID);
}
if (!string.IsNullOrEmpty(lobbySessionID))
{
options.SetLobbySessionId(lobbySessionID);
}
GroupPresence.Set(options);
}
}
// User has interacted with the roster to leave the current destination / lobby / match
void OnLeaveIntentChangeNotif(Message<Oculus.Platform.Models.GroupPresenceLeaveIntent> message)
{
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
} else
{
var leaveIntent = message.Data;
var destinationApiName = leaveIntent.DestinationApiName;
MatchSessionID = leaveIntent.MatchSessionId;
LobbySessionID = leaveIntent.LobbySessionId;
var detailsString = "-Api Name:\n" + destinationApiName + "\n-Lobby Session Id:\n" + LobbySessionID + "\n-Match Session Id:\n" + MatchSessionID;
detailsString += "\n";
UpdateConsole("Clearing presence because user wishes to leave:\n" + detailsString);
// User left
GroupPresence.Clear();
}
}
// User has invited users
void OnInviteSentNotif(Message<Oculus.Platform.Models.LaunchInvitePanelFlowResult> message)
{
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
} else
{
var users = message.Data.InvitedUsers;
var usersCount = users.Count;
var usersInvitedString = "-Users:\n";
if (usersCount > 0)
{
foreach(var user in users)
{
usersInvitedString += user.OculusID + "\n";
}
} else
{
usersInvitedString += "none\n";
}
UpdateConsole("Users sent invite to:\n" + usersInvitedString);
}
}
void OnGetDestinations(Message<Oculus.Platform.Models.DestinationList> message)
{
if (message.IsError)
{
UpdateConsole("Could not get the list of destinations!");
}
else
{
foreach(Oculus.Platform.Models.Destination destination in message.Data)
{
DestinationAPINames.Add(destination.ApiName);
UpdateDestinationsConsole();
}
}
}
#region Helper Functions
private int DestinationIndex = 0;
private bool OnlyPushUpOnce = false;
// Update is called once per frame
void Update()
{
if (PressAButton())
{
if (DestinationAPINames.Count > 0)
{
SetPresence();
}
else
{
UpdateConsole("No destinations to set to!");
return;
}
}
else if (PressBButton())
{
ClearPresence();
}
else if (PressXButton())
{
LaunchInvitePanel();
}
else if (PressYButton())
{
LaunchRosterPanel();
}
ScrollThroughDestinations();
}
private void ScrollThroughDestinations()
{
if (PressUp())
{
if (!OnlyPushUpOnce)
{
DestinationIndex--;
if (DestinationIndex < 0)
{
DestinationIndex = DestinationAPINames.Count - 1;
}
OnlyPushUpOnce = true;
UpdateDestinationsConsole();
}
}
else if (PressDown())
{
if (!OnlyPushUpOnce)
{
DestinationIndex++;
if (DestinationIndex >= DestinationAPINames.Count)
{
DestinationIndex = 0;
}
OnlyPushUpOnce = true;
UpdateDestinationsConsole();
}
}
else
{
OnlyPushUpOnce = false;
}
}
private void UpdateDestinationsConsole()
{
if (DestinationAPINames.Count == 0)
{
DestinationsConsole.text = "Add some destinations to the developer dashboard first!";
}
string destinations = "Destination API Names:\n";
for (int i = 0; i < DestinationAPINames.Count; i++)
{
if (i == DestinationIndex)
{
destinations += "==>";
}
destinations += DestinationAPINames[i] + "\n";
}
DestinationsConsole.text = destinations;
}
private void OnLoggedInUser(Message<Oculus.Platform.Models.User> message)
{
if (message.IsError)
{
Debug.LogError("Cannot get logged in user");
}
else
{
LoggedInUserID = message.Data.ID;
}
}
private void UpdateConsole(string value)
{
Debug.Log(value);
InVRConsole.text =
"Scroll Up/Down on Right Thumbstick\n(A) - Set Group Presence to selected\n(B) - Clear Group Presence\n(X) - Launch Invite Panel\n(Y) - Launch Roster Panel\n\n" + value;
}
#endregion
#region I/O Inputs
private bool PressAButton()
{
#if USE_OVRINPUT
return OVRInput.GetUp(OVRInput.Button.One) || Input.GetKeyUp(KeyCode.A);
#else
return Input.GetKeyUp(KeyCode.A);
#endif
}
private bool PressBButton()
{
#if USE_OVRINPUT
return OVRInput.GetUp(OVRInput.Button.Two) || Input.GetKeyUp(KeyCode.B);
#else
return Input.GetKeyUp(KeyCode.B);
#endif
}
private bool PressXButton()
{
#if USE_OVRINPUT
return OVRInput.GetUp(OVRInput.Button.Three) || Input.GetKeyUp(KeyCode.X);
#else
return Input.GetKeyUp(KeyCode.X);
#endif
}
private bool PressYButton()
{
#if USE_OVRINPUT
return OVRInput.GetUp(OVRInput.Button.Four) || Input.GetKeyUp(KeyCode.Y);
#else
return Input.GetKeyUp(KeyCode.Y);
#endif
}
private bool PressUp()
{
#if USE_OVRINPUT
Vector2 axis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
return (axis.y > 0.2 || Input.GetKeyUp(KeyCode.UpArrow));
#else
return Input.GetKeyUp(KeyCode.UpArrow);
#endif
}
private bool PressDown()
{
#if USE_OVRINPUT
Vector2 axis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
return (axis.y < -0.2 || Input.GetKeyUp(KeyCode.DownArrow));
#else
return Input.GetKeyUp(KeyCode.DownArrow);
#endif
}
#endregion
}

View File

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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 36bbe41b5545ff8498a110c30cbf42ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd921ec0d7d0f6843a7abbefee6127af
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c47390a2343c62e4fbb11987a08070f3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3d4fbf53e649040b698b2ba26c1531a9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3eeb4dcd2fdb97c47bb05787ba1073e0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,66 @@
// Uncomment this if you have the Touch controller classes in your project
//#define USE_OVRINPUT
using System;
using Oculus.Platform;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/**
* This class shows a very simple way to integrate the Reporting Callback
* by registering a listener and responding to the notification
*/
public class ReportingCallbackSample : MonoBehaviour
{
public Text InVRConsole;
public Text DestinationsConsole;
// Start is called before the first frame update
void Start()
{
UpdateConsole("Init Oculus Platform SDK...");
Core.AsyncInitialize().OnComplete(message => {
if (message.IsError)
{
// Init failed, nothing will work
UpdateConsole(message.GetError().Message);
}
else
{
UpdateConsole("Init complete!");
/**
* Listen for when user clicks AUI report button
*/
AbuseReport.SetReportButtonPressedNotificationCallback(OnReportButtonIntentNotif);
UpdateConsole("Registered callback");
}
});
}
// User has interacted with the AUI outside this app
void OnReportButtonIntentNotif(Message<string> message)
{
if (message.IsError)
{
UpdateConsole(message.GetError().Message);
} else
{
UpdateConsole("Send that response is handled");
AbuseReport.ReportRequestHandled(ReportRequestResponse.Handled);
UpdateConsole("Response has been handled!");
}
}
#region Helper Functions
private void UpdateConsole(string value)
{
Debug.Log(value);
InVRConsole.text =
"Welcome to the Sample Reporting Callback App\n\n" + value;
}
#endregion
}

View File

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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 279e53f0ff7bc93439dab3a3edc8844b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,419 @@
namespace Oculus.Platform.Samples.SimplePlatformSample
{
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using Oculus.Platform;
using Oculus.Platform.Models;
public class DataEntry : MonoBehaviour
{
public Text dataOutput;
void Start()
{
Core.Initialize();
checkEntitlement();
}
// Update is called once per frame
void Update()
{
string currentText = GetComponent<InputField>().text;
if (Input.GetKey(KeyCode.Return))
{
if (currentText != "")
{
SubmitCommand(currentText);
}
GetComponent<InputField>().text = "";
}
// Handle all messages being returned
Request.RunCallbacks();
}
private void SubmitCommand(string command)
{
string[] commandParams = command.Split(' ');
if (commandParams.Length > 0)
{
switch (commandParams[0])
{
case "m":
getLoggedInUser();
break;
case "u":
if (commandParams.Length > 1)
{
getUser(commandParams[1]);
}
break;
case "d":
getLoggedInFriends();
break;
case "n":
getUserNonce();
break;
case "e":
checkEntitlement();
break;
case "a":
if (commandParams.Length > 1)
{
getAchievementDefinition(commandParams[1]);
}
break;
case "b":
if (commandParams.Length > 1)
{
getAchievementProgress(commandParams[1]);
}
break;
case "3":
if (commandParams.Length > 1)
{
unlockAchievement(commandParams[1]);
}
break;
case "4":
if (commandParams.Length > 2)
{
addCountAchievement(commandParams[1], commandParams[2]);
}
break;
case "5":
if (commandParams.Length > 2)
{
addFieldsAchievement(commandParams[1], commandParams[2]);
}
break;
case "1":
if (commandParams.Length > 2)
{
writeLeaderboardEntry(commandParams[1], commandParams[2]);
}
break;
case "2":
if (commandParams.Length > 1)
{
getLeaderboardEntries(commandParams[1]);
}
break;
default:
printOutputLine("Invalid Command");
break;
}
}
}
void getLeaderboardEntries(string leaderboardName)
{
Leaderboards.GetEntries(leaderboardName, 10, LeaderboardFilterType.None, LeaderboardStartAt.Top).OnComplete(leaderboardGetCallback);
}
void writeLeaderboardEntry(string leaderboardName, string value)
{
byte[] extraData = new byte[] { 0x54, 0x65, 0x73, 0x74 };
Leaderboards.WriteEntry(leaderboardName, Convert.ToInt32(value), extraData, false).OnComplete(leaderboardWriteCallback);
}
void addFieldsAchievement(string achievementName, string fields)
{
Achievements.AddFields(achievementName, fields).OnComplete(achievementFieldsCallback);
}
void addCountAchievement(string achievementName, string count)
{
Achievements.AddCount(achievementName, Convert.ToUInt64(count)).OnComplete(achievementCountCallback);
}
void unlockAchievement(string achievementName)
{
Achievements.Unlock(achievementName).OnComplete(achievementUnlockCallback);
}
void getAchievementProgress(string achievementName)
{
string[] Names = new string[1];
Names[0] = achievementName;
Achievements.GetProgressByName(Names).OnComplete(achievementProgressCallback);
}
void getAchievementDefinition(string achievementName)
{
string[] Names = new string[1];
Names[0] = achievementName;
Achievements.GetDefinitionsByName(Names).OnComplete(achievementDefinitionCallback);
}
void checkEntitlement()
{
Entitlements.IsUserEntitledToApplication().OnComplete(getEntitlementCallback);
}
void getUserNonce()
{
printOutputLine("Trying to get user nonce");
Users.GetUserProof().OnComplete(userProofCallback);
}
void getLoggedInUser()
{
printOutputLine("Trying to get currently logged in user");
Users.GetLoggedInUser().OnComplete(getUserCallback);
}
void getUser(string userID)
{
printOutputLine("Trying to get user " + userID);
Users.Get(Convert.ToUInt64(userID)).OnComplete(getUserCallback);
}
void getLoggedInFriends()
{
printOutputLine("Trying to get friends of logged in user");
Users.GetLoggedInUserFriends().OnComplete(getFriendsCallback);
}
void printOutputLine(String newLine)
{
dataOutput.text = "> " + newLine + System.Environment.NewLine + dataOutput.text;
}
void outputUserArray(UserList users)
{
foreach (User user in users)
{
printOutputLine("User: " + user.ID + " " + user.OculusID + " " + user.Presence);
}
}
// Callbacks
void userProofCallback(Message<UserProof> msg)
{
if (!msg.IsError)
{
printOutputLine("Received user nonce generation success");
UserProof userNonce = msg.Data;
printOutputLine("Nonce: " + userNonce.Value);
}
else
{
printOutputLine("Received user nonce generation error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void getEntitlementCallback(Message msg)
{
if (!msg.IsError)
{
printOutputLine("You are entitled to use this app.");
}
else
{
printOutputLine("You are NOT entitled to use this app.");
}
}
void leaderboardGetCallback(Message<LeaderboardEntryList> msg)
{
if (!msg.IsError)
{
printOutputLine("Leaderboard entry get success.");
var entries = msg.Data;
foreach (var entry in entries)
{
printOutputLine(entry.Rank + ". " + entry.User.OculusID + " " + entry.Score + " " + entry.Timestamp);
}
}
else
{
printOutputLine("Received leaderboard get error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void leaderboardWriteCallback(Message msg)
{
if (!msg.IsError)
{
printOutputLine("Leaderboard entry write success.");
var didUpdate = (Message<bool>)msg;
if (didUpdate.Data)
{
printOutputLine("Score updated.");
}
else
{
printOutputLine("Score NOT updated.");
}
}
else
{
printOutputLine("Received leaderboard write error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void achievementFieldsCallback(Message msg)
{
if (!msg.IsError)
{
printOutputLine("Achievement fields added.");
}
else
{
printOutputLine("Received achievement fields add error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void achievementCountCallback(Message msg)
{
if (!msg.IsError)
{
printOutputLine("Achievement count added.");
}
else
{
printOutputLine("Received achievement count add error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void achievementUnlockCallback(Message msg)
{
if (!msg.IsError)
{
printOutputLine("Achievement unlocked");
}
else
{
printOutputLine("Received achievement unlock error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void achievementProgressCallback(Message<AchievementProgressList> msg)
{
if (!msg.IsError)
{
printOutputLine("Received achievement progress success");
AchievementProgressList progressList = msg.GetAchievementProgressList();
foreach (var progress in progressList)
{
if (progress.IsUnlocked)
{
printOutputLine("Achievement Unlocked");
}
else
{
printOutputLine("Achievement Locked");
}
printOutputLine("Current Bitfield: " + progress.Bitfield.ToString());
printOutputLine("Current Count: " + progress.Count.ToString());
}
}
else
{
printOutputLine("Received achievement progress error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void achievementDefinitionCallback(Message<AchievementDefinitionList> msg)
{
if (!msg.IsError)
{
printOutputLine("Received achievement definitions success");
AchievementDefinitionList definitionList = msg.GetAchievementDefinitions();
foreach (var definition in definitionList)
{
switch (definition.Type)
{
case AchievementType.Simple:
printOutputLine("Achievement Type: Simple");
break;
case AchievementType.Bitfield:
printOutputLine("Achievement Type: Bitfield");
printOutputLine("Bitfield Length: " + definition.BitfieldLength.ToString());
printOutputLine("Target: " + definition.Target.ToString());
break;
case AchievementType.Count:
printOutputLine("Achievement Type: Count");
printOutputLine("Target: " + definition.Target.ToString());
break;
case AchievementType.Unknown:
default:
printOutputLine("Achievement Type: Unknown");
break;
}
}
}
else
{
printOutputLine("Received achievement definitions error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void getUserCallback(Message<User> msg)
{
if (!msg.IsError)
{
printOutputLine("Received get user success");
User user = msg.Data;
printOutputLine("User: " + user.ID + " " + user.OculusID + " " + user.Presence);
}
else
{
printOutputLine("Received get user error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
void getFriendsCallback(Message<UserList> msg)
{
if (!msg.IsError)
{
printOutputLine("Received get friends success");
UserList users = msg.Data;
outputUserArray(users);
}
else
{
printOutputLine("Received get friends error");
Error error = msg.GetError();
printOutputLine("Error: " + error.Message);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e10d7d54285902b48a88ddf18008a848
timeCreated: 1446741207
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 318d73ef645634c49839069272d9e4f4
timeCreated: 1446741350
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f7dc8415838a204fb29cb3e8fee9179
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d6843ca493b2f50498eab9bad928bd9b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d9244e220b0fee34c98de6ed84ee6cdd
timeCreated: 1480276073
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 96a29a99957531246921ced0fac365ab
timeCreated: 1480201871
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 94decd43dfca0db43a3936edb109ca2e
timeCreated: 1479840163
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e8e18544645909d4ca3288d03cc2bb95
timeCreated: 1480276241
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 4c243c46c5f7948488696c53b4fa9786
timeCreated: 1542071393
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- m_prefabA: {instanceID: 0}
- m_prefabB: {instanceID: 0}
- m_prefabPower: {instanceID: 0}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3e54f4e408fb12842b72b24ac5dcbcf6
timeCreated: 1479423466
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e4f7411db9bf50545a8b0b3c5b3c1ff8
timeCreated: 1479421035
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 46b8fed8b150a8c4688eae89457bd466
timeCreated: 1479414194
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14f11521bf6434746b4feadad51390ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c6adb4589fc569248a229c085c52622c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 71702635af79217469ed41ba39db8d5a
timeCreated: 1475264776
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 66d441ddf01234331b50e929139f4780
timeCreated: 1477071923
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b4164fa75939f1e46a3e36dfbdc7f821
timeCreated: 1474514990
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7ebf96caaf397684b86c4ff4d566798f
timeCreated: 1474514266
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a63d0cd5dd6d39a4abd35114563fe347
timeCreated: 1475105001
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dc96f5380d7d743d9ae91f11379eb85b
timeCreated: 1477078886
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fbea2c3cb080a064f84d3bd86c2f3a53
timeCreated: 1475173562
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b5525a4fa9d4898438f479b1c25ff8b4
timeCreated: 1476809789
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ac564d79b10fc01448f93b8dcc74d3d0
timeCreated: 1475264810
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5e31d7fbc2f31b7499684c9e87fc8454
timeCreated: 1475257003
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fa69df7dcb6814fab9439789f1e23e2e
timeCreated: 1475629968
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f418f541d32d24e7aad85c24970462d1
timeCreated: 1475634295
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
namespace Oculus.Platform.Deprecated { }

Some files were not shown because too many files have changed in this diff Show More