When pressing Y or B on the controller, the package name of the selected App will be added to the excluded list and the scene will be reloaded;

This commit is contained in:
weathon
2019-07-18 10:40:47 +02:00
parent a5f112f461
commit 2740bf207c
3 changed files with 47 additions and 4 deletions
+14 -3
View File
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.017265085, g: 0.037189834, b: 0.03553985, a: 1}
m_IndirectSpecularColor: {r: 0.017265823, g: 0.037191074, b: 0.035541035, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -1033,7 +1033,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
trackingSpace: {fileID: 881994610}
primaryButton: 8192
secondaryButton: 1024
secondaryButton: 10
excludeLayers:
serializedVersion: 2
m_Bits: 0
@@ -1093,7 +1093,18 @@ MonoBehaviour:
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
onSecondarySelect:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1113839883}
m_MethodName: OnSelectedPressedBorY
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: ControllerSelection.OVRRawRaycaster+SelectionCallback, Assembly-CSharp,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
activeController: 0
+22 -1
View File
@@ -8,6 +8,7 @@ using UnityEngine.XR;
using System;
using Oculus.Platform;
using TMPro;
using UnityEngine.SceneManagement;
namespace QuestAppLauncher
{
@@ -52,7 +53,7 @@ namespace QuestAppLauncher
#region Private Functions
/// <summary>
/// Static method for lauching an Android app
/// Static method for launching an Android app
/// </summary>
/// <param name="packageId"></param>
static public void LaunchApp(string packageId)
@@ -85,6 +86,26 @@ namespace QuestAppLauncher
}
}
/// <summary>
/// Static method to add a package name to the excludedFile
/// </summary>
/// <param name="packageName"></param>
static public void AddAppToExcludedFile(string packageName)
{
var persistentDataPath = UnityEngine.Application.persistentDataPath;
Debug.Log("Persistent data path: " + persistentDataPath);
var excludedPackageNamesFilePath = Path.Combine(persistentDataPath, ExcludedPackagesFile);
using (StreamWriter writer = File.AppendText(excludedPackageNamesFilePath))
{
writer.WriteLine(packageName);
Debug.Log($"Added package {packageName} to the excluded file {excludedPackageNamesFilePath}");
}
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
/// <summary>
/// Populate the grid from installed apps
/// </summary>
+11
View File
@@ -41,6 +41,17 @@ public class OnInteraction : MonoBehaviour
}
}
public void OnSelectedPressedBorY(Transform t)
{
var appEntry = t.gameObject.GetComponent("AppEntry") as AppEntry;
if (null != appEntry)
{
// Launch app
Debug.Log("Hiding: " + appEntry.appName + " (package id: " + appEntry.packageId + ")");
QuestAppLauncher.GridPopulation.AddAppToExcludedFile(appEntry.packageId);
}
}
void EnableBorder(Transform t, bool enable)
{
var border = t.Find("Border");