clean project
This commit is contained in:
111
Assets/Oculus/SampleFramework/Usage/AppDeeplink/AppDeeplinkUI.cs
Normal file
111
Assets/Oculus/SampleFramework/Usage/AppDeeplink/AppDeeplinkUI.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AppDeeplinkUI : MonoBehaviour
|
||||
{
|
||||
// these are just for illustration, you'll need to modify them to match your own app ids
|
||||
const ulong UNITY_COMPANION_APP_ID = 3535750239844224;
|
||||
const ulong UNREAL_COMPANION_APP_ID = 4055411724486843;
|
||||
|
||||
RectTransform deeplinkAppId;
|
||||
RectTransform deeplinkMessage;
|
||||
|
||||
RectTransform uiLaunchType;
|
||||
RectTransform uiLaunchSource;
|
||||
RectTransform uiDeepLinkMessage;
|
||||
|
||||
bool inMenu = true;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
DebugUIBuilder ui = DebugUIBuilder.instance;
|
||||
uiLaunchType = ui.AddLabel("UnityDeeplinkSample");
|
||||
ui.AddDivider();
|
||||
ui.AddButton("launch OtherApp", LaunchOtherApp);
|
||||
ui.AddButton("launch UnrealDeeplinkSample", LaunchUnrealDeeplinkSample);
|
||||
deeplinkAppId = CustomDebugUI.instance.AddTextField(UNITY_COMPANION_APP_ID.ToString(), 0);
|
||||
deeplinkMessage = CustomDebugUI.instance.AddTextField("MSG_UNITY_SAMPLE", 0);
|
||||
|
||||
ui.AddButton("LaunchSelf", LaunchSelf);
|
||||
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
// init ovr platform
|
||||
if (!Oculus.Platform.Core.IsInitialized())
|
||||
{
|
||||
Oculus.Platform.Core.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
uiLaunchType = ui.AddLabel("LaunchType: ");
|
||||
uiLaunchSource = ui.AddLabel("LaunchSource: ");
|
||||
uiDeepLinkMessage = ui.AddLabel("DeeplinkMessage: ");
|
||||
|
||||
ui.ToggleLaserPointer(true);
|
||||
|
||||
ui.Show();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
DebugUIBuilder ui = DebugUIBuilder.instance;
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
// retrieve + update launch details
|
||||
Oculus.Platform.Models.LaunchDetails launchDetails = Oculus.Platform.ApplicationLifecycle.GetLaunchDetails();
|
||||
uiLaunchType.GetComponentInChildren<Text>().text = "LaunchType: " + launchDetails.LaunchType;
|
||||
uiLaunchSource.GetComponentInChildren<Text>().text = "LaunchSource: " + launchDetails.LaunchSource;
|
||||
uiDeepLinkMessage.GetComponentInChildren<Text>().text = "DeeplinkMessage: " + launchDetails.DeeplinkMessage;
|
||||
}
|
||||
|
||||
if (OVRInput.GetDown(OVRInput.Button.Two) || OVRInput.GetDown(OVRInput.Button.Start))
|
||||
{
|
||||
if (inMenu)
|
||||
{
|
||||
DebugUIBuilder.instance.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUIBuilder.instance.Show();
|
||||
}
|
||||
inMenu = !inMenu;
|
||||
}
|
||||
}
|
||||
|
||||
void LaunchUnrealDeeplinkSample()
|
||||
{
|
||||
Debug.Log(string.Format("LaunchOtherApp({0})", UNREAL_COMPANION_APP_ID));
|
||||
var options = new Oculus.Platform.ApplicationOptions();
|
||||
options.SetDeeplinkMessage(deeplinkMessage.GetComponentInChildren<Text>().text);
|
||||
Oculus.Platform.Application.LaunchOtherApp(UNREAL_COMPANION_APP_ID, options);
|
||||
}
|
||||
|
||||
void LaunchSelf()
|
||||
{
|
||||
// launch self, assumes android platform
|
||||
ulong appId;
|
||||
if (ulong.TryParse(Oculus.Platform.PlatformSettings.MobileAppID, out appId))
|
||||
{
|
||||
Debug.Log(string.Format("LaunchSelf({0})", appId));
|
||||
var options = new Oculus.Platform.ApplicationOptions();
|
||||
options.SetDeeplinkMessage(deeplinkMessage.GetComponentInChildren<Text>().text);
|
||||
Oculus.Platform.Application.LaunchOtherApp(appId, options);
|
||||
}
|
||||
}
|
||||
|
||||
void LaunchOtherApp()
|
||||
{
|
||||
ulong appId;
|
||||
if(ulong.TryParse(deeplinkAppId.GetComponentInChildren<Text>().text, out appId))
|
||||
{
|
||||
Debug.Log(string.Format("LaunchOtherApp({0})", appId));
|
||||
var options = new Oculus.Platform.ApplicationOptions();
|
||||
options.SetDeeplinkMessage(deeplinkMessage.GetComponentInChildren<Text>().text);
|
||||
Oculus.Platform.Application.LaunchOtherApp(appId, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 027619fb17fc6bc45ae5b76ade2abc42
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/SampleFramework/Usage/AppDeeplink/UI.meta
Normal file
8
Assets/Oculus/SampleFramework/Usage/AppDeeplink/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6364657505b0dec47a9c599164dd6cbf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
public class CustomDebugUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private RectTransform textPrefab = null;
|
||||
public static CustomDebugUI instance;
|
||||
const System.Reflection.BindingFlags privateFlags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Debug.Assert(instance == null);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RectTransform AddTextField(string label, int targetCanvas = 0)
|
||||
{
|
||||
RectTransform textRT = GameObject.Instantiate(textPrefab).GetComponent<RectTransform>();
|
||||
InputField inputField = textRT.GetComponentInChildren<InputField>();
|
||||
inputField.text = label;
|
||||
|
||||
DebugUIBuilder ui = DebugUIBuilder.instance;
|
||||
var addRect = typeof(DebugUIBuilder).GetMethod("AddRect", privateFlags);
|
||||
addRect.Invoke(ui, new object[] { textRT, targetCanvas });
|
||||
|
||||
return textRT;
|
||||
}
|
||||
|
||||
public void RemoveFromCanvas(RectTransform element, int targetCanvas = 0)
|
||||
{
|
||||
DebugUIBuilder ui = DebugUIBuilder.instance;
|
||||
var field = typeof(DebugUIBuilder).GetField("insertedElements", privateFlags);
|
||||
var relayout = typeof(DebugUIBuilder).GetMethod("Relayout", privateFlags);
|
||||
List<RectTransform>[] elements = (List<RectTransform>[])field.GetValue(ui);
|
||||
if(targetCanvas > -1 && targetCanvas < elements.Length-1)
|
||||
{
|
||||
elements[targetCanvas].Remove(element);
|
||||
element.SetParent(null);
|
||||
relayout.Invoke(ui, new object[] { });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f58ede4971e20144484e6aec209350be
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,242 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1183667704825978
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 224949956480874824}
|
||||
- component: {fileID: 222246025831963310}
|
||||
- component: {fileID: 114281595367056368}
|
||||
- component: {fileID: 114123833541131900}
|
||||
- component: {fileID: 7857421572797180537}
|
||||
m_Layer: 5
|
||||
m_Name: DebugTextField
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &224949956480874824
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1183667704825978}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 224567402453363320}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 500, y: 64}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &222246025831963310
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1183667704825978}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &114281595367056368
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1183667704825978}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &114123833541131900
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1183667704825978}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: 70
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: 70
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &7857421572797180537
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1183667704825978}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.5283019, g: 0.5283019, b: 0.5283019, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 114281595367056368}
|
||||
m_TextComponent: {fileID: 114081962640882000}
|
||||
m_Placeholder: {fileID: 0}
|
||||
m_ContentType: 0
|
||||
m_InputType: 0
|
||||
m_AsteriskChar: 42
|
||||
m_KeyboardType: 0
|
||||
m_LineType: 0
|
||||
m_HideMobileInput: 0
|
||||
m_CharacterValidation: 0
|
||||
m_CharacterLimit: 64
|
||||
m_OnEndEdit:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_CustomCaretColor: 0
|
||||
m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
|
||||
m_Text: Text
|
||||
m_CaretBlinkRate: 0.85
|
||||
m_CaretWidth: 1
|
||||
m_ReadOnly: 0
|
||||
--- !u!1 &1396285114258200
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 224567402453363320}
|
||||
- component: {fileID: 222903870321449632}
|
||||
- component: {fileID: 114081962640882000}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &224567402453363320
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1396285114258200}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 224949956480874824}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &222903870321449632
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1396285114258200}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &114081962640882000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1396285114258200}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 6921a454aa104cf47a67f59c64acaa17, type: 3}
|
||||
m_FontSize: 42
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 4
|
||||
m_MaxSize: 42
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 0
|
||||
m_HorizontalOverflow: 1
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Text
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad318b8a60c4f774cbbf0d9e4d4fcca9
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user