Merge pull request #86 from unity/Clean-Old-WindowsMR-Project

Deleting the old WindowsMR project out of cross platform
This commit is contained in:
Wesley Mareovich Smith 2019-05-08 16:10:10 -07:00 коммит произвёл GitHub Enterprise
Родитель 32344e87a4 939298151b
Коммит 77aa286d2a
121 изменённых файлов: 0 добавлений и 9678 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,236 +0,0 @@
using NDesk.Options;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
public class Build
{
public static string Name = "test";
private static string buildTarget;
private static string[] enabledXrTargets;
private static string[] playerGraphicsApis;
private static string[] stereoRenderingPaths;
[MenuItem("Build/Build Project")]
public static void BuildProject()
{
string path = Application.dataPath + "/../Builds/";
string extension = string.Empty;
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.StandaloneOSX:
extension = ".app";
break;
case BuildTarget.StandaloneWindows64:
case BuildTarget.StandaloneWindows:
extension = ".exe";
break;
case BuildTarget.iOS:
extension = ".ipa";
break;
case BuildTarget.Android:
extension = ".apk";
break;
case BuildTarget.StandaloneLinux:
break;
case BuildTarget.WSAPlayer:
break;
case BuildTarget.StandaloneLinux64:
case BuildTarget.StandaloneLinuxUniversal:
break;
case BuildTarget.PS4:
break;
}
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WSAPlayer)
{
HoloToolkit.Unity.HoloToolkitCommands.BuildSLNAndAPPX(path + $"{Name}");
}
else
{
// Build player.
BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, path + $"{Name}" + $"{extension}", EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
}
}
[MenuItem("Build/Default Setup")]
public static void CommandLineSetup()
{
var args = Environment.GetCommandLineArgs();
var optionSet = DefineOptionSet();
var unprocessedArgs = optionSet.Parse(args);
if (args.Length == unprocessedArgs.Count)
{
switch (EditorUserBuildSettings.selectedBuildTargetGroup)
{
case BuildTargetGroup.Standalone:
PlatformSettings.enabledXrTargets = new string[] { "MockHMD", "None" };
PlatformSettings.stereoRenderingPath = StereoRenderingPath.SinglePass;
PlatformSettings.playerGraphicsApi =
(EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows)
? GraphicsDeviceType.Direct3D11
: GraphicsDeviceType.OpenGLCore;
PlatformSettings.mtRendering = true;
PlatformSettings.graphicsJobs = false;
break;
case BuildTargetGroup.WSA:
// Configure WSA build
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.WSAPlayer && EditorUserBuildSettings.selectedBuildTargetGroup != BuildTargetGroup.WSA)
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.WSA, BuildTarget.WSAPlayer);
}
EditorUserBuildSettings.wsaUWPBuildType = WSAUWPBuildType.D3D;
EditorUserBuildSettings.wsaSubtarget = WSASubtarget.AnyDevice;
EditorUserBuildSettings.allowDebugging = true;
PlayerSettings.SetScriptingBackend(BuildTargetGroup.WSA, ScriptingImplementation.IL2CPP);
PlatformSettings.stereoRenderingPath = StereoRenderingPath.SinglePass;
PlatformSettings.enabledXrTargets = new string[] { "None" };
break;
case BuildTargetGroup.Android:
case BuildTargetGroup.iOS:
PlatformSettings.enabledXrTargets = new string[] { "cardboard", "None" };
PlatformSettings.stereoRenderingPath = StereoRenderingPath.SinglePass;
PlatformSettings.playerGraphicsApi = GraphicsDeviceType.OpenGLES3;
break;
}
}
ConfigureSettings();
PlatformSettings.SerializeToAsset();
}
public static void CommandLineBuild()
{
CommandLineSetup();
foreach (var vrsdk in enabledXrTargets)
{
foreach (var stereoRenderingPath in stereoRenderingPaths)
{
foreach (var graphicDevice in playerGraphicsApis)
{
UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(
EditorUserBuildSettings.selectedBuildTargetGroup,
new[] { vrsdk });
PlayerSettings.stereoRenderingPath = TryParse<StereoRenderingPath>(stereoRenderingPath);
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new [] { TryParse<GraphicsDeviceType>(graphicDevice) });
Name = $"/{EditorUserBuildSettings.activeBuildTarget}/{vrsdk}/{stereoRenderingPath}-{graphicDevice}";
BuildProject();
}
}
}
}
private static void ConfigureSettings()
{
PlayerSettings.virtualRealitySupported = true;
UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(
PlatformSettings.BuildTargetGroup,
PlatformSettings.enabledXrTargets);
if (PlatformSettings.enabledXrTargets.FirstOrDefault() != "None")
{
EditorUserBuildSettings.SwitchActiveBuildTarget(
PlatformSettings.BuildTargetGroup,
PlatformSettings.BuildTarget);
}
PlayerSettings.stereoRenderingPath = PlatformSettings.stereoRenderingPath;
PlayerSettings.Android.minSdkVersion = PlatformSettings.minimumAndroidSdkVersion;
EditorUserBuildSettings.androidBuildType = AndroidBuildType.Development;
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
}
private static OptionSet DefineOptionSet()
{
return new OptionSet()
{
{
"enabledxrtarget=",
"XR target to enable in player settings. Values: \r\n\"Oculus\"\r\n\"OpenVR\"\r\n\"cardboard\"\r\n\"daydream\"\r\n\"MockHMD\"",
xrTarget => PlatformSettings.enabledXrTargets = new string[] {xrTarget, "None"}
},
{
"playergraphicsapi=", "Graphics API based on GraphicsDeviceType.",
graphicsDeviceType => PlatformSettings.playerGraphicsApi =
TryParse<GraphicsDeviceType>(graphicsDeviceType)
},
{
"stereorenderingpath=", "Stereo rendering path to enable. SinglePass is default",
stereoRenderingPath => PlatformSettings.stereoRenderingPath =
TryParse<StereoRenderingPath>(stereoRenderingPath)
},
{
"mtrendering", "Use multi threaded rendering; true is default.",
gfxMultithreaded =>
{
if (gfxMultithreaded.ToLower() == "true")
{
PlatformSettings.mtRendering = true;
PlatformSettings.graphicsJobs = false;
}
}
},
{
"graphicsjobs", "Use graphics jobs rendering; false is default.",
gfxJobs =>
{
if (gfxJobs.ToLower() == "true")
{
PlatformSettings.mtRendering = false;
PlatformSettings.graphicsJobs = true;
}
}
},
{
"minimumandroidsdkversion=", "Minimum Android SDK Version to use.",
minAndroidSdkVersion => PlatformSettings.minimumAndroidSdkVersion =
TryParse<AndroidSdkVersions>(minAndroidSdkVersion)
},
{
"targetandroidsdkversion=", "Target Android SDK Version to use.",
targetAndroidSdkVersion => PlatformSettings.targetAndroidSdkVersion =
TryParse<AndroidSdkVersions>(targetAndroidSdkVersion)
}
};
}
private static T TryParse<T>(string stringToParse)
{
T thisType;
try
{
thisType = (T)Enum.Parse(typeof(T), stringToParse);
}
catch (Exception e)
{
throw new ArgumentException(($"Couldn't cast {stringToParse} to {typeof(T)}"), e);
}
return thisType;
}
private static string[] ParseMultipleArgs(string args)
{
return args.Split(';');
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,282 +0,0 @@
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.Rendering;
public class BuildWindow : EditorWindow
{
private static List<XRTargetPlatform> AvailablePlatforms = new List<XRTargetPlatform>();
private int selectedTargetPlatformIndex = 0;
private Dictionary<StereoRenderingPath, bool> enabledStereoRenderingPaths = new Dictionary<StereoRenderingPath, bool>();
private Dictionary<GraphicsDeviceType, bool> enabledGraphicsDevices = new Dictionary<GraphicsDeviceType, bool>();
private Dictionary<string, bool> enabledVRSDKs = new Dictionary<string, bool>();
private bool isBuilding = false;
public struct XRTargetPlatform
{
public BuildTargetGroup targetGroup;
public BuildTarget target;
public string name;
public string[] XRPlatforms;
}
[MenuItem("Build/Build Window")]
public static void ShowWindow()
{
GetWindow<BuildWindow>("XR Build");
InitializeXRPlatformList();
}
private static void InitializeXRPlatformList()
{
AvailablePlatforms.Add(new XRTargetPlatform
{
targetGroup = BuildTargetGroup.Standalone,
target = EditorUserBuildSettings.selectedStandaloneTarget,
name = Enum.GetName(typeof(BuildTargetGroup), BuildTargetGroup.Standalone),
XRPlatforms = new string[] { "Oculus", "OpenVR" }
});
AvailablePlatforms.Add(new XRTargetPlatform
{
targetGroup = BuildTargetGroup.Android,
target = BuildTarget.Android,
name = Enum.GetName(typeof(BuildTargetGroup), BuildTargetGroup.Android),
XRPlatforms = new string[] { "Oculus", "Daydream", "Cardboard" }
});
AvailablePlatforms.Add(new XRTargetPlatform
{
targetGroup = BuildTargetGroup.WSA,
target = BuildTarget.WSAPlayer,
name = "UWP",
XRPlatforms = new string[] { "Windows Mixed Reality" }
});
AvailablePlatforms.Add(new XRTargetPlatform
{
targetGroup = BuildTargetGroup.iOS,
target = BuildTarget.iOS,
name = "iOS",
XRPlatforms = new string[] { "Cardboard" }
});
}
void OnGUI()
{
if (!AvailablePlatforms.Any())
{
InitializeXRPlatformList();
}
if (!isBuilding)
{
GUILayout.Label("Build Settings", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
string[] names = AvailablePlatforms.Select(x => x.name).ToArray();
selectedTargetPlatformIndex = EditorGUILayout.Popup("Target Platform", selectedTargetPlatformIndex, names);
if (EditorGUI.EndChangeCheck())
{
bool platformInstalled = true;
switch (AvailablePlatforms.ElementAt(selectedTargetPlatformIndex).targetGroup)
{
case BuildTargetGroup.iOS:
if (platformInstalled = IsPlatformSupportInstalled(BuildTarget.iOS) && platformInstalled)
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.iOS, BuildTarget.iOS);
}
break;
case BuildTargetGroup.Android:
if (platformInstalled = IsPlatformSupportInstalled(BuildTarget.Android) && platformInstalled)
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
}
break;
case BuildTargetGroup.WSA:
if (platformInstalled = IsPlatformSupportInstalled(BuildTarget.WSAPlayer) && platformInstalled)
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.WSA, BuildTarget.WSAPlayer);
}
break;
case BuildTargetGroup.Standalone:
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, EditorUserBuildSettings.selectedStandaloneTarget);
break;
}
if (!platformInstalled)
{
Debug.LogWarning($"Platform Support for {AvailablePlatforms.ElementAt(selectedTargetPlatformIndex).name} not installed.");
selectedTargetPlatformIndex = 0;
}
EditorUserBuildSettings.selectedBuildTargetGroup = AvailablePlatforms.ElementAt(selectedTargetPlatformIndex).targetGroup;
enabledStereoRenderingPaths.Clear();
enabledGraphicsDevices.Clear();
enabledVRSDKs.Clear();
}
foreach (var vrsdk in AvailablePlatforms[selectedTargetPlatformIndex].XRPlatforms)
{
if (!enabledVRSDKs.ContainsKey(vrsdk))
{
enabledVRSDKs.Add(vrsdk, false);
}
}
foreach (StereoRenderingPath stereoRenderingPath in Enum.GetValues(typeof(StereoRenderingPath)))
{
if (!enabledStereoRenderingPaths.ContainsKey(stereoRenderingPath))
{
enabledStereoRenderingPaths.Add(stereoRenderingPath, false);
}
}
foreach (GraphicsDeviceType device in PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget))
{
if (!enabledGraphicsDevices.ContainsKey(device))
{
enabledGraphicsDevices.Add(device, false);
}
}
EditorGUILayout.Space();
EditorGUILayout.LabelField($"Platform Settings: {AvailablePlatforms.ElementAt(selectedTargetPlatformIndex).target}", EditorStyles.boldLabel);
ShowOptionsForActiveBuildTarget();
EditorGUILayout.Space();
if (GUILayout.Button("Build with Configs"))
{
BuildSelectedConfigs();
}
}
}
private void BuildSelectedConfigs()
{
isBuilding = true;
foreach (var vrsdk in this.enabledVRSDKs)
{
if (vrsdk.Value)
{
foreach (var stereoRenderingPath in this.enabledStereoRenderingPaths)
{
if (stereoRenderingPath.Value)
{
foreach (var graphicDevice in this.enabledGraphicsDevices)
{
if (graphicDevice.Value)
{
UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(
AvailablePlatforms.ElementAt(selectedTargetPlatformIndex).targetGroup,
new[] { vrsdk.Key });
PlayerSettings.stereoRenderingPath = stereoRenderingPath.Key;
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new GraphicsDeviceType[] { graphicDevice.Key });
Build.Name = $"/{EditorUserBuildSettings.activeBuildTarget}/{vrsdk.Key}/{stereoRenderingPath.Key}-{graphicDevice.Key}";
Build.BuildProject();
}
}
}
}
}
}
isBuilding = false;
}
private bool IsPlatformSupportInstalled(BuildTarget target)
{
var moduleManager = System.Type.GetType("UnityEditor.Modules.ModuleManager,UnityEditor.dll");
var isPlatformSupportLoaded = moduleManager.GetMethod("IsPlatformSupportLoaded", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
var getTargetStringFromBuildTarget = moduleManager.GetMethod("GetTargetStringFromBuildTarget", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
return (bool)isPlatformSupportLoaded.Invoke(null, new object[] { (string)getTargetStringFromBuildTarget.Invoke(null, new object[] { target }) });
}
private void ShowOptionsForActiveBuildTarget()
{
SetGraphicsAPIsForActiveBuildTarget();
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("VR SDKs", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
for (var i = 0; i < enabledVRSDKs.Keys.Count; ++i) // (var stereoRenderingPath in enabledStereoRenderingPaths)
{
enabledVRSDKs[enabledVRSDKs.Keys.ElementAt(i)] = EditorGUILayout.Toggle(enabledVRSDKs.Keys.ElementAt(i), enabledVRSDKs[enabledVRSDKs.Keys.ElementAt(i)]);
}
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Stereo Rendering Method", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
for (var i = 0; i < enabledStereoRenderingPaths.Keys.Count; ++i) // (var stereoRenderingPath in enabledStereoRenderingPaths)
{
enabledStereoRenderingPaths[enabledStereoRenderingPaths.Keys.ElementAt(i)] = EditorGUILayout.Toggle(Enum.GetName(typeof(StereoRenderingPath), enabledStereoRenderingPaths.Keys.ElementAt(i)), enabledStereoRenderingPaths[enabledStereoRenderingPaths.Keys.ElementAt(i)]);
}
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.LabelField("Graphics API", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
for (var i = 0; i < enabledGraphicsDevices.Count; ++i) //foreach (var enabledDevice in enabledGraphicsDevices)
{
enabledGraphicsDevices[enabledGraphicsDevices.ElementAt(i).Key] = EditorGUILayout.Toggle(Enum.GetName(typeof(GraphicsDeviceType), enabledGraphicsDevices.ElementAt(i).Key), enabledGraphicsDevices[enabledGraphicsDevices.ElementAt(i).Key]);
}
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
private void SetGraphicsAPIsForActiveBuildTarget()
{
PlayerSettings.SetUseDefaultGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, false);
switch (EditorUserBuildSettings.selectedBuildTargetGroup)
{
case BuildTargetGroup.Standalone:
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64 || EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows)
{
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new GraphicsDeviceType[] { GraphicsDeviceType.Direct3D11, GraphicsDeviceType.Direct3D12, GraphicsDeviceType.OpenGLCore, GraphicsDeviceType.Vulkan });
}
else if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneOSX)
{
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLCore, GraphicsDeviceType.Metal });
}
break;
case BuildTargetGroup.iOS:
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
{
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new GraphicsDeviceType[] { GraphicsDeviceType.Metal, GraphicsDeviceType.OpenGLES3, GraphicsDeviceType.OpenGLES2 });
}
break;
case BuildTargetGroup.Android:
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
{
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES3, GraphicsDeviceType.OpenGLES2, GraphicsDeviceType.Vulkan });
}
break;
case BuildTargetGroup.WSA:
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WSAPlayer)
{
PlayerSettings.SetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget, new GraphicsDeviceType[] { GraphicsDeviceType.Direct3D11, GraphicsDeviceType.Direct3D12 });
}
break;
case BuildTargetGroup.PS4:
break;
default:
break;
}
}
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,54 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
/// <summary>
/// Extensions for the action class.
/// These methods encapsulate the null check before raising an event for an Action.
/// </summary>
public static class ActionExtensions
{
public static void RaiseEvent(this Action action)
{
if (action != null)
{
action();
}
}
public static void RaiseEvent<T>(this Action<T> action, T arg)
{
if (action != null)
{
action(arg);
}
}
public static void RaiseEvent<T1, T2>(this Action<T1, T2> action, T1 arg1, T2 arg2)
{
if (action != null)
{
action(arg1, arg2);
}
}
public static void RaiseEvent<T1, T2, T3>(this Action<T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3)
{
if (action != null)
{
action(arg1, arg2, arg3);
}
}
public static void RaiseEvent<T1, T2, T3, T4>(this Action<T1, T2, T3, T4> action, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
{
if (action != null)
{
action(arg1, arg2, arg3, arg4);
}
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,741 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
using Debug = UnityEngine.Debug;
namespace HoloToolkit.Unity
{
/// <summary>
/// Function used to communicate with the device through the REST API
/// </summary>
public static class BuildDeployPortal
{
private enum AppInstallStatus
{
Invalid,
Installing,
InstallSuccess,
InstallFail
}
private const float TimeOut = 10.0f;
private const float MaxWaitTime = 20.0f;
// Device Portal API Resources
// https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal-api-hololens#holographic-os
// https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal-api-core
private static readonly string API_GetMachineNameQuery = @"{0}/api/os/machinename";
private static readonly string API_ProcessQuery = @"{0}/api/resourcemanager/processes";
private static readonly string API_PackagesQuery = @"{0}/api/appx/packagemanager/packages";
private static readonly string API_InstallQuery = @"{0}/api/app/packagemanager/package";
private static readonly string API_InstallStatusQuery = @"{0}/api/app/packagemanager/state";
private static readonly string API_AppQuery = @"{0}/api/taskmanager/app";
private static readonly string API_FileQuery = @"{0}/api/filesystem/apps/file?knownfolderid=LocalAppData&filename=UnityPlayer.log&packagefullname={1}&path=%5C%5CTempState";
private static readonly string API_IpConfigQuery = @"{0}/api/networking/ipconfig";
/// <summary>
/// Gets the Basic auth header.
/// <remarks>If you're using SSL and making HTTPS requests you must also specify if the request is of GET type or not,
/// so we know if we should append the "auto-" prefix to bypass CSRF.</remarks>
/// </summary>
/// <param name="connectionInfo">target device connection info.</param>
/// <param name="isGetRequest">If the request you're attempting to make is a GET type</param>
/// <returns></returns>
private static string GetBasicAuthHeader(ConnectInfo connectionInfo, bool isGetRequest = false)
{
var auth = string.Format("{0}{1}:{2}", BuildDeployPrefs.UseSSL && !isGetRequest ? "auto-" : "", connectionInfo.User, connectionInfo.Password);
auth = Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(auth));
return string.Format("Basic {0}", auth);
}
/// <summary>
/// Send a Unity Web Request to GET.
/// </summary>
/// <param name="query">Full Query to GET</param>
/// <param name="auth">Authorization header</param>
/// <param name="showProgressDialog">Show the progress dialog.</param>
/// <returns>Response string.</returns>
private static string WebRequestGet(string query, string auth, bool showProgressDialog = true)
{
try
{
using (var webRequest = UnityWebRequest.Get(query))
{
webRequest.SetRequestHeader("Authorization", auth);
#if UNITY_2017_1_OR_NEWER
webRequest.timeout = (int)TimeOut;
#endif
#if UNITY_2017_2_OR_NEWER
webRequest.SendWebRequest();
#else
webRequest.Send();
#endif
while (!webRequest.isDone)
{
if (webRequest.downloadProgress > -1 && showProgressDialog)
{
EditorUtility.DisplayProgressBar("Connecting to Device Portal",
"Progress...", webRequest.downloadProgress);
}
}
if (showProgressDialog)
{
EditorUtility.ClearProgressBar();
}
if (
#if UNITY_2017_2_OR_NEWER
webRequest.isNetworkError || webRequest.isHttpError &&
#else
webRequest.isError &&
#endif
webRequest.responseCode != 401)
{
string response = string.Empty;
var responseHeaders = webRequest.GetResponseHeaders();
if (responseHeaders != null)
{
response = responseHeaders.Aggregate(string.Empty, (current, header) => string.Format("{0}{1}: {2}\n", current, header.Key, header.Value));
}
Debug.LogErrorFormat("Network Error: {0}\n{1}", webRequest.error, response);
return string.Empty;
}
switch (webRequest.responseCode)
{
case 200:
case 204:
return webRequest.downloadHandler.text;
case 401:
Debug.LogError("Unauthorized: Access is denied due to invalid credentials.");
break;
default:
Debug.LogError(webRequest.responseCode);
break;
}
}
}
catch (Exception e)
{
Debug.LogException(e);
}
return string.Empty;
}
/// <summary>
/// Send a Unity Web Request to POST.
/// </summary>
/// <param name="query">Full Query to GET</param>
/// <param name="postData">Post Data</param>
/// <param name="auth">Authorization Header</param>
/// <param name="showDialog">Show the progress dialog.</param>
/// <returns>Response string.</returns>
private static string WebRequestPost(string query, WWWForm postData, string auth, bool showDialog = true)
{
try
{
using (var webRequest = UnityWebRequest.Post(query, postData))
{
webRequest.SetRequestHeader("Authorization", auth);
#if UNITY_2017_1_OR_NEWER
webRequest.timeout = (int)TimeOut;
#endif
// HACK: Workaround for extra quotes around boundary.
string contentType = webRequest.GetRequestHeader("Content-Type");
if (contentType != null)
{
contentType = contentType.Replace("\"", "");
webRequest.SetRequestHeader("Content-Type", contentType);
}
#if UNITY_2017_2_OR_NEWER
webRequest.SendWebRequest();
#else
webRequest.Send();
#endif
while (!webRequest.isDone)
{
if (webRequest.uploadProgress > -1 && showDialog)
{
EditorUtility.DisplayProgressBar("Connecting to Device Portal",
"Uploading...", webRequest.uploadProgress);
}
else if (webRequest.downloadProgress > -1 && showDialog)
{
EditorUtility.DisplayProgressBar("Connecting to Device Portal",
"Progress...", webRequest.downloadProgress);
}
}
EditorUtility.ClearProgressBar();
if (
#if UNITY_2017_2_OR_NEWER
webRequest.isNetworkError || webRequest.isHttpError &&
#else
webRequest.isError &&
#endif
webRequest.responseCode != 401)
{
string response = string.Empty;
var responseHeaders = webRequest.GetResponseHeaders();
if (responseHeaders != null)
{
response = responseHeaders.Aggregate(string.Empty, (current, header) => string.Format("{0}{1}: {2}\n", current, header.Key, header.Value));
}
Debug.LogErrorFormat("Network Error: {0}\n{1}", webRequest.error, response);
return string.Empty;
}
switch (webRequest.responseCode)
{
case 200:
case 202:
return webRequest.downloadHandler.text;
case 401:
Debug.LogError("Unauthorized: Access is denied due to invalid credentials.");
break;
default:
Debug.LogError(webRequest.responseCode);
break;
}
}
}
catch (Exception e)
{
Debug.LogException(e);
}
return string.Empty;
}
/// <summary>
/// Send a Unity Web Request to DELETE
/// </summary>
/// <param name="query">Full Query.</param>
/// <param name="auth">Authorization Header</param>
/// <param name="showDialog">Show to progress dialog</param>
/// <returns>Successful or not.</returns>
private static bool WebRequestDelete(string query, string auth, bool showDialog = true)
{
try
{
using (var webRequest = UnityWebRequest.Delete(query))
{
webRequest.SetRequestHeader("Authorization", auth);
#if UNITY_2017_1_OR_NEWER
webRequest.timeout = (int)TimeOut;
#endif
#if UNITY_2017_2_OR_NEWER
webRequest.SendWebRequest();
#else
webRequest.Send();
#endif
while (!webRequest.isDone)
{
if (showDialog && webRequest.downloadProgress > -1)
{
EditorUtility.DisplayProgressBar("Connecting to Device Portal",
"Progress...", webRequest.downloadProgress);
}
}
EditorUtility.ClearProgressBar();
if (
#if UNITY_2017_2_OR_NEWER
webRequest.isNetworkError || webRequest.isHttpError &&
#else
webRequest.isError &&
#endif
webRequest.responseCode != 401)
{
string response = string.Empty;
var responseHeaders = webRequest.GetResponseHeaders();
if (responseHeaders != null)
{
response = responseHeaders.Aggregate(string.Empty, (current, header) => string.Format("{0}{1}: {2}\n", current, header.Key, header.Value));
}
Debug.LogErrorFormat("Network Error: {0}\n{1}", webRequest.error, response);
return false;
}
switch (webRequest.responseCode)
{
case 200:
return true;
case 401:
Debug.LogError("Unauthorized: Access is denied due to invalid credentials.");
break;
default:
Debug.LogError(webRequest.responseCode);
break;
}
}
}
catch (Exception e)
{
Debug.LogException(e);
}
return false;
}
/// <summary>
/// Opens the Device Portal for the target device.
/// </summary>
/// <param name="targetDevice"></param>
public static void OpenWebPortal(ConnectInfo targetDevice)
{
//TODO: Figure out how to pass username and password to browser?
Process.Start(FinalizeUrl(targetDevice.IP));
}
/// <summary>
/// Gets the <see cref="MachineName"/> of the target device.
/// </summary>
/// <param name="targetDevice"></param>
/// <returns><see cref="MachineName"/></returns>
public static MachineName GetMachineName(ConnectInfo targetDevice)
{
MachineName machineName = null;
string query = string.Format(API_GetMachineNameQuery, FinalizeUrl(targetDevice.IP));
string response = WebRequestGet(query, GetBasicAuthHeader(targetDevice, true), false);
if (!string.IsNullOrEmpty(response))
{
machineName = JsonUtility.FromJson<MachineName>(response);
}
return machineName;
}
[Obsolete("Use IsAppInstalled(string packageFamilyName, ConnectInfo targetDevice)")]
public static bool IsAppInstalled(string packageFamilyName, string targetIp)
{
return QueryAppDetails(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword)) != null;
}
/// <summary>
/// Determines if the target application is currently running on the target device.
/// </summary>
/// <param name="packageFamilyName"></param>
/// <param name="targetDevice"></param>
/// <returns>True, if application is currently installed on device.</returns>
public static bool IsAppInstalled(string packageFamilyName, ConnectInfo targetDevice)
{
return QueryAppDetails(packageFamilyName, targetDevice) != null;
}
[Obsolete("IsAppRunning(string appName, ConnectInfo targetDevice)")]
public static bool IsAppRunning(string appName, string targetDevice)
{
return IsAppRunning(appName, new ConnectInfo(targetDevice, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword));
}
/// <summary>
/// Determines if the target application is running on the target device.
/// </summary>
/// <param name="appName"></param>
/// <param name="targetDevice"></param>
/// <returns>True, if the application is running.</returns>
public static bool IsAppRunning(string appName, ConnectInfo targetDevice)
{
string response = WebRequestGet(string.Format(API_ProcessQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false);
if (!string.IsNullOrEmpty(response))
{
var processList = JsonUtility.FromJson<ProcessList>(response);
for (int i = 0; i < processList.Processes.Length; ++i)
{
string processName = processList.Processes[i].ImageName;
if (processName.Contains(appName))
{
return true;
}
}
}
return false;
}
/// <summary>
/// Returns the <see cref="AppDetails"/> of the target application from the target device.
/// </summary>
/// <param name="packageFamilyName"></param>
/// <param name="targetDevice"></param>
/// <returns>null if application is not currently installed on the target device.</returns>
private static AppDetails QueryAppDetails(string packageFamilyName, ConnectInfo targetDevice)
{
string response = WebRequestGet(string.Format(API_PackagesQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false);
if (!string.IsNullOrEmpty(response))
{
var appList = JsonUtility.FromJson<AppList>(response);
for (int i = 0; i < appList.InstalledPackages.Length; ++i)
{
string thisAppName = appList.InstalledPackages[i].PackageFamilyName;
if (thisAppName.Equals(packageFamilyName, StringComparison.OrdinalIgnoreCase))
{
return appList.InstalledPackages[i];
}
}
}
return null;
}
/// <summary>
/// Installs the target application on the target device.
/// </summary>
/// <param name="appFullPath"></param>
/// <param name="targetDevice"></param>
/// <param name="waitForDone">Should the thread wait until installation is complete?</param>
/// <returns>True, if Installation was a success.</returns>
public static bool InstallApp(string appFullPath, ConnectInfo targetDevice, bool waitForDone = true)
{
bool success = false;
try
{
// Calculate the cert and dependency paths
string fileName = Path.GetFileName(appFullPath);
string certFullPath = Path.ChangeExtension(appFullPath, ".cer");
string certName = Path.GetFileName(certFullPath);
string depPath = Path.GetDirectoryName(appFullPath) + @"\Dependencies\x86\";
// Post it using the REST API
var form = new WWWForm();
// APPX file
Debug.Assert(appFullPath != null);
using (var stream = new FileStream(appFullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var reader = new BinaryReader(stream))
{
form.AddBinaryData(fileName, reader.ReadBytes((int)reader.BaseStream.Length), fileName);
}
}
// CERT file
Debug.Assert(certFullPath != null);
using (var stream = new FileStream(certFullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var reader = new BinaryReader(stream))
{
form.AddBinaryData(certName, reader.ReadBytes((int)reader.BaseStream.Length), certName);
}
}
// Dependencies
FileInfo[] depFiles = new DirectoryInfo(depPath).GetFiles();
foreach (FileInfo dep in depFiles)
{
using (var stream = new FileStream(dep.FullName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var reader = new BinaryReader(stream))
{
string depFilename = Path.GetFileName(dep.FullName);
form.AddBinaryData(depFilename, reader.ReadBytes((int)reader.BaseStream.Length), depFilename);
}
}
}
// Query
string query = string.Format(API_InstallQuery, FinalizeUrl(targetDevice.IP));
query += "?package=" + WWW.EscapeURL(fileName);
var response = WebRequestPost(query, form, GetBasicAuthHeader(targetDevice));
if (string.IsNullOrEmpty(response))
{
Debug.LogErrorFormat("Failed to install {0} on {1}.\n", fileName, targetDevice.MachineName);
return false;
}
// Wait for done (if requested)
DateTime waitStartTime = DateTime.Now;
while (waitForDone && (DateTime.Now - waitStartTime).TotalSeconds < MaxWaitTime)
{
EditorUtility.DisplayProgressBar("Connecting to Device Portal", "Installing...", (float)((DateTime.Now - waitStartTime).TotalSeconds / MaxWaitTime));
AppInstallStatus status = GetInstallStatus(targetDevice);
if (status == AppInstallStatus.InstallSuccess)
{
Debug.LogFormat("Successfully installed {0} on {1}.", fileName, targetDevice.MachineName);
success = true;
break;
}
if (status == AppInstallStatus.InstallFail)
{
Debug.LogErrorFormat("Failed to install {0} on {1}.\n", fileName, targetDevice.MachineName);
break;
}
// Wait a bit and we'll ask again
Thread.Sleep(1000);
}
EditorUtility.ClearProgressBar();
}
catch (Exception e)
{
Debug.LogException(e);
success = false;
}
return success;
}
private static AppInstallStatus GetInstallStatus(ConnectInfo targetDevice)
{
string response = WebRequestGet(string.Format(API_InstallStatusQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false);
if (!string.IsNullOrEmpty(response))
{
var status = JsonUtility.FromJson<InstallStatus>(response);
if (status == null)
{
return AppInstallStatus.Installing;
}
if (status.Success)
{
return AppInstallStatus.InstallSuccess;
}
Debug.LogError(status.Reason + "(" + status.CodeText + ")");
}
else
{
return AppInstallStatus.Installing;
}
return AppInstallStatus.InstallFail;
}
[Obsolete("Use UninstallApp(string packageFamilyName, ConnectInfo targetDevice)")]
public static bool UninstallApp(string packageFamilyName, string targetIp)
{
return UninstallApp(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword));
}
/// <summary>
/// Uninstalls the target application on the target device.
/// </summary>
/// <param name="packageFamilyName"></param>
/// <param name="targetDevice"></param>
/// <param name="showDialog"></param>
/// <returns>True, if uninstall was a success.</returns>
public static bool UninstallApp(string packageFamilyName, ConnectInfo targetDevice, bool showDialog = true)
{
AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice);
if (appDetails == null)
{
Debug.Log(string.Format("Application '{0}' not found", packageFamilyName));
return false;
}
string query = string.Format("{0}?package={1}",
string.Format(API_InstallQuery, FinalizeUrl(targetDevice.IP)),
WWW.EscapeURL(appDetails.PackageFullName));
bool success = WebRequestDelete(query, GetBasicAuthHeader(targetDevice), showDialog);
MachineName targetMachine = GetMachineName(targetDevice);
if (success)
{
Debug.LogFormat("Successfully uninstalled {0} on {1}.", packageFamilyName, targetMachine.ComputerName);
}
else
{
Debug.LogErrorFormat("Failed to uninstall {0} on {1}", packageFamilyName, targetMachine.ComputerName);
}
return success;
}
/// <summary>
/// Launches the target application on the target device.
/// </summary>
/// <param name="packageFamilyName"></param>
/// <param name="targetDevice"></param>
/// <param name="showDialog"></param>
/// <returns>True, if application was successfully launched and is currently running on the target device.</returns>
public static bool LaunchApp(string packageFamilyName, ConnectInfo targetDevice, bool showDialog = true)
{
// Find the app description
AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice);
if (appDetails == null)
{
Debug.LogWarning("Application not found");
return false;
}
string query = string.Format(API_AppQuery, FinalizeUrl(targetDevice.IP)) +
string.Format("?appid={0}&package={1}",
WWW.EscapeURL(EncodeTo64(appDetails.PackageRelativeId)),
WWW.EscapeURL(appDetails.PackageFullName));
WebRequestPost(query, null, GetBasicAuthHeader(targetDevice), false);
return IsAppRunning(PlayerSettings.productName, targetDevice);
}
[Obsolete("KillApp(string packageFamilyName, ConnectInfo targetDevice)")]
public static bool KillApp(string packageFamilyName, string targetIp)
{
return KillApp(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword));
}
/// <summary>
/// Kills the target application on the target device.
/// </summary>
/// <param name="packageFamilyName"></param>
/// <param name="targetDevice"></param>
/// <param name="showDialog"></param>
/// <returns>true, if application was successfully stopped.</returns>
public static bool KillApp(string packageFamilyName, ConnectInfo targetDevice, bool showDialog = true)
{
AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice);
if (appDetails == null)
{
Debug.LogError("Application not found");
return false;
}
string query = string.Format("{0}?package={1}",
string.Format(API_AppQuery, FinalizeUrl(targetDevice.IP)),
WWW.EscapeURL(EncodeTo64(appDetails.PackageFullName)));
bool success = WebRequestDelete(query, GetBasicAuthHeader(targetDevice), showDialog);
MachineName targetMachine = GetMachineName(targetDevice);
if (success)
{
Debug.LogFormat("Successfully stopped {0} on {1}.", packageFamilyName, targetMachine.ComputerName);
}
return success;
}
[Obsolete("DeviceLogFile_View(string packageFamilyName, ConnectInfo targetDevice)")]
public static bool DeviceLogFile_View(string packageFamilyName, string targetIp)
{
return DeviceLogFile_View(packageFamilyName, new ConnectInfo(targetIp, BuildDeployPrefs.DeviceUser, BuildDeployPrefs.DevicePassword));
}
/// <summary>
/// Downloads and launches the Log file for the target application on the target device.
/// </summary>
/// <param name="packageFamilyName"></param>
/// <param name="targetDevice"></param>
/// <returns>True, if download success.</returns>
public static bool DeviceLogFile_View(string packageFamilyName, ConnectInfo targetDevice)
{
EditorUtility.DisplayProgressBar("Download Log", "Downloading Log File for " + packageFamilyName, 0.25f);
AppDetails appDetails = QueryAppDetails(packageFamilyName, targetDevice);
if (appDetails == null)
{
Debug.LogWarningFormat("{0} not installed on target device", packageFamilyName);
EditorUtility.ClearProgressBar();
return false;
}
string logFile = string.Format("{0}/{1}_{2}{3}{4}{5}{6}{7}_deviceLog.txt",
Application.temporaryCachePath,
targetDevice.MachineName,
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
DateTime.Now.Hour,
DateTime.Now.Minute,
DateTime.Now.Second);
string response = WebRequestGet(string.Format(API_FileQuery, FinalizeUrl(targetDevice.IP), appDetails.PackageFullName), GetBasicAuthHeader(targetDevice, true));
bool success = !string.IsNullOrEmpty(response);
if (success)
{
File.WriteAllText(logFile, response);
Process.Start(logFile);
}
EditorUtility.ClearProgressBar();
return success;
}
/// <summary>
/// Returns the <see cref="NetworkInfo"/> for the target device.
/// </summary>
/// <param name="targetDevice"></param>
/// <returns></returns>
public static NetworkInfo GetNetworkInfo(ConnectInfo targetDevice)
{
string response = WebRequestGet(string.Format(API_IpConfigQuery, FinalizeUrl(targetDevice.IP)), GetBasicAuthHeader(targetDevice, true), false);
if (!string.IsNullOrEmpty(response))
{
return JsonUtility.FromJson<NetworkInfo>(response);
}
return null;
}
/// <summary>
/// This Utility method finalizes the URL and formats the HTTPS string if needed.
/// <remarks>Local Machine will be changed to 127.0.1:10080 for HoloLens connections.</remarks>
/// </summary>
/// <param name="targetUrl"></param>
/// <returns></returns>
private static string FinalizeUrl(string targetUrl)
{
string ssl = BuildDeployPrefs.UseSSL ? "s" : string.Empty;
if (targetUrl.Contains("Local Machine"))
{
targetUrl = "127.0.0.1:10080";
ssl = string.Empty;
}
return string.Format(@"http{0}://{1}", ssl, targetUrl);
}
private static string EncodeTo64(string toEncode)
{
byte[] toEncodeAsBytes = Encoding.ASCII.GetBytes(toEncode);
string returnValue = Convert.ToBase64String(toEncodeAsBytes);
return returnValue;
}
private static string DecodeFrom64(string encodedData)
{
byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
string returnValue = Encoding.ASCII.GetString(encodedDataAsBytes);
return returnValue;
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,129 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.IO;
using UnityEngine;
namespace HoloToolkit.Unity
{
public static class BuildDeployPrefs
{
// Constants
private const string EditorPrefs_BuildDir = "_BuildDeployWindow_BuildDir";
private const string EditorPrefs_BuildConfig = "_BuildDeployWindow_BuildConfig";
private const string EditorPrefs_BuildPlatform = "_BuildDeployWindow_BuildPlatform";
private const string EditorPrefs_ForceRebuild = "_BuildDeployWindow_ForceBuild";
private const string EditorPrefs_IncrementBuildVersion = "_BuildDeployWindow_IncrementBuildVersion";
private const string EditorPrefs_MSBuildVer = "_BuildDeployWindow_MSBuildVer";
private const string EditorPrefs_TargetIPs = "_BuildDeployWindow_DestIPs";
private const string EditorPrefs_ConnectInfos = "_BuildDeployWindow_ConnectInfos";
private const string EditorPrefs_DeviceUser = "_BuildDeployWindow_DeviceUser";
private const string EditorPrefs_DevicePwd = "_BuildDeployWindow_DevicePwd";
private const string EditorPrefs_FullReinstall = "_BuildDeployWindow_FullReinstall";
private const string EditorPrefs_UseSSL = "_BuildDeployWindow_UseSSL";
private const string EditorPrefs_ProcessAll = "_BuildDeployWindow_ProcessAll";
public static string BuildDirectory
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildDir, "UWP"); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildDir, value); }
}
public static string AbsoluteBuildDirectory
{
get
{
string rootBuildDirectory = BuildDirectory;
int dirCharIndex = rootBuildDirectory.IndexOf("/", StringComparison.Ordinal);
if (dirCharIndex != -1)
{
rootBuildDirectory = rootBuildDirectory.Substring(0, dirCharIndex);
}
return Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), rootBuildDirectory));
}
}
public static string MsBuildVersion
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_MSBuildVer, BuildDeployTools.DefaultMSBuildVersion); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_MSBuildVer, value); }
}
public static string BuildConfig
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildConfig, "Debug"); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildConfig, value); }
}
public static string BuildPlatform
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildPlatform, "x86"); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildPlatform, value); }
}
public static bool ForceRebuild
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_ForceRebuild, false); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ForceRebuild, value); }
}
public static bool IncrementBuildVersion
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_IncrementBuildVersion, true); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_IncrementBuildVersion, value); }
}
public static bool FullReinstall
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_FullReinstall, true); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_FullReinstall, value); }
}
public static string DevicePortalConnections
{
get
{
return EditorPrefsUtility.GetEditorPref(
EditorPrefs_ConnectInfos,
JsonUtility.ToJson(
new DevicePortalConnections(
new ConnectInfo("127.0.0.1", string.Empty, string.Empty, "Local Machine"))));
}
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ConnectInfos, value); }
}
[Obsolete("Use DevicePortalConnections")]
public static string DeviceUser
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_DeviceUser, string.Empty); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_DeviceUser, value); }
}
[Obsolete("Use DevicePortalConnections")]
public static string DevicePassword
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_DevicePwd, string.Empty); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_DevicePwd, value); }
}
[Obsolete("Use DevicePortalConnections")]
public static string TargetIPs
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_TargetIPs, "127.0.0.1"); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_TargetIPs, value); }
}
public static bool UseSSL
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_UseSSL, true); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_UseSSL, value); }
}
public static bool TargetAllConnections
{
get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_ProcessAll, false); }
set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ProcessAll, value); }
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,390 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Win32;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
namespace HoloToolkit.Unity
{
/// <summary>
/// Contains utility functions for building for the device
/// </summary>
public class BuildDeployTools
{
public const string DefaultMSBuildVersion = "15.0";
public static bool CanBuild()
{
if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.IL2CPP &&
IsIl2CppAvailable())
{
return true;
}
return PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.WinRTDotNET &&
IsDotNetAvailable();
}
public static bool IsDotNetAvailable()
{
return Directory.Exists(EditorApplication.applicationContentsPath +
"\\PlaybackEngines\\MetroSupport\\Managed\\UAP");
}
public static bool IsIl2CppAvailable()
{
return Directory.Exists(EditorApplication.applicationContentsPath +
"\\PlaybackEngines\\MetroSupport\\Managed\\il2cpp");
}
/// <summary>
/// Displays a dialog if no scenes are present in the build and returns true if build can proceed.
/// </summary>
/// <returns></returns>
public static bool CheckBuildScenes()
{
if (EditorBuildSettings.scenes.Length == 0)
{
return EditorUtility.DisplayDialog("Attention!",
"No scenes are present in the build settings!\n\n Do you want to cancel and add one?",
"Continue Anyway", "Cancel Build");
}
return true;
}
/// <summary>
/// Do a build configured for Mixed Reality Applications, returns the error from BuildPipeline.BuildPlayer
/// </summary>
public static bool BuildSLN()
{
return BuildSLN(BuildDeployPrefs.BuildDirectory, false);
}
public static bool BuildSLN(string buildDirectory, bool showDialog = true)
{
// Use BuildSLNUtilities to create the SLN
bool buildSuccess = false;
if (CheckBuildScenes() == false)
{
return false;
}
var buildInfo = new BuildInfo
{
// These properties should all match what the Standalone.proj file specifies
OutputDirectory = buildDirectory,
Scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path),
BuildTarget = BuildTarget.WSAPlayer,
WSASdk = WSASDK.UWP,
WSAUWPBuildType = EditorUserBuildSettings.wsaUWPBuildType,
WSAUwpSdk = EditorUserBuildSettings.wsaUWPSDK,
// Configure a post build action that will compile the generated solution
PostBuildAction = (innerBuildInfo, buildError) =>
{
if (!string.IsNullOrEmpty(buildError))
{
//EditorUtility.DisplayDialog(PlayerSettings.productName + " WindowsStoreApp Build Failed!", buildError, "OK");
}
else
{
if (showDialog)
{
if (!EditorUtility.DisplayDialog(PlayerSettings.productName, "Build Complete", "OK",
"Build AppX"))
{
BuildAppxFromSLN(
PlayerSettings.productName,
BuildDeployPrefs.MsBuildVersion,
BuildDeployPrefs.ForceRebuild,
BuildDeployPrefs.BuildConfig,
BuildDeployPrefs.BuildPlatform,
BuildDeployPrefs.BuildDirectory,
BuildDeployPrefs.IncrementBuildVersion);
}
}
buildSuccess = true;
}
}
};
BuildSLNUtilities.RaiseOverrideBuildDefaults(ref buildInfo);
BuildSLNUtilities.PerformBuild(buildInfo);
return buildSuccess;
}
public static string CalcMSBuildPath(string msBuildVersion)
{
#if UNITY_WINDOWS
if (msBuildVersion.Equals("14.0"))
{
using (RegistryKey key =
Registry.LocalMachine.OpenSubKey(
string.Format(@"Software\Microsoft\MSBuild\ToolsVersions\{0}", msBuildVersion)))
{
if (key != null)
{
var msBuildBinFolder = (string)key.GetValue("MSBuildToolsPath");
return Path.Combine(msBuildBinFolder, "msbuild.exe");
}
}
}
#endif
// If we got this far then we don't have VS 2015 installed and need to use msBuild 15
msBuildVersion = "15.0";
// For MSBuild 15+ we should to use vswhere to give us the correct instance
string output = @"/C vswhere -version " + msBuildVersion +
" -products * -requires Microsoft.Component.MSBuild -property installationPath";
// get the right program files path based on whether the PC is x86 or x64
string programFiles = @"C:\Program Files (x86)\Microsoft Visual Studio\Installer";
var vswherePInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = false,
Arguments = output,
WorkingDirectory = programFiles
};
using (var vswhereP = new Process())
{
vswhereP.StartInfo = vswherePInfo;
vswhereP.Start();
output = vswhereP.StandardOutput.ReadToEnd();
vswhereP.WaitForExit();
}
string[] paths = output.Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);
if (paths.Length > 0)
{
// if there are multiple 2017 installs,
// prefer enterprise, then pro, then community
string bestPath = paths.OrderBy(p => p.ToLower().Contains("enterprise"))
.ThenBy(p => p.ToLower().Contains("professional"))
.ThenBy(p => p.ToLower().Contains("community")).First();
return bestPath + @"\MSBuild\" + msBuildVersion + @"\Bin\MSBuild.exe";
}
Debug.LogError("Unable to find a valid path to Visual Studio Instance!");
return string.Empty;
}
public static bool RestoreNugetPackages(string nugetPath, string storePath)
{
Debug.Assert(File.Exists(nugetPath));
Debug.Assert(Directory.Exists(storePath));
var nugetPInfo = new ProcessStartInfo
{
FileName = nugetPath,
CreateNoWindow = true,
UseShellExecute = false,
Arguments = "restore \"" + storePath + "/project.json\""
};
using (var nugetP = new Process())
{
nugetP.StartInfo = nugetPInfo;
nugetP.Start();
nugetP.WaitForExit();
nugetP.Close();
nugetP.Dispose();
}
return File.Exists(storePath + "\\project.lock.json");
}
public static bool BuildAppxFromSLN(string productName, string msBuildVersion, bool forceRebuildAppx,
string buildConfig, string buildPlatform, string buildDirectory, bool incrementVersion,
bool showDialog = true)
{
EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 0);
string slnFilename = Path.Combine(buildDirectory, PlayerSettings.productName + ".sln");
if (!File.Exists(slnFilename))
{
Debug.LogError("Unable to find Solution to build from!");
EditorUtility.ClearProgressBar();
return false;
}
// Get and validate the msBuild path...
var msBuildPath = CalcMSBuildPath(msBuildVersion);
if (!File.Exists(msBuildPath))
{
Debug.LogErrorFormat("MSBuild.exe is missing or invalid (path={0}).", msBuildPath);
EditorUtility.ClearProgressBar();
return false;
}
// Get the path to the NuGet tool
string unity = Path.GetDirectoryName(EditorApplication.applicationPath);
System.Diagnostics.Debug.Assert(unity != null, "unity != null");
string storePath = Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), buildDirectory));
string solutionProjectPath = Path.GetFullPath(Path.Combine(storePath, productName + @".sln"));
// Bug in Unity editor that doesn't copy project.json and project.lock.json files correctly if solutionProjectPath is not in a folder named UWP.
if (!File.Exists(storePath + "\\project.json"))
{
File.Copy(unity + @"\Data\PlaybackEngines\MetroSupport\Tools\project.json",
storePath + "\\project.json");
}
string nugetPath = Path.Combine(unity, @"Data\PlaybackEngines\MetroSupport\Tools\NuGet.exe");
string assemblyCSharp = storePath + "/GeneratedProjects/UWP/Assembly-CSharp";
string assemblyCSharpFirstPass = storePath + "/GeneratedProjects/UWP/Assembly-CSharp-firstpass";
bool restoreFirstPass = Directory.Exists(assemblyCSharpFirstPass);
// Before building, need to run a nuget restore to generate a json.lock file. Failing to do
// this breaks the build in VS RTM
if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.WinRTDotNET &&
(!RestoreNugetPackages(nugetPath, storePath) ||
!RestoreNugetPackages(nugetPath, storePath + "\\" + productName) ||
!RestoreNugetPackages(nugetPath, assemblyCSharp) ||
restoreFirstPass &&
!RestoreNugetPackages(nugetPath, assemblyCSharpFirstPass)))
{
Debug.LogError("Failed to restore nuget packages");
EditorUtility.ClearProgressBar();
return false;
}
EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 25);
// Ensure that the generated .appx version increments by modifying
// Package.appxmanifest
if (incrementVersion)
{
IncrementPackageVersion();
}
// Now do the actual build
var pInfo = new ProcessStartInfo
{
FileName = msBuildPath,
CreateNoWindow = false,
Arguments = string.Format("\"{0}\" /t:{1} /p:Configuration={2} /p:Platform={3} /verbosity:m",
solutionProjectPath,
forceRebuildAppx ? "Rebuild" : "Build",
buildConfig,
buildPlatform)
};
// Uncomment out to debug by copying into command window
//Debug.Log("\"" + vs + "\"" + " " + pInfo.Arguments);
var process = new Process {StartInfo = pInfo};
try
{
if (!process.Start())
{
Debug.LogError("Failed to start Cmd process!");
EditorUtility.ClearProgressBar();
return false;
}
process.WaitForExit();
EditorUtility.ClearProgressBar();
if (process.ExitCode == 0 &&
showDialog &&
!EditorUtility.DisplayDialog("Build AppX", "AppX Build Successful!", "OK", "Open AppX Folder"))
{
Process.Start("explorer.exe",
"/f /open," + Path.GetFullPath(BuildDeployPrefs.BuildDirectory + "/" +
PlayerSettings.productName + "/AppPackages"));
}
if (process.ExitCode != 0)
{
Debug.LogError("MSBuild error (code = " + process.ExitCode + ")");
EditorUtility.DisplayDialog(PlayerSettings.productName + " build Failed!",
"Failed to build appx from solution. Error code: " + process.ExitCode, "OK");
return false;
}
process.Close();
process.Dispose();
}
catch (Exception e)
{
Debug.LogError("Cmd Process EXCEPTION: " + e);
EditorUtility.ClearProgressBar();
return false;
}
return true;
}
private static void IncrementPackageVersion()
{
// Find the manifest, assume the one we want is the first one
string[] manifests = Directory.GetFiles(BuildDeployPrefs.AbsoluteBuildDirectory, "Package.appxmanifest",
SearchOption.AllDirectories);
if (manifests.Length == 0)
{
Debug.LogError("Unable to find Package.appxmanifest file for build (in path - " +
BuildDeployPrefs.AbsoluteBuildDirectory + ")");
return;
}
string manifest = manifests[0];
var rootNode = XElement.Load(manifest);
var identityNode = rootNode.Element(rootNode.GetDefaultNamespace() + "Identity");
if (identityNode == null)
{
Debug.LogError("Package.appxmanifest for build (in path - " + BuildDeployPrefs.AbsoluteBuildDirectory +
") is missing an <Identity /> node");
return;
}
// We use XName.Get instead of string -> XName implicit conversion because
// when we pass in the string "Version", the program doesn't find the attribute.
// Best guess as to why this happens is that implicit string conversion doesn't set the namespace to empty
var versionAttr = identityNode.Attribute(XName.Get("Version"));
if (versionAttr == null)
{
Debug.LogError("Package.appxmanifest for build (in path - " + BuildDeployPrefs.AbsoluteBuildDirectory +
") is missing a version attribute in the <Identity /> node.");
return;
}
// Assume package version always has a '.' between each number.
// According to https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx
// Package versions are always of the form Major.Minor.Build.Revision.
// Note: Revision number reserved for Windows Store, and a value other than 0 will fail WACK.
var version = PlayerSettings.WSA.packageVersion;
var newVersion = new Version(version.Major, version.Minor, version.Build + 1, version.Revision);
PlayerSettings.WSA.packageVersion = newVersion;
versionAttr.Value = newVersion.ToString();
rootNode.Save(manifest);
}
}
}

Просмотреть файл

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

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

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

Просмотреть файл

@ -1,98 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
public class BuildInfo
{
public string OutputDirectory { get; set; }
public IEnumerable<string> Scenes { get; set; }
public IEnumerable<CopyDirectoryInfo> CopyDirectories { get; set; }
public Action<BuildInfo> PreBuildAction { get; set; }
public Action<BuildInfo, string> PostBuildAction { get; set; }
public BuildOptions BuildOptions { get; set; }
public BuildTarget BuildTarget { get; set; }
public WSASDK? WSASdk { get; set; }
public string WSAUwpSdk { get; set; }
public WSAUWPBuildType? WSAUWPBuildType { get; set; }
public bool? WSAGenerateReferenceProjects { get; set; }
public ColorSpace? ColorSpace { get; set; }
public bool IsCommandLine { get; set; }
public string BuildSymbols { get; private set; }
public BuildInfo()
{
BuildSymbols = string.Empty;
}
public void AppendSymbols(params string[] symbol)
{
AppendSymbols((IEnumerable<string>)symbol);
}
public void AppendSymbols(IEnumerable<string> symbols)
{
string[] toAdd = symbols.Except(BuildSymbols.Split(';'))
.Where(sym => !string.IsNullOrEmpty(sym)).ToArray();
if (!toAdd.Any())
{
return;
}
if (!string.IsNullOrEmpty(BuildSymbols))
{
BuildSymbols += ";";
}
BuildSymbols += string.Join(";", toAdd);
}
public bool HasAnySymbols(params string[] symbols)
{
return BuildSymbols.Split(';').Intersect(symbols).Any();
}
public bool HasConfigurationSymbol()
{
return HasAnySymbols(
BuildSLNUtilities.BuildSymbolDebug,
BuildSLNUtilities.BuildSymbolRelease,
BuildSLNUtilities.BuildSymbolMaster);
}
public static IEnumerable<string> RemoveConfigurationSymbols(string symbols)
{
return symbols.Split(';').Except(new[]
{
BuildSLNUtilities.BuildSymbolDebug,
BuildSLNUtilities.BuildSymbolRelease,
BuildSLNUtilities.BuildSymbolMaster
});
}
public bool HasAnySymbols(IEnumerable<string> symbols)
{
return BuildSymbols.Split(';').Intersect(symbols).Any();
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,448 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml;
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
/// <summary>
/// Class containing various utility methods to build a WSA solution from a Unity project.
/// </summary>
public static class BuildSLNUtilities
{
/// <summary>
/// A method capable of configuring <see cref="BuildInfo"/> settings.
/// </summary>
/// <param name="toConfigure">The settings to configure.</param>
public delegate void BuildInfoConfigurationMethod(ref BuildInfo toConfigure);
/// <summary>
/// Add a handler to this event to override <see cref="BuildInfo"/> defaults before a build.
/// </summary>
/// <seealso cref="RaiseOverrideBuildDefaults"/>
public static event BuildInfoConfigurationMethod OverrideBuildDefaults;
/// <summary>
/// Call this method to give other code an opportunity to override <see cref="BuildInfo"/> defaults.
/// </summary>
/// <param name="toConfigure">>The settings to configure.</param>
/// <seealso cref="OverrideBuildDefaults"/>
public static void RaiseOverrideBuildDefaults(ref BuildInfo toConfigure)
{
if (OverrideBuildDefaults != null)
{
OverrideBuildDefaults(ref toConfigure);
}
}
// Build configurations. Exactly one of these should be defined for any given build.
public const string BuildSymbolDebug = "DEBUG";
public const string BuildSymbolRelease = "RELEASE";
public const string BuildSymbolMaster = "MASTER";
/// <summary>
/// Event triggered when a build starts.
/// </summary>
public static event Action<BuildInfo> BuildStarted;
/// <summary>
/// Event triggered when a build completes.
/// </summary>
public static event Action<BuildInfo, string> BuildCompleted;
public static void PerformBuild(BuildInfo buildInfo)
{
BuildTargetGroup buildTargetGroup = GetGroup(buildInfo.BuildTarget);
string oldBuildSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
if (!string.IsNullOrEmpty(oldBuildSymbols))
{
if (buildInfo.HasConfigurationSymbol())
{
buildInfo.AppendSymbols(BuildInfo.RemoveConfigurationSymbols(oldBuildSymbols));
}
else
{
buildInfo.AppendSymbols(oldBuildSymbols.Split(';'));
}
}
if ((buildInfo.BuildOptions & BuildOptions.Development) == BuildOptions.Development)
{
if (!buildInfo.HasConfigurationSymbol())
{
buildInfo.AppendSymbols(BuildSymbolDebug);
}
}
if (buildInfo.HasAnySymbols(BuildSymbolDebug))
{
buildInfo.BuildOptions |= BuildOptions.Development | BuildOptions.AllowDebugging;
}
if (buildInfo.HasAnySymbols(BuildSymbolRelease))
{
//Unity automatically adds the DEBUG symbol if the BuildOptions.Development flag is
//specified. In order to have debug symbols and the RELEASE symbols we have to
//inject the symbol Unity relies on to enable the /debug+ flag of csc.exe which is "DEVELOPMENT_BUILD"
buildInfo.AppendSymbols("DEVELOPMENT_BUILD");
}
BuildTarget oldBuildTarget = EditorUserBuildSettings.activeBuildTarget;
BuildTargetGroup oldBuildTargetGroup = GetGroup(oldBuildTarget);
EditorUserBuildSettings.SwitchActiveBuildTarget(buildTargetGroup, buildInfo.BuildTarget);
WSAUWPBuildType? oldWSAUWPBuildType = EditorUserBuildSettings.wsaUWPBuildType;
if (buildInfo.WSAUWPBuildType.HasValue)
{
EditorUserBuildSettings.wsaUWPBuildType = buildInfo.WSAUWPBuildType.Value;
}
var oldColorSpace = PlayerSettings.colorSpace;
if (buildInfo.ColorSpace.HasValue)
{
PlayerSettings.colorSpace = buildInfo.ColorSpace.Value;
}
if (buildInfo.BuildSymbols != null)
{
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, buildInfo.BuildSymbols);
}
string buildError = "Error";
try
{
// For the WSA player, Unity builds into a target directory.
// For other players, the OutputPath parameter indicates the
// path to the target executable to build.
if (buildInfo.BuildTarget == BuildTarget.WSAPlayer)
{
Directory.CreateDirectory(buildInfo.OutputDirectory);
}
OnPreProcessBuild(buildInfo);
buildError = BuildPipeline.BuildPlayer(
buildInfo.Scenes.ToArray(),
buildInfo.OutputDirectory,
buildInfo.BuildTarget,
buildInfo.BuildOptions).ToString();
if (buildError.StartsWith("Error"))
{
throw new Exception(buildError);
}
}
finally
{
OnPostProcessBuild(buildInfo, buildError);
if (BuildTarget.WSAPlayer == buildInfo.BuildTarget)
{
UwpProjectPostProcess.Execute(buildInfo.OutputDirectory);
}
PlayerSettings.colorSpace = oldColorSpace;
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, oldBuildSymbols);
if (oldWSAUWPBuildType.HasValue)
{
EditorUserBuildSettings.wsaUWPBuildType = oldWSAUWPBuildType.Value;
}
EditorUserBuildSettings.SwitchActiveBuildTarget(oldBuildTargetGroup, oldBuildTarget);
}
}
public static void ParseBuildCommandLine(ref BuildInfo buildInfo)
{
string[] arguments = Environment.GetCommandLineArgs();
buildInfo.IsCommandLine = true;
for (int i = 0; i < arguments.Length; ++i)
{
// Can't use -buildTarget which is something Unity already takes as an argument for something.
if (string.Equals(arguments[i], "-duskBuildTarget", StringComparison.InvariantCultureIgnoreCase))
{
buildInfo.BuildTarget = (BuildTarget)Enum.Parse(typeof(BuildTarget), arguments[++i]);
}
else if (string.Equals(arguments[i], "-wsaSDK", StringComparison.InvariantCultureIgnoreCase))
{
string wsaSdkArg = arguments[++i];
buildInfo.WSASdk = (WSASDK)Enum.Parse(typeof(WSASDK), wsaSdkArg);
}
else if (string.Equals(arguments[i], "-wsaUwpSdk", StringComparison.InvariantCultureIgnoreCase))
{
buildInfo.WSAUwpSdk = arguments[++i];
}
else if (string.Equals(arguments[i], "-wsaUWPBuildType", StringComparison.InvariantCultureIgnoreCase))
{
buildInfo.WSAUWPBuildType = (WSAUWPBuildType)Enum.Parse(typeof(WSAUWPBuildType), arguments[++i]);
}
else if (string.Equals(arguments[i], "-wsaGenerateReferenceProjects", StringComparison.InvariantCultureIgnoreCase))
{
buildInfo.WSAGenerateReferenceProjects = bool.Parse(arguments[++i]);
}
else if (string.Equals(arguments[i], "-buildOutput", StringComparison.InvariantCultureIgnoreCase))
{
buildInfo.OutputDirectory = arguments[++i];
}
else if (string.Equals(arguments[i], "-buildDesc", StringComparison.InvariantCultureIgnoreCase))
{
ParseBuildDescriptionFile(arguments[++i], ref buildInfo);
}
else if (string.Equals(arguments[i], "-unityBuildSymbols", StringComparison.InvariantCultureIgnoreCase))
{
string newBuildSymbols = arguments[++i];
buildInfo.AppendSymbols(newBuildSymbols.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
}
}
}
public static void PerformBuild_CommandLine()
{
var buildInfo = new BuildInfo
{
// Use scenes from the editor build settings.
Scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path),
// Configure a post build action to throw appropriate error code.
PostBuildAction = (innerBuildInfo, buildError) =>
{
if (!string.IsNullOrEmpty(buildError))
{
EditorApplication.Exit(1);
}
}
};
RaiseOverrideBuildDefaults(ref buildInfo);
ParseBuildCommandLine(ref buildInfo);
PerformBuild(buildInfo);
}
public static void ParseBuildDescriptionFile(string filename, ref BuildInfo buildInfo)
{
Debug.Log(string.Format(CultureInfo.InvariantCulture, "Build: Using \"{0}\" as build description", filename));
// Parse the XML file
var reader = new XmlTextReader(filename);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (string.Equals(reader.Name, "SceneList", StringComparison.InvariantCultureIgnoreCase))
{
// Set the scenes we want to build
buildInfo.Scenes = ReadSceneList(reader);
}
else if (string.Equals(reader.Name, "CopyList", StringComparison.InvariantCultureIgnoreCase))
{
// Set the directories we want to copy
buildInfo.CopyDirectories = ReadCopyList(reader);
}
break;
}
}
}
private static BuildTargetGroup GetGroup(BuildTarget buildTarget)
{
switch (buildTarget)
{
case BuildTarget.WSAPlayer:
return BuildTargetGroup.WSA;
case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64:
return BuildTargetGroup.Standalone;
default:
return BuildTargetGroup.Unknown;
}
}
private static IEnumerable<string> ReadSceneList(XmlTextReader reader)
{
var result = new List<string>();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (string.Equals(reader.Name, "Scene", StringComparison.InvariantCultureIgnoreCase))
{
while (reader.MoveToNextAttribute())
{
if (string.Equals(reader.Name, "Name", StringComparison.InvariantCultureIgnoreCase))
{
result.Add(reader.Value);
Debug.Log(string.Format(CultureInfo.InvariantCulture, "Build: Adding scene \"{0}\"", reader.Value));
}
}
}
break;
case XmlNodeType.EndElement:
if (string.Equals(reader.Name, "SceneList", StringComparison.InvariantCultureIgnoreCase))
{
return result;
}
break;
}
}
return result;
}
private static IEnumerable<CopyDirectoryInfo> ReadCopyList(XmlTextReader reader)
{
var result = new List<CopyDirectoryInfo>();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (string.Equals(reader.Name, "Copy", StringComparison.InvariantCultureIgnoreCase))
{
string source = null;
string dest = null;
string filter = null;
bool recursive = false;
while (reader.MoveToNextAttribute())
{
if (string.Equals(reader.Name, "Source", StringComparison.InvariantCultureIgnoreCase))
{
source = reader.Value;
}
else if (string.Equals(reader.Name, "Destination", StringComparison.InvariantCultureIgnoreCase))
{
dest = reader.Value;
}
else if (string.Equals(reader.Name, "Recursive", StringComparison.InvariantCultureIgnoreCase))
{
recursive = Convert.ToBoolean(reader.Value);
}
else if (string.Equals(reader.Name, "Filter", StringComparison.InvariantCultureIgnoreCase))
{
filter = reader.Value;
}
}
if (source != null)
{
// Either the file specifies the Destination as well, or else CopyDirectory will use Source for Destination
var info = new CopyDirectoryInfo { Source = source };
if (dest != null)
{
info.Destination = dest;
}
if (filter != null)
{
info.Filter = filter;
}
info.Recursive = recursive;
Debug.Log(string.Format(CultureInfo.InvariantCulture, @"Build: Adding {0}copy ""{1}\{2}"" => ""{3}""", info.Recursive ? "Recursive " : "", info.Source, info.Filter, info.Destination ?? info.Source));
result.Add(info);
}
}
break;
case XmlNodeType.EndElement:
if (string.Equals(reader.Name, "CopyList", StringComparison.InvariantCultureIgnoreCase))
return result;
break;
}
}
return result;
}
public static void CopyDirectory(string sourceDirectoryPath, string destinationDirectoryPath, CopyDirectoryInfo directoryInfo)
{
sourceDirectoryPath = Path.Combine(sourceDirectoryPath, directoryInfo.Source);
destinationDirectoryPath = Path.Combine(destinationDirectoryPath, directoryInfo.Destination ?? directoryInfo.Source);
Debug.Log(string.Format(CultureInfo.InvariantCulture, @"{0} ""{1}\{2}"" to ""{3}""", directoryInfo.Recursive ? "Recursively copying" : "Copying", sourceDirectoryPath, directoryInfo.Filter, destinationDirectoryPath));
foreach (string sourceFilePath in Directory.GetFiles(sourceDirectoryPath, directoryInfo.Filter, directoryInfo.Recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly))
{
string destinationFilePath = sourceFilePath.Replace(sourceDirectoryPath, destinationDirectoryPath);
try
{
Directory.CreateDirectory(Path.GetDirectoryName(destinationFilePath));
if (File.Exists(destinationFilePath))
{
File.SetAttributes(destinationFilePath, FileAttributes.Normal);
}
File.Copy(sourceFilePath, destinationFilePath, true);
File.SetAttributes(destinationFilePath, FileAttributes.Normal);
}
catch (Exception exception)
{
Debug.LogError(string.Format(CultureInfo.InvariantCulture, "Failed to copy \"{0}\" to \"{1}\" with \"{2}\"", sourceFilePath, destinationFilePath, exception));
}
}
}
private static void OnPreProcessBuild(BuildInfo buildInfo)
{
// Raise the global event for listeners
BuildStarted.RaiseEvent(buildInfo);
// Call the pre-build action, if any
if (buildInfo.PreBuildAction != null)
{
buildInfo.PreBuildAction(buildInfo);
}
}
private static void OnPostProcessBuild(BuildInfo buildInfo, string buildError)
{
if (string.IsNullOrEmpty(buildError))
{
if (buildInfo.CopyDirectories != null)
{
string inputProjectDirectoryPath = GetProjectPath();
string outputProjectDirectoryPath = Path.Combine(GetProjectPath(), buildInfo.OutputDirectory);
foreach (var directory in buildInfo.CopyDirectories)
{
CopyDirectory(inputProjectDirectoryPath, outputProjectDirectoryPath, directory);
}
}
}
// Raise the global event for listeners
BuildCompleted.RaiseEvent(buildInfo, buildError);
// Call the post-build action, if any
if (buildInfo.PostBuildAction != null)
{
buildInfo.PostBuildAction(buildInfo, buildError);
}
}
public static string GetProjectPath()
{
return Path.GetDirectoryName(Path.GetFullPath(Application.dataPath));
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,75 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
public static class EditorPrefsUtility
{
public static void SetEditorPref(string key, string value)
{
EditorPrefs.SetString(Application.productName + key, value);
}
public static void SetEditorPref(string key, bool value)
{
EditorPrefs.SetBool(Application.productName + key, value);
}
public static void SetEditorPref(string key, float value)
{
EditorPrefs.SetFloat(Application.productName + key, value);
}
public static void SetEditorPref(string key, int value)
{
EditorPrefs.SetInt(Application.productName + key, value);
}
public static string GetEditorPref(string key, string defaultValue)
{
if (EditorPrefs.HasKey(Application.productName + key))
{
return EditorPrefs.GetString(Application.productName + key);
}
EditorPrefs.SetString(Application.productName + key, defaultValue);
return defaultValue;
}
public static bool GetEditorPref(string key, bool defaultValue)
{
if (EditorPrefs.HasKey(Application.productName + key))
{
return EditorPrefs.GetBool(Application.productName + key);
}
EditorPrefs.SetBool(Application.productName + key, defaultValue);
return defaultValue;
}
public static float GetEditorPref(string key, float defaultValue)
{
if (EditorPrefs.HasKey(Application.productName + key))
{
return EditorPrefs.GetFloat(Application.productName + key);
}
EditorPrefs.SetFloat(Application.productName + key, defaultValue);
return defaultValue;
}
public static int GetEditorPref(string key, int defaultValue)
{
if (EditorPrefs.HasKey(Application.productName + key))
{
return EditorPrefs.GetInt(Application.productName + key);
}
EditorPrefs.SetInt(Application.productName + key, defaultValue);
return defaultValue;
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,56 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using UnityEditor;
namespace HoloToolkit.Unity
{
/// <summary>
/// Implements functionality for building HoloLens applications
/// </summary>
public static class HoloToolkitCommands
{
/// <summary>
/// Do a build configured for the HoloLens, returns the error from BuildPipeline.BuildPlayer
/// </summary>
[Obsolete("Use BuildDeployTools.BuildSLN")]
public static bool BuildSLN()
{
return BuildDeployTools.BuildSLN(BuildDeployPrefs.BuildDirectory, false);
}
public static bool BuildAPPX(string buildDirectory = "")
{
if(buildDirectory == string.Empty)
{
buildDirectory = BuildDeployPrefs.BuildDirectory;
}
return BuildDeployTools.BuildAppxFromSLN(
PlayerSettings.productName,
BuildDeployTools.DefaultMSBuildVersion,
BuildDeployPrefs.ForceRebuild,
BuildDeployPrefs.BuildConfig,
BuildDeployPrefs.BuildPlatform,
buildDirectory,
BuildDeployPrefs.IncrementBuildVersion);
}
public static void BuildSLNAndAPPX(string path)
{
var slnResult = BuildDeployTools.BuildSLN(path, false);
var appxResult = BuildAPPX(path);
}
public static bool InstallAPPX()
{
ConnectInfo connectInfo = new ConnectInfo("10.1.18.9", "1234", "12341234", "HoloLens");
BuildDeployWindow.InstallOnTargetDevice(BuildDeployPrefs.BuildDirectory, connectInfo);
return BuildDeployWindow.AppxInstallSucces;
}
}
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,31 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using UnityEngine;
namespace HoloToolkit.Unity
{
[Serializable]
public class USBDeviceInfo
{
public USBDeviceInfo(int vendorId, string udid, int productId, string name, int revision)
{
VendorId = vendorId;
Udid = udid;
ProductId = productId;
Name = name;
Revision = revision;
}
public int VendorId { get; private set; }
public string Udid { get; private set; }
public int ProductId { get; private set; }
public string Name { get; private set; }
public int Revision { get; private set; }
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,45 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Hardware;
using UnityEngine;
namespace HoloToolkit.Unity
{
[InitializeOnLoad]
public class USBDeviceListener
{
[SerializeField]
public static USBDeviceInfo[] USBDevices;
public delegate void OnUsbDevicesChanged(UsbDevice[] usbDevices);
public static event OnUsbDevicesChanged UsbDevicesChanged;
private static List<USBDeviceInfo> usbDevicesList = new List<USBDeviceInfo>(0);
static USBDeviceListener()
{
Usb.DevicesChanged += NotifyUsbDevicesChanged;
}
private static void NotifyUsbDevicesChanged(UsbDevice[] devices)
{
if (UsbDevicesChanged != null)
{
UsbDevicesChanged.Invoke(devices);
}
usbDevicesList.Clear();
foreach (UsbDevice device in devices)
{
usbDevicesList.Add(new USBDeviceInfo(device.vendorId, device.udid, device.productId, device.name, device.revision));
}
USBDevices = usbDevicesList.ToArray();
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,133 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
namespace HoloToolkit.Unity
{
/// <summary>
/// This class is designed to post process the UWP Assembly-CSharp projects to ensure that the defaults and defines are set correctly.
/// </summary>
public static class UwpProjectPostProcess
{
private static readonly Regex PlatformRegex = new Regex(@"'\$\(Configuration\)\|\$\(Platform\)' == '(?<Configuration>.*)\|(?<Platform>.*)'");
/// <summary>
/// Executes the Post Processes on the C# Projects generated as part of the UWP build.
/// </summary>
/// <param name="buildRootPath">The root path of the UWP build output.</param>
public static void Execute(string buildRootPath)
{
UpdateProjectFile(Path.Combine(buildRootPath, @"GeneratedProjects\UWP\Assembly-CSharp\Assembly-CSharp.csproj"));
UpdateProjectFile(Path.Combine(buildRootPath, @"GeneratedProjects\UWP\Assembly-CSharp-firstpass\Assembly-CSharp-firstpass.csproj"));
}
/// <summary>
/// Updates the project file to ensure that certain requirements are met.
/// </summary>
/// <param name="filename">The filename of the project to update.</param>
/// <remarks>This is manually parsing the Unity generated MSBuild projects, which means it will be fragile to changes.</remarks>
private static void UpdateProjectFile(string filename)
{
if (!File.Exists(filename))
{
UnityEngine.Debug.LogWarningFormat("Unable to find file \"{0}\", double check that the build succeeded and that the C# Projects are set to be generated.", filename);
return;
}
var projectDocument = new XmlDocument();
projectDocument.Load(filename);
if (projectDocument.DocumentElement == null)
{
UnityEngine.Debug.LogWarningFormat("Unable to load file \"{0}\", double check that the build succeeded and that the C# Projects are set to be generated.", filename);
return;
}
if (projectDocument.DocumentElement.Name != "Project")
{
UnityEngine.Debug.LogWarningFormat("The loaded project \"{0}\", does not appear to be a MSBuild Project file.", filename);
return;
}
foreach (XmlNode node in projectDocument.DocumentElement.ChildNodes)
{
// Everything we are looking for is inside a PropertyGroup...
if (node.Name != "PropertyGroup" || node.Attributes == null)
{
continue;
}
if (node.Attributes.Count == 0 && node["Configuration"] != null && node["Platform"] != null)
{
// Update the defaults to Release and x86 so that we can run NuGet restore.
node["Configuration"].InnerText = "Release";
node["Platform"].InnerText = "x86";
}
else if (node.Attributes["Condition"] != null)
{
// Update the DefineConstants to include the configuration allowing us to conditionally compile code based on the configuration.
Match match = PlatformRegex.Match(node.Attributes["Condition"].InnerText);
if (match.Success)
{
UpdateDefineConstants(node["DefineConstants"], match.Groups["Configuration"].Value, match.Groups["Platform"].Value);
}
}
}
WriteXmlDocumentToFile(projectDocument, filename);
}
private static void UpdateDefineConstants(XmlNode defineConstants, string configuration, string platform)
{
if (defineConstants == null)
{
return;
}
IEnumerable<string> symbols = defineConstants.InnerText.Split(';').Except(new[]
{
string.Empty,
BuildSLNUtilities.BuildSymbolDebug,
BuildSLNUtilities.BuildSymbolRelease,
BuildSLNUtilities.BuildSymbolMaster
}).Union(new[] { configuration.ToUpperInvariant() });
defineConstants.InnerText = string.Join(";", symbols.ToArray());
//UnityEngine.Debug.LogFormat("Updating defines for Configuration|Platform: {0}|{1} => {2}", configuration, platform, defineConstants.InnerText);
}
private static void WriteXmlDocumentToFile(XmlNode document, string fullPath)
{
FileStream fileStream = null;
try
{
fileStream = File.Open(fullPath, FileMode.Create);
var settings = new XmlWriterSettings
{
Indent = true,
CloseOutput = true
};
using (XmlWriter writer = XmlWriter.Create(fileStream, settings))
{
fileStream = null;
document.WriteTo(writer);
}
}
finally
{
if (fileStream != null)
{
fileStream.Dispose();
}
}
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,164 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Rafael Rivera.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading;
namespace HoloToolkit.Unity
{
/// <summary>
/// Emulator Utility Class
/// </summary>
public static class XdeGuestLocator
{
[StructLayout(LayoutKind.Sequential, Pack = 4)]
struct XdePeerHostIdentifier
{
public Guid GuestDiscoveryGUID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] GuestMACAddress;
public int PeerDiscoveryPort;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
struct XdePeerGuestIdentifier
{
public Guid GuestDiscoveryGUID;
public int GuestTcpPort;
public int GuestSvcVersion;
}
public static bool IsSearching { get; private set; }
public static bool HasData { get; private set; }
public static IPAddress GuestIpAddress { get; private set; }
static XdeGuestLocator()
{
HasData = false;
IsSearching = false;
}
public static void FindGuestAddressAsync()
{
if (IsSearching)
{
return;
}
ThreadPool.QueueUserWorkItem(FindGuestAddress);
}
private static void FindGuestAddress(object state)
{
IsSearching = true;
HasData = false;
GuestIpAddress = IPAddress.None;
UnicastIPAddressInformation internalSwitchAddressInfo = null;
try
{
internalSwitchAddressInfo = GetInternalSwitchAddressInfo();
}
catch (Exception)
{
UnityEngine.Debug.LogError("Failed to locate internal switch adapter");
}
if (internalSwitchAddressInfo != null)
{
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
{
try
{
// Bind to next available UDP port for a listen operation
socket.Blocking = true;
socket.ReceiveTimeout = (int)TimeSpan.FromSeconds(5).TotalMilliseconds;
socket.Bind(new IPEndPoint(internalSwitchAddressInfo.Address, 0));
var localPort = (socket.LocalEndPoint as IPEndPoint).Port;
// Send out a probe to 'devices' connected to the internal switch
// listening on port 3553 (Microsoft Device Emulator specific)
var broadcastAddress = GetBroadcastAddressForAddress(internalSwitchAddressInfo.Address, internalSwitchAddressInfo.IPv4Mask);
var broadcastTarget = new IPEndPoint(broadcastAddress, 3553);
//
// WORKAROUND: We don't have easy access to WMI to go querying
// for virtual machine information so we just cover finding
// the first 255 potential candidates xx 00 - xx FF.
//
// It sounds like a lot but we're talking super tiny
// payloads on an internal interface. It's very fast.
//
for (int i = 0; i <= 0xFF; i++)
{
var probe = GenerateProbe(localPort, i);
socket.SendTo(probe, broadcastTarget);
}
// Return the endpoint information for the first 'device' that replies
// (we don't necessarily care about the returned identifier info)
var responseBytes = new byte[Marshal.SizeOf(typeof(XdePeerGuestIdentifier))];
EndPoint guestEndpoint = new IPEndPoint(broadcastAddress, 0);
socket.ReceiveFrom(responseBytes, ref guestEndpoint);
GuestIpAddress = (guestEndpoint as IPEndPoint).Address;
HasData = true;
}
catch (SocketException)
{
// Do nothing, our probe went unanswered or failed
}
}
}
IsSearching = false;
}
private static UnicastIPAddressInformation GetInternalSwitchAddressInfo()
{
var internalSwitch = GetInternalNetworkSwitchInterface();
return internalSwitch.GetIPProperties().UnicastAddresses.Where(a => a.Address.AddressFamily == AddressFamily.InterNetwork).FirstOrDefault();
}
private static NetworkInterface GetInternalNetworkSwitchInterface()
{
return NetworkInterface.GetAllNetworkInterfaces().Where(i => i.Name.Contains("Windows Phone Emulator")).FirstOrDefault();
}
private static IPAddress GetBroadcastAddressForAddress(IPAddress address, IPAddress mask)
{
var addressInt = BitConverter.ToInt32(address.GetAddressBytes(), 0);
var maskInt = BitConverter.ToInt32(mask.GetAddressBytes(), 0);
return new IPAddress(BitConverter.GetBytes((addressInt | ~maskInt)));
}
private static byte[] GenerateProbe(int port, int machineIndex)
{
var identifier = new XdePeerHostIdentifier();
identifier.PeerDiscoveryPort = port;
identifier.GuestDiscoveryGUID = new Guid("{963ef858-2efe-4eb4-8d2d-fed5408e6441}");
identifier.GuestMACAddress = new byte[] { 0x02, 0xDE, 0xDE, 0xDE, 0xDE, (byte)machineIndex };
return GetStructureBytes(identifier);
}
private static byte[] GetStructureBytes(object obj)
{
var bytes = new byte[Marshal.SizeOf(obj)];
var handle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
Marshal.StructureToPtr(obj, handle.AddrOfPinnedObject(), false);
handle.Free();
return bytes;
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,116 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
public class CertificatePasswordWindow : EditorWindow
{
private static readonly GUILayoutOption LabelWidth = GUILayout.Width(110f);
private static readonly GUILayoutOption ButtonWidth = GUILayout.Width(110f);
private string path;
private string password;
private GUIContent message;
private GUIStyle messageStyle;
private string focus;
public static void Show(string path)
{
CertificatePasswordWindow[] array = (CertificatePasswordWindow[])Resources.FindObjectsOfTypeAll(typeof(CertificatePasswordWindow));
CertificatePasswordWindow certificatePasswordWindow = (array.Length <= 0) ? CreateInstance<CertificatePasswordWindow>() : array[0];
path = path.Replace("\\", "/");
certificatePasswordWindow.path = path.Substring(path.LastIndexOf("Assets/", StringComparison.Ordinal));
certificatePasswordWindow.password = string.Empty;
certificatePasswordWindow.message = GUIContent.none;
certificatePasswordWindow.messageStyle = new GUIStyle(GUI.skin.label);
certificatePasswordWindow.messageStyle.fontStyle = FontStyle.Italic;
certificatePasswordWindow.focus = "password";
if (array.Length > 0)
{
certificatePasswordWindow.Focus();
}
else
{
certificatePasswordWindow.titleContent = new GUIContent("Enter Windows Store Certificate Password");
certificatePasswordWindow.position = new Rect(100f, 100f, 350f, 90f);
certificatePasswordWindow.minSize = new Vector2(certificatePasswordWindow.position.width, certificatePasswordWindow.position.height);
certificatePasswordWindow.maxSize = certificatePasswordWindow.minSize;
certificatePasswordWindow.ShowUtility();
}
}
public void OnGUI()
{
Event current = Event.current;
bool flag = false;
bool flag2 = false;
if (current.type == EventType.KeyDown)
{
flag = (current.keyCode == KeyCode.Escape);
flag2 = (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter);
}
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Space(10f);
using (new EditorGUILayout.VerticalScope())
{
GUILayout.FlexibleSpace();
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Label(new GUIContent("Password|Certificate password."), LabelWidth);
GUI.SetNextControlName("password");
password = GUILayout.PasswordField(password, '●');
}
GUILayout.Space(10f);
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Label(message, messageStyle);
GUILayout.FlexibleSpace();
if (GUILayout.Button(new GUIContent("Ok"), ButtonWidth) || flag2)
{
message = GUIContent.none;
try
{
if (PlayerSettings.WSA.SetCertificate(path, password))
{
flag = true;
}
else
{
message = new GUIContent("Invalid password.");
}
}
catch (UnityException ex)
{
Debug.LogError(ex.Message);
}
}
}
GUILayout.FlexibleSpace();
}
GUILayout.Space(10f);
}
if (flag)
{
Close();
}
else if (focus != null)
{
EditorGUI.FocusTextInControl(focus);
focus = null;
}
}
}
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,20 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class AdapterInfo
{
public string Description;
public string HardwareAddress;
public int Index;
public string Name;
public string Type;
public DHCPInfo DHCP;
public IpAddressInfo[] Gateways;
public IpAddressInfo[] IpAddresses;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,18 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class AppDetails
{
public string Name;
public string PackageFamilyName;
public string PackageFullName;
public int PackageOrigin;
public string PackageRelativeId;
public string Publisher;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,13 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class AppList
{
public AppDetails[] InstalledPackages;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,24 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public struct ConnectInfo
{
public ConnectInfo(string ip, string user, string password, string machineName = "")
{
IP = ip;
User = user;
Password = password;
MachineName = string.IsNullOrEmpty(machineName) ? ip : machineName;
}
public string IP;
public string User;
public string Password;
public string MachineName;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,21 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
namespace HoloToolkit.Unity
{
public class CopyDirectoryInfo
{
public string Source { get; set; }
public string Destination { get; set; }
public string Filter { get; set; }
public bool Recursive { get; set; }
public CopyDirectoryInfo()
{
Source = null;
Destination = null;
Filter = "*";
Recursive = false;
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,15 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class DHCPInfo
{
public int LeaseExpires;
public int LeaseObtained;
public IpAddressInfo Address;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
namespace HoloToolkit.Unity
{
[Serializable]
public class DevicePortalConnections
{
public List<ConnectInfo> Connections = new List<ConnectInfo>(0);
public DevicePortalConnections(ConnectInfo connectInfo)
{
Connections.Add(connectInfo);
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,16 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class InstallStatus
{
public int Code;
public string CodeText;
public string Reason;
public bool Success;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,14 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class IpAddressInfo
{
public string IpAddress;
public string Mask;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,13 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class MachineName
{
public string ComputerName;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,13 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class NetworkInfo
{
public AdapterInfo[] Adapters;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,21 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class ProcessDesc
{
public float CPUUsage;
public string ImageName;
public float PageFileUsage;
public int PrivateWorkingSet;
public int ProcessId;
public int SessionId;
public string UserName;
public int VirtualSize;
public int WorkingSetSize;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,13 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class ProcessList
{
public ProcessDesc[] Processes;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,13 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace HoloToolkit.Unity
{
[Serializable]
public class Response
{
public string Reason;
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,17 +0,0 @@
{
"name": "Editor",
"references": [
"GUID:c6bedd5ae7ab748e5b010e812f9d5d1b"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,19 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.XR;
public class CurrentSettings : ScriptableObject
{
public string enabledXrTarget;
public GraphicsDeviceType playerGraphicsApi;
public XRSettings.StereoRenderingMode stereoRenderingMode;
public bool mtRendering = true;
public bool graphicsJobs;
public string simulationMode;
}

Просмотреть файл

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

Просмотреть файл

@ -1,52 +0,0 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
public class MyBuildPostprocessor
{
// Build postprocessor. Currently only needed on:
// - iOS: no dynamic libraries, so plugin source files have to be copied into Xcode project
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
if (target == BuildTarget.iOS)
OnPostprocessBuildIOS(pathToBuiltProject);
}
private static void OnPostprocessBuildIOS(string pathToBuiltProject)
{
// We use UnityEditor.iOS.Xcode API which only exists in iOS editor module
#if UNITY_IOS
string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
UnityEditor.iOS.Xcode.PBXProject proj = new UnityEditor.iOS.Xcode.PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
string target = proj.TargetGuidByName("Unity-iPhone");
Directory.CreateDirectory(Path.Combine(pathToBuiltProject, "Libraries/Unity"));
string[] filesToCopy = new string[]
{
"PlatformBase.h",
"RenderAPI_Metal.mm",
"RenderAPI_OpenGLCoreES.cpp",
"RenderAPI.cpp",
"RenderAPI.h",
"RenderingPlugin.cpp",
};
for(int i = 0 ; i < filesToCopy.Length ; ++i)
{
var srcPath = Path.Combine("../PluginSource/source", filesToCopy[i]);
var dstLocalPath = "Libraries/" + filesToCopy[i];
var dstPath = Path.Combine(pathToBuiltProject, dstLocalPath);
File.Copy(srcPath, dstPath, true);
proj.AddFileToBuild(target, proj.AddFile(dstLocalPath, dstLocalPath));
}
File.WriteAllText(projPath, proj.WriteToString());
#endif // #if UNITY_IOS
}
}

Просмотреть файл

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

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

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

Просмотреть файл

@ -1,61 +0,0 @@
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.XR;
public static class PlatformSettings
{
public static BuildTargetGroup BuildTargetGroup => EditorUserBuildSettings.selectedBuildTargetGroup;
public static BuildTarget BuildTarget => EditorUserBuildSettings.activeBuildTarget;
public static string [] enabledXrTargets;
public static GraphicsDeviceType playerGraphicsApi;
public static StereoRenderingPath stereoRenderingPath;
public static bool mtRendering = true;
public static bool graphicsJobs;
public static AndroidSdkVersions minimumAndroidSdkVersion = AndroidSdkVersions.AndroidApiLevel24;
public static AndroidSdkVersions targetAndroidSdkVersion = AndroidSdkVersions.AndroidApiLevel24;
public static string simulationMode;
public static void SerializeToAsset()
{
var settingsAsset = ScriptableObject.CreateInstance<CurrentSettings>();
settingsAsset.enabledXrTarget = enabledXrTargets.FirstOrDefault();
settingsAsset.playerGraphicsApi = playerGraphicsApi;
settingsAsset.stereoRenderingMode = GetXRStereoRenderingPathMapping(stereoRenderingPath);
settingsAsset.mtRendering = mtRendering;
settingsAsset.graphicsJobs = graphicsJobs;
if (simulationMode != String.Empty || simulationMode != null)
{
settingsAsset.simulationMode = simulationMode;
}
else
{
settingsAsset.simulationMode = "None";
}
AssetDatabase.CreateAsset(settingsAsset, "Assets/Resources/settings.asset");
AssetDatabase.SaveAssets();
}
private static XRSettings.StereoRenderingMode GetXRStereoRenderingPathMapping(StereoRenderingPath stereoRenderingPath)
{
switch (stereoRenderingPath)
{
case StereoRenderingPath.SinglePass:
return XRSettings.StereoRenderingMode.SinglePass;
case StereoRenderingPath.MultiPass:
return XRSettings.StereoRenderingMode.MultiPass;
case StereoRenderingPath.Instancing:
return XRSettings.StereoRenderingMode.SinglePassInstanced;
default:
return XRSettings.StereoRenderingMode.SinglePassMultiview;
}
}
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,32 +0,0 @@
fileFormatVersion: 2
guid: 6d2eccb01d61a441fa0496bdf4f67485
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

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

Просмотреть файл

@ -1,20 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f05b05015b179c3488e93a1facc5dffd, type: 3}
m_Name: settings
m_EditorClassIdentifier:
enabledXrTarget: MockHMD
playerGraphicsApi: 11
stereoRenderingMode: 1
mtRendering: 1
graphicsJobs: 0
simulationMode:

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,259 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 705507995}
- component: {fileID: 705507994}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &705507994
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 1
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &705507995
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 963194228}
- component: {fileID: 963194227}
- component: {fileID: 963194226}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &963194226
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
--- !u!20 &963194227
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &963194228
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,24 +0,0 @@
<SpeechTestKeywords>
<KeywordList>
<Keyword>Come Here</Keyword>
<Keyword>Dig</Keyword>
<Keyword>Play Dead</Keyword>
<Keyword>Sit</Keyword>
<Keyword>Spin Around</Keyword>
<Keyword>Hey Melissa</Keyword>
<Keyword>Mercy</Keyword>
<Keyword>Death</Keyword>
<Keyword>Rise and Shine</Keyword>
<Keyword>Let's Go</Keyword>
<Keyword>Cancel</Keyword>
<Keyword>Movement</Keyword>
<Keyword>Glue</Keyword>
<Keyword>Magnet</Keyword>
<Keyword>Save</Keyword>
<Keyword>Skype Delete All</Keyword>
<Keyword>Move</Keyword>
<Keyword>Skype Undo</Keyword>
<Keyword>Skype Next</Keyword>
<Keyword>Take Photo</Keyword>
</KeywordList>
</SpeechTestKeywords>

Просмотреть файл

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 15e0614414b462d479f9bc7b78f200e7
timeCreated: 1444252181
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 59b3afd129181ce4a814a187e6eb07dc
timeCreated: 1444252181
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

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

Просмотреть файл

@ -1,225 +0,0 @@
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
public enum TestStageConfig
{
BaseStageSetup,
CleanStage,
MultiPass,
Instancing
}
public enum TestCubesConfig
{
None,
TestCube,
PerformanceMassFloorObjects,
PerformanceMassObjects,
TestMassCube
}
public class TestSetupHelpers : TestBaseSetup
{
private int m_CubeCount = 0;
private void CameraLightSetup()
{
m_Camera = new GameObject("Camera");
m_Camera.AddComponent<Camera>();
m_Light = new GameObject("Light");
Light light = m_Light.AddComponent<Light>();
light.type = LightType.Directional;
}
private void TestCubeCreation()
{
m_Cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
m_Cube.transform.position = 5f * Vector3.forward;
}
private void CreateMassFloorObjects()
{
float x = -3.0f;
float y = -0.5f;
float zRow1 = 2.0f;
float zRow2 = 2.0f;
float zRow3 = 2.0f;
float zRow4 = 2.0f;
for (int i = 0; i < 20; i++)
{
var obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
m_CubeCount += 1;
obj.name = "TestCube " + m_CubeCount;
obj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
obj.transform.localPosition = new Vector3(x, y, zRow1);
zRow1 = zRow1 + 0.5f;
x = -2f;
}
for (int i = 0; i < 20; i++)
{
var obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
m_CubeCount += 1;
obj.name = "TestCube " + m_CubeCount;
obj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
obj.transform.localPosition = new Vector3(x, y, zRow2);
zRow2 = zRow2 + 0.5f;
x = -1f;
}
for (int i = 0; i < 20; i++)
{
var obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
m_CubeCount += 1;
obj.name = "TestCube " + m_CubeCount;
obj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
obj.transform.localPosition = new Vector3(x, y, zRow3);
zRow3 = zRow3 + 0.5f;
x = 0f;
}
for (int i = 0; i < 20; i++)
{
var obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
m_CubeCount += 1;
obj.name = "TestCube " + m_CubeCount;
obj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
obj.transform.localPosition = new Vector3(x, y, zRow4);
zRow4 = zRow4 + 0.5f;
x = 1f;
}
}
private void CreateMassObjects()
{
float xRow1 = -0.5f;
float xRow2 = -0.5f;
float xRow3 = -0.5f;
float yRow1 = 0.2f;
float yRow2 = -0.2f;
float yRow3 = -0.01f;
float zRow1 = 2.5f;
float zRow2 = 2.3f;
for (int i = 0; i < 17; i++)
{
var obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
m_CubeCount += 1;
obj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
obj.transform.localPosition = new Vector3(xRow1, yRow1, zRow1);
obj.name = "TestCube " + m_CubeCount;
if (i < 5)
{
xRow1 = xRow1 + 0.2f;
obj.transform.localPosition = new Vector3(xRow1, yRow1, zRow1);
}
else if (i > 5 && i < 11)
{
xRow2 = xRow2 + 0.2f;
obj.transform.localPosition = new Vector3(xRow2, yRow2, zRow1);
}
else if (i > 11)
{
xRow3 = xRow3 + 0.2f;
obj.transform.localPosition = new Vector3(xRow3, yRow3, zRow2);
}
}
}
private void CleanUpTestCubes()
{
if (m_CubeCount > 0)
{
for (int i = 0; i < m_CubeCount + 1; i++)
{
var obj = GameObject.Find("TestCube " + i);
Object.Destroy(obj);
}
}
if (GameObject.Find("Cube"))
{
Object.Destroy(GameObject.Find("Cube"));
}
}
private void CleanUpCameraLights()
{
Object.Destroy(GameObject.Find("Camera"));
Object.Destroy(GameObject.Find("Light"));
}
#if UNITY_EDITOR
public void InsureMultiPassRendering()
{
PlayerSettings.stereoRenderingPath = StereoRenderingPath.MultiPass;
}
public void InsureInstancingRendering()
{
PlayerSettings.stereoRenderingPath = StereoRenderingPath.Instancing;
}
#endif
public void TestStageSetup(TestStageConfig TestConfiguration)
{
switch (TestConfiguration)
{
case TestStageConfig.BaseStageSetup:
CameraLightSetup();
break;
case TestStageConfig.CleanStage:
CleanUpCameraLights();
CleanUpTestCubes();
#if UNITY_EDITOR
InsureInstancingRendering();
#endif
break;
case TestStageConfig.Instancing:
#if UNITY_EDITOR
InsureInstancingRendering();
#endif
break;
case TestStageConfig.MultiPass:
#if UNITY_EDITOR
InsureMultiPassRendering();
#endif
break;
}
}
public void TestCubeSetup(TestCubesConfig TestConfiguration)
{
switch (TestConfiguration)
{
case TestCubesConfig.TestCube:
TestCubeCreation();
break;
case TestCubesConfig.PerformanceMassFloorObjects:
CreateMassFloorObjects();
break;
case TestCubesConfig.PerformanceMassObjects:
CreateMassObjects();
break;
case TestCubesConfig.None:
break;
}
}
}

Просмотреть файл

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

Просмотреть файл

@ -1,198 +0,0 @@
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using System.Text;
using System;
#if UNITY_METRO
using UnityEngine.Windows.Speech;
#endif
[UnityPlatform(include = new [] {
RuntimePlatform.MetroPlayerARM,
RuntimePlatform.MetroPlayerX64,
RuntimePlatform.MetroPlayerX86,
RuntimePlatform.WSAPlayerX64,
RuntimePlatform.WSAPlayerARM,
RuntimePlatform.WSAPlayerX86})]
public class SpeechSmokeTest : TestBaseSetup
{
#if UNITY_METRO
// Speech Systems
private KeywordRecognizer m_Keyword = null;
private DictationRecognizer m_Dictation = null;
private GrammarRecognizer m_Grammar = null;
private string[] keywords = new[] { "one", "car" };
string m_GrammarFilePath = null;
string m_GrammarFilePathBadTest = null;
public bool BadPathTest = false;
[SetUp]
public void SetUp()
{
PhraseRecognitionSystem.Restart();
}
[TearDown]
public override void TearDown()
{
PhraseRecognitionSystem.Shutdown();
base.TearDown();
}
[Ignore("Not supported at the moment by Jenkins")]
[UnityTest]
public IEnumerator KeywordTest()
{
m_Keyword = new KeywordRecognizer(keywords);
m_Keyword.OnPhraseRecognized += M_Keyword_OnPhraseRecognized;
m_Keyword.Start();
yield return null;
Assert.IsTrue(m_Keyword.IsRunning, "Keyword Recognizer is not running!");
yield return null;
m_Keyword.Stop();
yield return null;
Assert.IsFalse(m_Keyword.IsRunning, "Keyword Recognizer is still running!");
m_Keyword.Dispose();
yield return new WaitForSeconds(3f);
}
[Ignore("Not supported at the moment by Jenkins")]
[UnityTest]
public IEnumerator DictationTest()
{
m_Dictation = new DictationRecognizer(ConfidenceLevel.High, DictationTopicConstraint.Dictation);
m_Dictation.AutoSilenceTimeoutSeconds = UnityEngine.Random.Range(5f, 100f);
m_Dictation.InitialSilenceTimeoutSeconds = UnityEngine.Random.Range(5, 100f);
m_Dictation.DictationHypothesis += M_Dictation_DictationHypothesis;
m_Dictation.DictationResult += M_Dictation_DictationResult;
m_Dictation.DictationError += M_Dictation_DictationError;
m_Dictation.DictationComplete += M_Dictation_DictationComplete;
m_Dictation.Start();
yield return new WaitForSeconds(3f);
Assert.AreNotEqual(m_Dictation.Status, SpeechSystemStatus.Failed, "Dictation has failed!");
Assert.AreEqual(m_Dictation.Status, SpeechSystemStatus.Running, "Dictation is not running!");
yield return new WaitForSeconds(3f);
m_Dictation.Stop();
yield return new WaitForSeconds(3f);
Assert.AreEqual(m_Dictation.Status, SpeechSystemStatus.Stopped, "Dictation is still running!");
yield return null;
m_Dictation.Dispose();
yield return null;
}
[Ignore("Not supported at the moment by Jenkins")]
[UnityTest]
public IEnumerator GrammarTest()
{
if (PhraseRecognitionSystem.isSupported)
{
m_GrammarFilePath = Application.streamingAssetsPath + "/combinations.grxml";
m_GrammarFilePathBadTest = @"C:\Data\combinations.grxml";
if (BadPathTest == true)
{
m_Grammar = new GrammarRecognizer(m_GrammarFilePathBadTest);
Debug.Log(m_GrammarFilePathBadTest);
}
else
{
m_Grammar = new GrammarRecognizer(m_GrammarFilePath);
Debug.Log(m_GrammarFilePath);
}
//Debug.Log(m_GrammarFilePath);
m_Grammar.OnPhraseRecognized += (args) =>
{
var builder = new StringBuilder();
builder.AppendFormat("{0} ({1}){2}", args.text, args.confidence, Environment.NewLine);
if (args.semanticMeanings != null)
{
foreach (var meaning in args.semanticMeanings)
{
builder.AppendFormat("\t{0}{1}", meaning.key, Environment.NewLine);
foreach (var value in meaning.values)
builder.AppendFormat("\t\t{0}{1}", value, Environment.NewLine);
}
}
else
{
builder.AppendFormat("\t{0}{1}", "No semantic meaning", Environment.NewLine);
}
var lines = builder.ToString();
Debug.Log(lines);
};
m_Grammar.Start();
yield return new WaitForSeconds(3f);
Assert.IsTrue(m_Grammar.IsRunning, "Grammar is not running");
yield return new WaitForSeconds(3f);
m_Grammar.Stop();
yield return new WaitForSeconds(3f);
Assert.IsFalse(m_Grammar.IsRunning, "Grammar is still running!");
yield return new WaitForSeconds(3f);
m_Grammar.Dispose();
yield return new WaitForSeconds(3f);
}
}
private void M_Dictation_DictationComplete(DictationCompletionCause cause)
{
Debug.Log("Dictation Complete");
}
private void M_Dictation_DictationError(string error, int hresult)
{
Debug.Log("Dictation Error");
}
private void M_Dictation_DictationResult(string text, ConfidenceLevel confidence)
{
Debug.Log("Dictation Result");
}
private void M_Dictation_DictationHypothesis(string text)
{
Debug.Log("Dictation Hypothesis");
}
private void M_Keyword_OnPhraseRecognized(PhraseRecognizedEventArgs args)
{
Debug.Log("Keyword Recognized");
}
#endif
}

Просмотреть файл

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

Просмотреть файл

@ -1,64 +0,0 @@
using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
using UnityEngine.XR;
[UnityPlatform(include = new[]
{
RuntimePlatform.WindowsEditor,
RuntimePlatform.WindowsPlayer,
RuntimePlatform.Android,
RuntimePlatform.IPhonePlayer,
RuntimePlatform.OSXEditor,
RuntimePlatform.OSXPlayer,
RuntimePlatform.Lumin,
RuntimePlatform.WSAPlayerARM,
RuntimePlatform.WSAPlayerX64,
RuntimePlatform.WSAPlayerX86,
RuntimePlatform.MetroPlayerARM,
RuntimePlatform.MetroPlayerX64,
RuntimePlatform.MetroPlayerX86
})]
public class TestBaseSetup
{
public TestSetupHelpers m_TestSetupHelpers;
public CurrentSettings settings;
public GameObject m_Camera;
public GameObject m_Light;
public GameObject m_Cube;
[OneTimeSetUp]
public virtual void OneTimeSetUp()
{
settings = Resources.Load<CurrentSettings>("settings");
}
[SetUp]
public virtual void SetUp()
{
m_TestSetupHelpers = new TestSetupHelpers();
m_TestSetupHelpers.TestStageSetup(TestStageConfig.BaseStageSetup);
}
[TearDown]
public virtual void TearDown()
{
m_TestSetupHelpers.TestStageSetup(TestStageConfig.CleanStage);
}
[UnitySetUp]
public IEnumerator SetUpAndEnableXR()
{
if (XRSettings.loadedDeviceName != settings.enabledXrTarget)
{
XRSettings.LoadDeviceByName(settings.enabledXrTarget);
}
yield return null;
XRSettings.enabled = true;
}
}

Просмотреть файл

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

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше