├── .gitignore ├── Assembly-CSharp-Editor.csproj ├── Assembly-CSharp.csproj ├── Assets ├── MRLUIS.json ├── MRLUIS.json.meta ├── MixedRealityAzure-Examples.meta ├── MixedRealityAzure-Examples │ ├── LUIS.meta │ └── LUIS │ │ ├── Scenes.meta │ │ ├── Scenes │ │ ├── LuisTest.unity │ │ └── LuisTest.unity.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ ├── GenericEntityIntentHandler.cs │ │ └── GenericEntityIntentHandler.cs.meta ├── MixedRealityAzure.meta ├── MixedRealityAzure │ ├── Common.meta │ ├── Common │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── ColorMapper.cs │ │ │ ├── ColorMapper.cs.meta │ │ │ ├── SecretHelper.cs │ │ │ └── SecretHelper.cs.meta │ ├── LUIS.meta │ └── LUIS │ │ ├── Domains.meta │ │ ├── Domains │ │ ├── MRLUIS.json │ │ └── MRLUIS.json.meta │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ ├── LuisTester.prefab │ │ └── LuisTester.prefab.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ ├── Context.meta │ │ ├── Context │ │ ├── IContextProvider.cs │ │ ├── IContextProvider.cs.meta │ │ ├── PredictionContext.cs │ │ └── PredictionContext.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── LuisTesterEditor.cs │ │ └── LuisTesterEditor.cs.meta │ │ ├── Intent.meta │ │ ├── Intent │ │ ├── AppearanceIntentHandler.cs │ │ ├── AppearanceIntentHandler.cs.meta │ │ ├── DebugIntentHandler.cs │ │ ├── DebugIntentHandler.cs.meta │ │ ├── IIntentHandler.cs │ │ ├── IIntentHandler.cs.meta │ │ ├── IntentEventData.cs │ │ ├── IntentEventData.cs.meta │ │ ├── TransformIntentHandler.cs │ │ └── TransformIntentHandler.cs.meta │ │ ├── LuisDictationManager.cs │ │ ├── LuisDictationManager.cs.meta │ │ ├── LuisExtensions.cs │ │ ├── LuisExtensions.cs.meta │ │ ├── LuisMRResult.cs │ │ ├── LuisMRResult.cs.meta │ │ ├── LuisManager.cs │ │ ├── LuisManager.cs.meta │ │ ├── LuisTester.cs │ │ ├── LuisTester.cs.meta │ │ ├── Resolve.meta │ │ ├── Resolve │ │ ├── EntityMap.cs │ │ ├── EntityMap.cs.meta │ │ ├── EntityMetadata.cs │ │ ├── EntityMetadata.cs.meta │ │ ├── EntityMetadataResolver.cs │ │ ├── EntityMetadataResolver.cs.meta │ │ ├── IEntityResolver.cs │ │ └── IEntityResolver.cs.meta │ │ ├── Route.meta │ │ └── Route │ │ ├── ResolvedIntentForwarder.cs │ │ └── ResolvedIntentForwarder.cs.meta ├── Plugins.meta ├── Plugins │ ├── LUIS.meta │ ├── LUIS │ │ ├── net45+win8+wpa81.meta │ │ └── net45+win8+wpa81 │ │ │ ├── Microsoft.Cognitive.LUIS.dll │ │ │ └── Microsoft.Cognitive.LUIS.dll.meta │ ├── Newtonsoft.Json.meta │ └── Newtonsoft.Json │ │ ├── portable-net45+wp80+win8+wpa81.meta │ │ └── portable-net45+wp80+win8+wpa81 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.dll.meta ├── Speech.meta ├── Speech │ ├── Scripts.meta │ └── Scripts │ │ ├── CogSvcSocketAuthentication.cs │ │ ├── CogSvcSocketAuthentication.cs.meta │ │ ├── RecognitionContent.cs │ │ ├── RecognitionContent.cs.meta │ │ ├── SpeechManager.cs │ │ ├── SpeechManager.cs.meta │ │ ├── SpeechRecognitionService.cs │ │ ├── SpeechRecognitionService.cs.meta │ │ ├── SpeechServiceResult.cs │ │ ├── SpeechServiceResult.cs.meta │ │ ├── UnityDispatcher.cs │ │ └── UnityDispatcher.cs.meta ├── mcs.rsp └── mcs.rsp.meta ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset ├── README.md ├── Screenshots └── SpeechWithLUIS-Test01.gif └── Unity-SpeechWithLUIS.sln /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Rr]ef/ 19 | x64/ 20 | x86/ 21 | [Bb]uild/* 22 | [Bb]uilds/* 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | 27 | # Packaging libraries 28 | [Pp]ackaging/Builds/* 29 | [Pp]ackaging/Packages/* 30 | 31 | # Packaging content OK 32 | ![Pp]ackaging/Content/** 33 | 34 | # Always get Unity root tools 35 | ![U]nity/** 36 | 37 | # Always include Unity Assets 38 | ![Aa]ssets/AssetStoreTools/** 39 | ![Aa]ssets/** 40 | 41 | # Always ignore Unity Library and Temp folders 42 | **/[Ll]ibrary/* 43 | **/[Tt]emp/ 44 | 45 | # Always ignore Unity ML-Agents Tensorflow plugins folder (they're way too big) 46 | [Aa]ssets/[Mm][Ll]-[Aa]gents/[Pp]lugins/** 47 | 48 | # Ignore UWP folder for projects that target this 49 | **/[Uu]WP/* 50 | 51 | # Visual Studo 2015 cache/options directory 52 | .vs/ 53 | 54 | # MSTest test Results 55 | [Tt]est[Rr]esult*/ 56 | [Bb]uild[Ll]og.* 57 | 58 | # NUNIT 59 | *.VisualState.xml 60 | TestResult.xml 61 | 62 | # Build Results of an ATL Project 63 | [Dd]ebugPS/ 64 | [Rr]eleasePS/ 65 | dlldata.c 66 | 67 | *_i.c 68 | *_p.c 69 | *_i.h 70 | *.ilk 71 | *.obj 72 | *.pch 73 | *.pdb 74 | *.pgc 75 | *.pgd 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *.log 83 | *.vspscc 84 | *.vssscc 85 | .builds 86 | *.pidb 87 | *.svclog 88 | *.scc 89 | 90 | # Chutzpah Test files 91 | _Chutzpah* 92 | 93 | # Visual C++ cache files 94 | ipch/ 95 | *.aps 96 | *.ncb 97 | *.opensdf 98 | *.sdf 99 | *.cachefile 100 | 101 | # Visual Studio profiler 102 | *.psess 103 | *.vsp 104 | *.vspx 105 | 106 | # TFS 2012 Local Workspace 107 | $tf/ 108 | 109 | # Guidance Automation Toolkit 110 | *.gpState 111 | 112 | # ReSharper is a .NET coding add-in 113 | _ReSharper*/ 114 | *.[Rr]e[Ss]harper 115 | *.DotSettings.user 116 | 117 | # JustCode is a .NET coding addin-in 118 | .JustCode 119 | 120 | # TeamCity is a build add-in 121 | _TeamCity* 122 | 123 | # DotCover is a Code Coverage Tool 124 | *.dotCover 125 | 126 | # NCrunch 127 | _NCrunch_* 128 | .*crunch*.local.xml 129 | 130 | # MightyMoose 131 | *.mm.* 132 | AutoTest.Net/ 133 | 134 | # Web workbench (sass) 135 | .sass-cache/ 136 | 137 | # Installshield output folder 138 | [Ee]xpress/ 139 | 140 | # DocProject is a documentation generator add-in 141 | DocProject/buildhelp/ 142 | DocProject/Help/*.HxT 143 | DocProject/Help/*.HxC 144 | DocProject/Help/*.hhc 145 | DocProject/Help/*.hhk 146 | DocProject/Help/*.hhp 147 | DocProject/Help/Html2 148 | DocProject/Help/html 149 | 150 | # Click-Once directory 151 | publish/ 152 | 153 | # Publish Web Output 154 | *.[Pp]ublish.xml 155 | *.azurePubxml 156 | # TODO: Comment the next line if you want to checkin your web deploy settings 157 | # but database connection strings (with potential passwords) will be unencrypted 158 | *.pubxml 159 | *.publishproj 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # VSIX Packages OK 170 | !**/VisualStudio/VSFeatureEngine/Packages/* 171 | # Lock files 172 | **/project.lock.json 173 | 174 | # Windows Azure Build Output 175 | csx/ 176 | *.build.csdef 177 | 178 | # Windows Store app package directory 179 | AppPackages/ 180 | 181 | # Others 182 | *.[Cc]ache 183 | ClientBin/ 184 | [Ss]tyle[Cc]op.* 185 | ~$* 186 | *~ 187 | *.dbmdl 188 | *.dbproj.schemaview 189 | # *.pfx // Allowing PFX because all PFX files are for samples 190 | *.publishsettings 191 | node_modules/ 192 | bower_components/ 193 | 194 | # RIA/Silverlight projects 195 | Generated_Code/ 196 | 197 | # Backup & report files from converting an old project file 198 | # to a newer Visual Studio version. Backup files are not needed, 199 | # because we have git ;-) 200 | _UpgradeReport_Files/ 201 | Backup*/ 202 | UpgradeLog*.XML 203 | UpgradeLog*.htm 204 | 205 | # SQL Server files 206 | *.mdf 207 | *.ldf 208 | 209 | # Business Intelligence projects 210 | *.rdl.data 211 | *.bim.layout 212 | *.bim_*.settings 213 | 214 | # Microsoft Fakes 215 | FakesAssemblies/ 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | -------------------------------------------------------------------------------- /Assets/MRLUIS.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 644ed10f149d4ef4fb2eba4d0aa711c8 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a57d4c361cbcfe24c9c673a970f8a9d5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples/LUIS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6f7954a60840974cbd54c6553a7f2a4 3 | folderAsset: yes 4 | timeCreated: 1518220169 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples/LUIS/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fdfdc99caa9e2b541940730810385761 3 | folderAsset: yes 4 | timeCreated: 1518220179 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples/LUIS/Scenes/LuisTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 017fcfbfe9263b1459783ab0eed8f7f4 3 | timeCreated: 1518220199 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples/LUIS/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6f9b6b57836c3f4e80f354bc2c675d5 3 | folderAsset: yes 4 | timeCreated: 1518568465 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples/LUIS/Scripts/GenericEntityIntentHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using Microsoft.MR.LUIS; 28 | using System; 29 | using System.Collections.Generic; 30 | using UnityEngine; 31 | using UnityEngine.Events; 32 | 33 | public class GenericEntityIntentHandler : MonoBehaviour, IIntentHandler 34 | { 35 | [Serializable] 36 | public struct IntentAction 37 | { 38 | public string entityValueTrigger; 39 | public List actions; 40 | } 41 | 42 | public string intentName; 43 | public string entityTypeName; 44 | public IntentAction[] handledIntents; 45 | 46 | Dictionary> activateValues = new Dictionary>(); 47 | 48 | void Start() 49 | { 50 | foreach (IntentAction intentAction in handledIntents) 51 | { 52 | if(!activateValues.ContainsKey(intentAction.entityValueTrigger)) 53 | activateValues.Add(intentAction.entityValueTrigger, intentAction.actions); 54 | else 55 | activateValues[intentAction.entityValueTrigger].AddRange(intentAction.actions); 56 | } 57 | } 58 | 59 | public bool CanHandle(string intentName) 60 | { 61 | return intentName.Equals(intentName); 62 | } 63 | 64 | public void Handle(Intent intent, LuisMRResult result) 65 | { 66 | if (!result.PredictionResult.Entities.ContainsKey(entityTypeName)) 67 | return; 68 | 69 | foreach (Entity entity in result.PredictionResult.Entities[entityTypeName]) 70 | { 71 | if (activateValues.ContainsKey(entity.Value)) 72 | { 73 | foreach(UnityEvent uEvent in activateValues[entity.Value]) 74 | uEvent.Invoke(); 75 | } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /Assets/MixedRealityAzure-Examples/LUIS/Scripts/GenericEntityIntentHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 483a07b36eeff064c81164cce49f3279 3 | timeCreated: 1518664928 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6db0151158bbe76409173193fadda7a4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5022ba4cc73cf234da706daa44c288d0 3 | folderAsset: yes 4 | timeCreated: 1518192936 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/Common/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e75a259c0673f4419257951c28a8de1 3 | folderAsset: yes 4 | timeCreated: 1518192936 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/Common/Scripts/ColorMapper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2956c2e5763d6b6459ba5097b75ff000 3 | timeCreated: 1525379688 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/Common/Scripts/SecretHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using System; 28 | using System.Collections; 29 | using System.Collections.Generic; 30 | using System.Net; 31 | using System.Net.Security; 32 | using System.Threading.Tasks; 33 | using System.Reflection; 34 | using UnityEngine; 35 | 36 | #if !UNITY_WSA || UNITY_EDITOR 37 | using System.Security.Cryptography.X509Certificates; 38 | #endif 39 | 40 | namespace Microsoft.Unity 41 | { 42 | /// 43 | /// An attribute that can be used to designate where a secret value is held. 44 | /// 45 | /// 46 | /// This attribute is used by . Please see that class for usage. 47 | /// 48 | [AttributeUsage(validOn: AttributeTargets.Field, AllowMultiple = false, Inherited = false)] 49 | public class SecretValueAttribute : Attribute 50 | { 51 | #region Member Variables 52 | private string name; 53 | #endregion // Member Variables 54 | 55 | #region Constructors 56 | /// 57 | /// Initializes a new instance. 58 | /// 59 | /// 60 | /// The name of the secret value. 61 | /// 62 | public SecretValueAttribute(string name) 63 | { 64 | // Validate 65 | if (string.IsNullOrEmpty(name)) throw new ArgumentException(nameof(name)); 66 | 67 | // Store 68 | this.name = name; 69 | } 70 | #endregion // Constructors 71 | 72 | #region Public Properties 73 | /// 74 | /// Gets the name of the secret. 75 | /// 76 | public string Name => name; 77 | #endregion // Public Properties 78 | } 79 | 80 | /// 81 | /// A class built to help keep API keys and other secret values out of public source control. 82 | /// 83 | /// 84 | /// 85 | /// To use , apply the SecretValue 86 | /// attribute to any inspector fields that you would like kept secret. Next, place the values in the 87 | /// corresponding environment variable. Finally, in your behavior's Awake or Start method, call 88 | /// SecretHelper.LoadSecrets(this). 89 | /// 90 | /// 91 | /// For an example of using , please see LuisManager. 92 | /// 93 | /// 94 | /// IMPORTANT: Please be aware that Unity Editor only loads environment variables once on start. 95 | /// You will need to close Unity and open it again for changes to environment variables to take effect. 96 | /// Also, Unity Hub acts as a parent process when starting Unity from the Hub. Therefore you will need 97 | /// to close not only Unity but also Unity Hub (which runs in the tray) before changes will take effect. 98 | /// 99 | /// 100 | static public class SecretHelper 101 | { 102 | #region Internal Methods 103 | /// 104 | /// Gets the default value for a specified type. 105 | /// 106 | /// 107 | /// The type to obtain the default for. 108 | /// 109 | /// 110 | /// The default value for the type. 111 | /// 112 | static private object GetDefaultValue(Type t) 113 | { 114 | if (t.IsValueType) 115 | { 116 | return Activator.CreateInstance(t); 117 | } 118 | else 119 | { 120 | return null; 121 | } 122 | } 123 | 124 | /// 125 | /// Attempts to load a secret value into the specified field. 126 | /// 127 | /// 128 | /// A that indicates the source of the secret value. 129 | /// 130 | /// 131 | /// The field where the value will be loaded. 132 | /// 133 | /// 134 | /// The object instance where the value will be set. 135 | /// 136 | /// 137 | /// true to overwrite non-default values; otherwise false. The default is false. 138 | /// 139 | /// 140 | /// By default will only update fields that are set to default values 141 | /// (e.g. 0 for int and null or "" for string). This allows values set in the Unity inspector to 142 | /// override values stored in the environment. If values in the environment should always take 143 | /// precedence over values stored in the field set to true. 144 | /// 145 | static private void TryLoadValue(SecretValueAttribute sva, FieldInfo field, object obj, bool overwrite = false) 146 | { 147 | // Validate 148 | if (sva == null) throw new ArgumentNullException(nameof(sva)); 149 | if (field == null) throw new ArgumentNullException(nameof(field)); 150 | if (obj == null) throw new ArgumentNullException(nameof(obj)); 151 | 152 | // Now get the current value of the field 153 | object curValue = field.GetValue(obj); 154 | 155 | // If we're not overwriting values, we need to check to check and make sure a non-default value is not already set 156 | if (!overwrite) 157 | { 158 | // What is the default value for the field? 159 | object defValue = GetDefaultValue(field.FieldType); 160 | 161 | // Is it the current value the same as the default value? 162 | bool isDefaultValue = ((curValue == defValue) || ((field.FieldType == typeof(string)) && (string.IsNullOrEmpty((string)curValue)))); 163 | 164 | // If the current value is not the default value, the secret has already been supplied 165 | // and we don't need to do any more work. 166 | if (!isDefaultValue) { return; } 167 | } 168 | 169 | // Either in overwrite mode or a default value. Let's try to read the environment variable. 170 | string svalue = Environment.GetEnvironmentVariable(sva.Name); 171 | 172 | // Check for no environment variable or no value set. 173 | if (string.IsNullOrEmpty(svalue)) 174 | { 175 | Debug.LogWarning($"{obj.GetType().Name}.{field.Name} has the default value '{curValue}' but the environment variable {sva.Name} is missing or not set."); 176 | return; 177 | } 178 | 179 | // If string, just assign. Otherwise attempt to convert. 180 | if (field.FieldType == typeof(string)) 181 | { 182 | field.SetValue(obj, svalue); 183 | } 184 | else 185 | { 186 | try 187 | { 188 | object cvalue = Convert.ChangeType(svalue, field.FieldType); 189 | field.SetValue(obj, cvalue); 190 | } 191 | catch (Exception ex) 192 | { 193 | Debug.LogWarning($"The value '{svalue}' of environment variable {sva.Name} could not be converted to {field.FieldType.Name}. {ex.Message}"); 194 | } 195 | } 196 | } 197 | #endregion // Internal Methods 198 | 199 | #region Public Methods 200 | /// 201 | /// Attempts to load all secret values for the specified object. 202 | /// 203 | /// 204 | /// The object where secret values will be loaded. 205 | /// 206 | static public void LoadSecrets(object obj) 207 | { 208 | // Validate 209 | if (obj == null) throw new ArgumentNullException(nameof(obj)); 210 | 211 | // Get all fields 212 | FieldInfo[] fields = obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); 213 | 214 | // Look for secret fields 215 | foreach (var field in fields) 216 | { 217 | // Try to get attribute 218 | SecretValueAttribute sva = field.GetCustomAttribute(); 219 | 220 | // If not a secret, skip 221 | if (sva == null) { continue; } 222 | 223 | // Try to load the value 224 | TryLoadValue(sva, field, obj); 225 | } 226 | } 227 | #endregion // Public Methods 228 | } 229 | } -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/Common/Scripts/SecretHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1367348fc0344245bfc3e9f2788bc85 3 | timeCreated: 1518192940 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc4a9b21378edde47810d5a29ae13a35 3 | folderAsset: yes 4 | timeCreated: 1518188532 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Domains.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 951fcbdb113dc5a408e4b555f870b230 3 | folderAsset: yes 4 | timeCreated: 1523236001 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Domains/MRLUIS.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75f0facfa9b3f2d4d9a5dd8576d25124 3 | timeCreated: 1523236001 4 | licenseType: Pro 5 | TextScriptImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 513d33d8ad9393b49bd87fdb8381af60 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Prefabs/LuisTester.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cb2d102fe645a84eb298c48c4fc810f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 100100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/README.md: -------------------------------------------------------------------------------- 1 | # LUIS for XR 2 | 3 | LUIS for XR is a reference implementation for Natural Language Understanding in XR applications using [LUIS](https://www.luis.ai/home). 4 | 5 | - [Why Natural Language](#why-natural-language) 6 | - [Getting Started](#getting-started) 7 | - [System Requirements](#system-requirements) 8 | - [Special Thanks](#special-thanks) 9 | 10 | 11 | ## Why Natural Language 12 | 13 | For an overview of Natural Language and why it's more powerful than traditional voice commands, please see: 14 | 15 | [Natural Language for Simulations](http://www.roadtomr.com/2018/05/08/2508/natural-language-for-simulations) 16 | 17 | [![](http://www.roadtomr.com/wp-content/uploads/2018/05/NLSimFeature.png)](http://www.roadtomr.com/2018/05/08/2508/natural-language-for-simulations) 18 | 19 | 20 | ## Getting Started 21 | 22 | This reference is easy to use and is distributed as a [Unity Package](http://aka.ms/mrluispack). For a complete step-by-step guide on how to get started using it in your own applications, please see the article: 23 | 24 | [NLU For XR With LUIS](http://www.roadtomr.com/2018/05/08/2555/nlu-for-xr-with-luis) 25 | 26 | [![](http://www.roadtomr.com/wp-content/uploads/2018/05/LuisXRFeat.png)](http://www.roadtomr.com/2018/05/08/2555/nlu-for-xr-with-luis) 27 | 28 | 29 | ## System Requirements 30 | - Unity 2017.2 or later 31 | - `.NET 4.6` under player settings 32 | - `.NET backend` under player settings 33 | 34 | Though you will see "Mixed Reality" mentioned throughout this reference, it is not exclusive to Windows Mixed Reality devices. This code will work with all Unity projects that support .NET 4.6. The only exception to this rule is the **Luis Dictation Manager** which needs Windows 10 APIs to access the microphone. This component is optional and will work on all devices that run Windows 10, including HoloLens. 35 | 36 | 37 | ## Special Thanks ## 38 | The [earliest prototype](https://github.com/ashanhol/LUISMR) of this project was developed during an internal Microsoft hack in December 2017. That team consisted of [Adina Shanholtz](http://adinashanholtz.com), [Anna Fear](https://www.linkedin.com/in/avfear) and [David Douglas](http://www.deadlyfingers.net). The Reference Architecture here evolved out that prototype during a Microsoft + Partner hack in February 2018. The primary contributors to this reference included [Jared Bienz](https://www.linkedin.com/in/jbienz) from [Microsoft](http://www.microsoft.com), [Michael House](https://www.linkedin.com/in/housemichael) from [Object Theory](http://objecttheory.com) and [Stephen Hodgson](https://www.linkedin.com/in/stephenjhodgson) from [Valorem](https://www.valorem.com). 39 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29dbc198602d76f4aa16b238137ce16a 3 | timeCreated: 1518192966 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04ee24cfdb53edd438723456060afdb8 3 | folderAsset: yes 4 | timeCreated: 1518189239 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Context.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de8d4989ea4aea3438cb679b4986522e 3 | folderAsset: yes 4 | timeCreated: 1524157088 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Context/IContextProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Threading.Tasks; 31 | 32 | namespace Microsoft.MR.LUIS 33 | { 34 | /// 35 | /// Captures context for a LUIS prediction. 36 | /// 37 | public interface IContextProvider 38 | { 39 | /// 40 | /// Captures context information for a LUIS prediction. 41 | /// 42 | /// 43 | /// The where information will be stored. 44 | /// 45 | void CaptureContext(PredictionContext context); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Context/IContextProvider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85f67023e4220e24bb994aeaa3c33bce 3 | timeCreated: 1518567393 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Context/PredictionContext.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Threading.Tasks; 31 | using UnityEngine; 32 | 33 | namespace Microsoft.MR.LUIS 34 | { 35 | /// 36 | /// Provides contextual information that can be used during a LUIS prediction. 37 | /// 38 | public class PredictionContext : Dictionary 39 | { 40 | #region Constants 41 | public const string GazedObjectKey = "GazedObject"; 42 | public const string PointedObjectKey = "PointedObject"; 43 | public const string PredictionTextKey = "PredictionText"; 44 | public const string SpokenTextKey = "SpokenText"; 45 | #endregion // Constants 46 | 47 | /// 48 | /// Gets or sets the object that the user was gazing at for the prediction. 49 | /// 50 | public GameObject GazedObject 51 | { 52 | get 53 | { 54 | return this[GazedObjectKey] as GameObject; 55 | } 56 | set 57 | { 58 | this[GazedObjectKey] = value; 59 | } 60 | } 61 | 62 | /// 63 | /// Gets or sets the object that the user was pointing at for the prediction. 64 | /// 65 | public GameObject PointedObject 66 | { 67 | get 68 | { 69 | return this[PointedObjectKey] as GameObject; 70 | } 71 | set 72 | { 73 | this[PointedObjectKey] = value; 74 | } 75 | } 76 | 77 | /// 78 | /// Gets or sets the object that the user was pointing at for the prediction. 79 | /// 80 | public string PredictionText 81 | { 82 | get 83 | { 84 | return this[PredictionTextKey] as string; 85 | } 86 | set 87 | { 88 | this[PredictionTextKey] = value; 89 | } 90 | } 91 | 92 | /// 93 | /// Gets or sets the text that the user spoke. 94 | /// 95 | public string SpokenText 96 | { 97 | get 98 | { 99 | return this[SpokenTextKey] as string; 100 | } 101 | set 102 | { 103 | this[SpokenTextKey] = value; 104 | 105 | // If spoken text is a valid string and there is no 106 | // prediction text, set the prediction text as well. 107 | if (!string.IsNullOrEmpty(value) && (!this.ContainsKey(PredictionTextKey))) 108 | { 109 | PredictionText = value; 110 | } 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Context/PredictionContext.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a08df9bcf35fe5d4f918bd369980eda4 3 | timeCreated: 1518567393 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcbfe18bd7c0e6c4c98e9d1f36df3d88 3 | folderAsset: yes 4 | timeCreated: 1518730093 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Editor/LuisTesterEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | [CustomEditor(typeof(LuisTester))] 7 | public class LuisTesterEditor : Editor 8 | { 9 | public override void OnInspectorGUI() 10 | { 11 | DrawDefaultInspector(); 12 | 13 | if (Application.isPlaying) 14 | { 15 | if (GUILayout.Button("Predict")) 16 | { 17 | LuisTester tester = (LuisTester)target; 18 | if (tester != null) 19 | { 20 | tester.TryPredict(); 21 | } 22 | } 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Editor/LuisTesterEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a43913e0d47e66541803993b55cbc7d5 3 | timeCreated: 1518730131 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed9e86a5d15c84d47bbc6627ea889a64 3 | folderAsset: yes 4 | timeCreated: 1524157130 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/AppearanceIntentHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.MR; 27 | using Microsoft.MR.LUIS; 28 | using System.Collections; 29 | using System.Collections.Generic; 30 | using UnityEngine; 31 | using Microsoft.Cognitive.LUIS; 32 | using System.Linq; 33 | 34 | /// 35 | /// An intent handler that can change the visual appearance of an object. 36 | /// 37 | public class AppearanceIntentHandler : MonoBehaviour, IIntentHandler 38 | { 39 | #region Internal Methods 40 | private void HandleChangeAppearance(LuisMRResult result) 41 | { 42 | // Get the colors mentioned in the prediction 43 | var colorEntity = result.PredictionResult.Entities.FirstOrDefaultItem("MR.Color"); 44 | if (colorEntity == null) { return; } 45 | 46 | // Try to convert the entity color to a Unity color 47 | Color color; 48 | if (!ColorMapper.TryParseCssString(colorEntity.Value.ToLower(), out color)) 49 | { 50 | Debug.LogWarning($"The value \"{colorEntity.Value}\" does not map to a known color."); 51 | return; 52 | } 53 | 54 | // Get renderer 55 | var renderer = GetComponent(); 56 | if (renderer == null) { return; } 57 | 58 | // Set the color 59 | renderer.material.color = color; 60 | } 61 | #endregion // Internal Methods 62 | 63 | #region Public Methods 64 | /// 65 | /// 66 | /// 67 | public bool CanHandle(string intentName) 68 | { 69 | switch (intentName) 70 | { 71 | case "MR.ChangeAppearance": 72 | return true; 73 | default: 74 | return false; 75 | } 76 | } 77 | 78 | /// 79 | /// 80 | /// 81 | public void Handle(Intent intent, LuisMRResult result) 82 | { 83 | switch (intent.Name) 84 | { 85 | case "MR.ChangeAppearance": 86 | HandleChangeAppearance(result); 87 | break; 88 | } 89 | } 90 | #endregion // Public Methods 91 | } 92 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/AppearanceIntentHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36a05a97b4eeab348b969b19722c8ab7 3 | timeCreated: 1518661349 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/DebugIntentHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using Microsoft.MR.LUIS; 28 | using System; 29 | using System.Collections.Generic; 30 | using System.Linq; 31 | using System.Text; 32 | using System.Threading.Tasks; 33 | using UnityEngine; 34 | 35 | /// 36 | /// A global intent handler that prints information about all received intents. 37 | /// 38 | public class DebugIntentHandler : IIntentHandler 39 | { 40 | #region Public Methods 41 | /// 42 | /// 43 | /// 44 | public bool CanHandle(string intentName) 45 | { 46 | //This is the debug handler, we want it to be able to act on any intent. 47 | return true; 48 | } 49 | 50 | /// 51 | /// 52 | /// 53 | public void Handle(Intent intent, LuisMRResult result) 54 | { 55 | //Build up a string of information about the result we got from LUIS 56 | StringBuilder sb = new StringBuilder(); 57 | sb.AppendLine($"Utterance: {result.Context.PredictionText}"); 58 | sb.Append($"Intent: {intent.Name}"); 59 | foreach (string entityKey in result.PredictionResult.Entities.Keys) 60 | { 61 | sb.Append($" [{entityKey}]"); 62 | } 63 | sb.AppendLine(); 64 | sb.AppendLine($"Intent Score: {intent.Score.ToString("P")}"); 65 | sb.AppendLine("Entities: "); 66 | foreach (string entityKey in result.PredictionResult.Entities.Keys) 67 | { 68 | sb.AppendLine($" Entity: {entityKey}"); 69 | foreach (Entity e in result.PredictionResult.Entities[entityKey]) 70 | { 71 | sb.AppendLine($" Value: {e.Value}"); 72 | sb.AppendLine($" Score: {e.Score}"); 73 | } 74 | } 75 | //Then write it to the console 76 | Debug.Log(sb.ToString()); 77 | } 78 | #endregion // Public Methods 79 | } -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/DebugIntentHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dd2616a162189f48853f744373866cd 3 | timeCreated: 1518679031 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/IIntentHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Text; 31 | using System.Threading.Tasks; 32 | using UnityEngine.EventSystems; 33 | 34 | namespace Microsoft.MR.LUIS 35 | { 36 | /// 37 | /// The interface for a class that can handle a LUIS MR intent. 38 | /// 39 | public interface IIntentHandler : IEventSystemHandler 40 | { 41 | /// 42 | /// Returns true if the handler can handle the specified intent. 43 | /// 44 | /// 45 | /// The name of the intent to test. 46 | /// 47 | /// 48 | /// true if the intent can be handled; otherwise false. 49 | /// 50 | bool CanHandle(string intentName); 51 | 52 | /// 53 | /// Handles the intent stored within the . 54 | /// 55 | /// 56 | /// The to handle. 57 | /// 58 | /// 59 | /// The that contains the result of the prediction. 60 | /// 61 | void Handle(Intent intent, LuisMRResult result); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/IIntentHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb96736b07220c74aaf1fbc1efce1808 3 | timeCreated: 1518638625 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/IntentEventData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using System; 27 | using System.Collections; 28 | using System.Collections.Generic; 29 | using Microsoft.Cognitive.LUIS; 30 | using UnityEngine; 31 | using UnityEngine.EventSystems; 32 | 33 | namespace Microsoft.MR.LUIS 34 | { 35 | /// 36 | /// Provides a method of handling LUIS intents through the Unity Event system. 37 | /// 38 | public class IntentEventData : BaseEventData 39 | { 40 | #region Constructors 41 | /// 42 | /// Initializes a new . 43 | /// 44 | /// 45 | /// The event system that the event should attach to. 46 | /// 47 | public IntentEventData(EventSystem eventSystem) : base(eventSystem) { } 48 | #endregion // Constructors 49 | 50 | #region Public Methods 51 | /// 52 | /// Reinitializes the event to new values. 53 | /// 54 | /// 55 | /// The that should be handled by the event. 56 | /// 57 | /// 58 | /// The that was returned by the prediction. 59 | /// 60 | public void Initialize(Intent intent, LuisMRResult result) 61 | { 62 | // Validate 63 | if (intent == null) throw new ArgumentNullException(nameof(intent)); 64 | if (result == null) throw new ArgumentNullException(nameof(result)); 65 | 66 | // Store 67 | Reset(); 68 | Result = result; 69 | Intent = intent; 70 | } 71 | #endregion // Public Methods 72 | 73 | #region Public Properties 74 | /// 75 | /// Gets the that should be handled by the event. 76 | /// 77 | public Intent Intent { get; private set; } 78 | 79 | /// 80 | /// Gets the that was returned by the prediction. 81 | /// 82 | /// 83 | /// The contains additional information that may be helpful 84 | /// to process the intent. For example, contains the 85 | /// Context information that was captured for 86 | /// the prediction. 87 | /// 88 | public LuisMRResult Result { get; private set; } 89 | #endregion // Public Properties 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/IntentEventData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec83674a71bf53946a5e76b3c9aa1e83 3 | timeCreated: 1518635607 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/TransformIntentHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.MR.LUIS; 27 | using System.Collections; 28 | using System.Collections.Generic; 29 | using UnityEngine; 30 | using Microsoft.Cognitive.LUIS; 31 | using System.Linq; 32 | 33 | /// 34 | /// An intent handler that can modify the transform of an object. 35 | /// 36 | public class TransformIntentHandler : MonoBehaviour, IIntentHandler 37 | { 38 | #region Unity Inspector Variables 39 | [Tooltip("The amount to rotate by if no amount is specified.")] 40 | public float unspecifiedRotateAmount = 45f; 41 | 42 | [Tooltip("The amount to scale by if no amount is specified.")] 43 | public float unspecifiedScaleAmount = 0.25f; 44 | #endregion // Unity Inspector Variables 45 | 46 | #region Internal Methods 47 | private void DoRotate(LuisMRResult result) 48 | { 49 | // Which direction? 50 | var roateDirection = result.PredictionResult.Entities.FirstOrDefaultItem("MR.RotateDirection"); 51 | bool counterClockwise = (roateDirection?.Value == "counterclockwise"); 52 | 53 | // TODO: Determine which amount 54 | float amount = unspecifiedRotateAmount; 55 | 56 | // Rotate 57 | gameObject.transform.Rotate(gameObject.transform.up, (counterClockwise ? -amount : amount)); 58 | } 59 | 60 | private void DoScale(LuisMRResult result) 61 | { 62 | // Which direction? 63 | var scaleDirection = result.PredictionResult.Entities.FirstOrDefaultItem("MR.ScaleDirection"); 64 | if (scaleDirection == null) { return; } 65 | var direction = scaleDirection.FirstOrDefaultResolution(); 66 | 67 | // TODO: Determine which amount 68 | float amount = unspecifiedScaleAmount; 69 | 70 | // Actual scale 71 | switch (direction.ToLower()) 72 | { 73 | case "decrease": 74 | //gameObject.transform.localScale.Scale(new Vector3(amount, amount, amount)); 75 | gameObject.transform.localScale *= (1.0f - amount); 76 | break; 77 | case "increase": 78 | gameObject.transform.localScale *= (1.0f + amount); 79 | break; 80 | } 81 | } 82 | 83 | private void DoTranslate(LuisMRResult result) 84 | { 85 | 86 | } 87 | 88 | private void HandleTransform(LuisMRResult result) 89 | { 90 | // Which transform? 91 | string transformTypeName = null; 92 | var transformType = result.PredictionResult.Entities.FirstOrDefaultItem("MR.TransformType"); 93 | if (transformType != null) { transformTypeName = transformType.Value; } 94 | 95 | // If a transform type wasn't specified, let's see if there's a scale? 96 | if (transformTypeName == null) 97 | { 98 | // Try to get a scale direction 99 | var scaleDirection = result.PredictionResult.Entities.FirstOrDefaultItem("MR.ScaleDirection"); 100 | if (scaleDirection != null) { transformTypeName = "scale"; } 101 | 102 | } 103 | 104 | // If there's still no transform type name, nothing to do. 105 | if (transformTypeName == null) 106 | { 107 | Debug.LogWarning("Received Transform intent but could not determine transform type."); 108 | return; 109 | } 110 | 111 | // Which transform type? 112 | switch (transformTypeName) 113 | { 114 | case "rotate": 115 | DoRotate(result); 116 | break; 117 | case "scale": 118 | DoScale(result); 119 | break; 120 | case "translate": 121 | DoTranslate(result); 122 | break; 123 | } 124 | } 125 | #endregion // Internal Methods 126 | 127 | #region Public Methods 128 | /// 129 | /// 130 | /// 131 | public bool CanHandle(string intentName) 132 | { 133 | switch (intentName) 134 | { 135 | case "MR.Transform": 136 | return true; 137 | default: 138 | return false; 139 | } 140 | } 141 | 142 | /// 143 | /// 144 | /// 145 | public void Handle(Intent intent, LuisMRResult result) 146 | { 147 | switch (intent.Name) 148 | { 149 | case "MR.Transform": 150 | HandleTransform(result); 151 | break; 152 | } 153 | } 154 | #endregion // Public Methods 155 | } 156 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Intent/TransformIntentHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bcce45eed8650e41a20b77fb255c5e0 3 | timeCreated: 1518661349 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisDictationManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using System; 27 | using System.Collections; 28 | using System.Text; 29 | using UnityEngine; 30 | 31 | #if UNITY_WSA || UNITY_STANDALONE_WIN 32 | using UnityEngine.Windows.Speech; 33 | #endif // UNITY_WSA || UNITY_STANDALONE_WIN 34 | 35 | 36 | namespace Microsoft.MR.LUIS 37 | { 38 | /// 39 | /// Used by . Phrases under the specified minimum level will be ignored. 40 | /// 41 | public enum DictationConfidenceLevel 42 | { 43 | /// 44 | /// High confidence level. 45 | /// 46 | High = 0, 47 | 48 | /// 49 | /// Medium confidence level. 50 | /// 51 | Medium = 1, 52 | 53 | /// 54 | /// Low confidence level. 55 | /// 56 | Low = 2, 57 | } 58 | 59 | /// 60 | /// Provides a method of invoking LUIS using speech recognized by . 61 | /// 62 | public class LuisDictationManager : MonoBehaviour 63 | { 64 | #region Constants 65 | #if UNITY_ANDROID 66 | private const string PLUGIN_CLASS = "com.microsoft.androidspeech.SpeechPlugin"; 67 | #endif // UNITY_ANDROID 68 | #endregion // Constants 69 | 70 | #region Member Variables 71 | private string dictationResult; // String result of the current dictation. 72 | private bool isListening; 73 | private StringBuilder textSoFar = new StringBuilder(); // Caches the text currently being displayed in dictation display text. 74 | 75 | #if UNITY_ANDROID 76 | static private AndroidJavaClass pluginInstance; 77 | #endif // UNITY_ANDROID 78 | 79 | #if UNITY_WSA || UNITY_STANDALONE_WIN 80 | private string deviceName = string.Empty; // Empty string specifies the default microphone. 81 | private DictationRecognizer dictationRecognizer; 82 | private bool isTransitioning; 83 | private int samplingRate; // The device audio sampling rate. 84 | #endif // UNITY_WSA || UNITY_STANDALONE_WIN 85 | #endregion // Member Variables 86 | 87 | #region Unity Inspector Variables 88 | [Tooltip("The time length in seconds before dictation recognizer session ends due to lack of audio input.")] 89 | [Range(1f, 60f)] 90 | [SerializeField] 91 | private float autoSilenceTimeout = 2f; 92 | 93 | [Tooltip("Whether or not the dictation manager should listen on start.")] 94 | [SerializeField] 95 | private bool autoStartListening = true; 96 | 97 | [Tooltip("Whether or not the dictation manager should continue to listen after a recognition or timeout.")] 98 | [SerializeField] 99 | private bool continuousRecognition = true; 100 | 101 | [Tooltip("Optional TextMesh that can be used to show the status of the manager.")] 102 | [SerializeField] 103 | private TextMesh debugOutput; 104 | 105 | [Tooltip("The time length in seconds before dictation recognizer session ends due to lack of audio input in case there was no audio heard in the current session.")] 106 | [Range(1f, 60f)] 107 | [SerializeField] 108 | private float initialSilenceTimeout = 5f; 109 | 110 | [Tooltip("The LuisManager where recognitions will be routed.")] 111 | [SerializeField] 112 | private LuisManager luisManager; 113 | 114 | [Tooltip("The minimum confidence level for the recognition to be passed to LuisManager.")] 115 | [SerializeField] 116 | private DictationConfidenceLevel minimumConfidenceLevel = DictationConfidenceLevel.Medium; 117 | 118 | [Tooltip("Length in seconds for the manager to listen.")] 119 | [Range(1, 60)] 120 | [SerializeField] 121 | private int recordingTime = 10; 122 | #endregion // Unity Inspector Variables 123 | 124 | #region Internal Methods 125 | private void LogInfo(string message, bool toConsole = true) 126 | { 127 | if (toConsole) 128 | { 129 | Debug.Log(message); 130 | } 131 | if (debugOutput != null) 132 | { 133 | debugOutput.color = Color.white; 134 | debugOutput.text = message; 135 | } 136 | } 137 | 138 | private void LogError(string message, bool toConsole = true) 139 | { 140 | if (toConsole) 141 | { 142 | Debug.LogError(message); 143 | } 144 | if (debugOutput != null) 145 | { 146 | debugOutput.color = Color.red; 147 | debugOutput.text = message; 148 | } 149 | } 150 | 151 | private void LogWarn(string message, bool toConsole = true) 152 | { 153 | if (toConsole) 154 | { 155 | Debug.LogWarning(message); 156 | } 157 | if (debugOutput != null) 158 | { 159 | debugOutput.color = Color.yellow; 160 | debugOutput.text = message; 161 | } 162 | } 163 | 164 | #if UNITY_ANDROID 165 | static private void PluginExecute(string methodName, params object[] args) 166 | { 167 | #if !UNITY_EDITOR 168 | if (pluginInstance == null) 169 | { 170 | pluginInstance = new AndroidJavaClass(PLUGIN_CLASS); 171 | } 172 | pluginInstance.CallStatic(methodName, args); 173 | #endif // !UNITY_EDITOR 174 | } 175 | 176 | private void StartListeningAndroid() 177 | { 178 | PluginExecute("StartListening"); 179 | } 180 | 181 | private void StopListeningAndroid() 182 | { 183 | PluginExecute("StopListening"); 184 | } 185 | #endif // UNITY_ANDROID 186 | 187 | #if UNITY_WSA || UNITY_STANDALONE_WIN 188 | private void AwakeWin() 189 | { 190 | // Query the maximum frequency of the default microphone. 191 | int minSamplingRate; // Not used. 192 | Microphone.GetDeviceCaps(deviceName, out minSamplingRate, out samplingRate); 193 | 194 | dictationRecognizer = new DictationRecognizer(); 195 | dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis; 196 | dictationRecognizer.DictationResult += DictationRecognizer_DictationResult; 197 | dictationRecognizer.DictationComplete += DictationRecognizer_DictationComplete; 198 | dictationRecognizer.DictationError += DictationRecognizer_DictationError; 199 | } 200 | 201 | private void OnDestroyWin() 202 | { 203 | if (dictationRecognizer != null) 204 | { 205 | dictationRecognizer.Dispose(); 206 | dictationRecognizer = null; 207 | } 208 | } 209 | 210 | private void StartListeningWin() 211 | { 212 | if (!isTransitioning) 213 | { 214 | StartCoroutine(StartListeningWinRoutine(initialSilenceTimeout, autoSilenceTimeout, recordingTime)); 215 | } 216 | } 217 | 218 | /// 219 | /// Turns on the dictation recognizer and begins recording audio from the default microphone. 220 | /// 221 | /// The time length in seconds before dictation recognizer session ends due to lack of audio input in case there was no audio heard in the current session. 222 | /// The time length in seconds before dictation recognizer session ends due to lack of audio input. 223 | /// Length in seconds for the manager to listen. 224 | /// 225 | private IEnumerator StartListeningWinRoutine(float initialSilenceTimeout = 5f, float autoSilenceTimeout = 20f, int recordingTime = 10) 226 | { 227 | if (isListening || isTransitioning) 228 | { 229 | Debug.LogWarning("Unable to start recording"); 230 | yield break; 231 | } 232 | 233 | LogInfo("Starting recognizer"); 234 | 235 | isListening = true; 236 | isTransitioning = true; 237 | 238 | if (PhraseRecognitionSystem.Status == SpeechSystemStatus.Running) 239 | { 240 | PhraseRecognitionSystem.Shutdown(); 241 | } 242 | 243 | while (PhraseRecognitionSystem.Status == SpeechSystemStatus.Running) 244 | { 245 | yield return null; 246 | } 247 | 248 | dictationRecognizer.InitialSilenceTimeoutSeconds = initialSilenceTimeout; 249 | dictationRecognizer.AutoSilenceTimeoutSeconds = autoSilenceTimeout; 250 | dictationRecognizer.Start(); 251 | 252 | LogInfo("Waiting for speech system"); 253 | 254 | while (dictationRecognizer.Status == SpeechSystemStatus.Stopped) 255 | { 256 | yield return null; 257 | } 258 | 259 | LogInfo("Starting microphone"); 260 | 261 | // Start recording from the microphone. 262 | Microphone.Start(deviceName, false, recordingTime, samplingRate); 263 | textSoFar.Clear(); 264 | isTransitioning = false; 265 | 266 | LogInfo("Listening"); 267 | } 268 | 269 | private void StopListeningWin() 270 | { 271 | if (!isTransitioning) 272 | { 273 | StartCoroutine(StopListeningWinRoutine()); 274 | } 275 | } 276 | 277 | /// 278 | /// Ends the recording session. 279 | /// 280 | private IEnumerator StopListeningWinRoutine() 281 | { 282 | if (!isListening || isTransitioning) 283 | { 284 | LogWarn("Unable to stop recording"); 285 | yield break; 286 | } 287 | 288 | isListening = false; 289 | isTransitioning = true; 290 | 291 | LogInfo("Stopping microphone"); 292 | Microphone.End(deviceName); 293 | 294 | LogInfo("Stopping dictation"); 295 | if (dictationRecognizer.Status == SpeechSystemStatus.Running) 296 | { 297 | dictationRecognizer.Stop(); 298 | } 299 | 300 | LogInfo("Waiting for speech to stop"); 301 | while (dictationRecognizer.Status == SpeechSystemStatus.Running) 302 | { 303 | yield return null; 304 | } 305 | 306 | PhraseRecognitionSystem.Restart(); 307 | isTransitioning = false; 308 | 309 | LogInfo("Stopped listening"); 310 | } 311 | #endif // UNITY_WSA || UNITY_STANDALONE_WIN 312 | #endregion // Internal Methods 313 | 314 | #region Overrides / Event Handlers 315 | #if UNITY_ANDROID 316 | public void OnSpeechBegin() 317 | { 318 | 319 | } 320 | 321 | public void OnSpeechEnd() 322 | { 323 | isListening = false; 324 | } 325 | 326 | public void OnSpeechError(int error, string message) 327 | { 328 | isListening = false; 329 | } 330 | 331 | public void OnSpeechPartialResult(string partialResult) 332 | { 333 | LogInfo(partialResult, toConsole: false); 334 | } 335 | 336 | public void OnSpeechRead() 337 | { 338 | isListening = true; 339 | } 340 | 341 | public async void OnSpeechResult(string speechResult) 342 | { 343 | // No longer listening 344 | isListening = false; 345 | 346 | // We have final text 347 | dictationResult = speechResult; 348 | 349 | if (luisManager != null) 350 | { 351 | LogInfo($"Heard '{dictationResult}', sending to LUIS."); 352 | await luisManager.PredictAndHandleAsync(dictationResult); 353 | } 354 | else 355 | { 356 | LogError($"Heard '{dictationResult}' but no LuisManager available."); 357 | } 358 | 359 | // If continuous, start again. 360 | if (continuousRecognition) 361 | { 362 | StartListeningAndroid(); 363 | } 364 | } 365 | #endif // UNITY_ANDROID 366 | 367 | #if UNITY_WSA || UNITY_STANDALONE_WIN 368 | /// 369 | /// This event is fired while the user is talking. As the recognizer listens, it provides text of what it's heard so far. 370 | /// 371 | /// The currently hypothesized recognition. 372 | private void DictationRecognizer_DictationHypothesis(string text) 373 | { 374 | // We don't want to append to textSoFar yet, because the hypothesis may have changed on the next event. 375 | dictationResult = textSoFar.ToString() + " " + text + "..."; 376 | LogInfo(text, toConsole:false); 377 | } 378 | 379 | /// 380 | /// This event is fired after the user pauses, typically at the end of a sentence. The full recognized string is returned here. 381 | /// 382 | /// The text that was heard by the recognizer. 383 | /// A representation of how confident (rejected, low, medium, high) the recognizer is of this recognition. 384 | private async void DictationRecognizer_DictationResult(string text, ConfidenceLevel confidence) 385 | { 386 | // We have final text 387 | dictationResult = text; 388 | 389 | // Clear intermediate text 390 | textSoFar.Clear(); 391 | 392 | // Make sure we have a minimum confidence level 393 | if (confidence > (ConfidenceLevel)minimumConfidenceLevel) // Numerically this is inverted. Lower confidence levels are higher numbers. 394 | { 395 | LogWarn($"Heard '{dictationResult}' but confidence was too low."); 396 | } 397 | else 398 | { 399 | if (luisManager != null) 400 | { 401 | LogInfo($"Heard '{dictationResult}', sending to LUIS."); 402 | await luisManager.PredictAndHandleAsync(dictationResult); 403 | } 404 | else 405 | { 406 | LogError($"Heard '{dictationResult}' but no LuisManager available."); 407 | } 408 | } 409 | } 410 | 411 | /// 412 | /// This event is fired when the recognizer stops, whether from StartRecording() being called, a timeout occurring, or some other error. 413 | /// Typically, this will simply return "Complete". In this case, we check to see if the recognizer timed out. 414 | /// 415 | /// An enumerated reason for the session completing. 416 | private void DictationRecognizer_DictationComplete(DictationCompletionCause cause) 417 | { 418 | // Clear for next recognition 419 | textSoFar.Clear(); 420 | dictationResult = string.Empty; 421 | 422 | // If continuous, start again. Otherwise stop. 423 | if (continuousRecognition) 424 | { 425 | dictationRecognizer.Start(); 426 | } 427 | else 428 | { 429 | StopListening(); 430 | } 431 | } 432 | 433 | /// 434 | /// This event is fired when an error occurs. 435 | /// TODO: Hook up something so any external actors know we've errored. 436 | /// 437 | /// The string representation of the error reason. 438 | /// The int representation of the hresult. 439 | private void DictationRecognizer_DictationError(string error, int hresult) 440 | { 441 | dictationResult = error + "\nHRESULT: " + hresult.ToString(); 442 | 443 | textSoFar.Clear(); 444 | dictationResult = string.Empty; 445 | 446 | if (debugOutput != null) 447 | { 448 | debugOutput.color = Color.red; 449 | debugOutput.text = error; 450 | } 451 | 452 | Debug.LogError(error); 453 | StartCoroutine(StopListeningWinRoutine()); 454 | 455 | } 456 | #endif // UNITY_WSA || UNITY_STANDALONE_WIN 457 | #endregion // Overrides / Event Handlers 458 | 459 | #region Unity Overrides 460 | protected virtual void Awake() 461 | { 462 | #if UNITY_WSA || UNITY_STANDALONE_WIN 463 | AwakeWin(); 464 | #endif // UNITY_WSA || UNITY_STANDALONE_WIN 465 | } 466 | 467 | protected virtual void Start() 468 | { 469 | // If no LuisManager, try to get one from the same GameObject. 470 | if (luisManager == null) 471 | { 472 | luisManager = GetComponent(); 473 | } 474 | 475 | // Validate components 476 | if (luisManager == null) 477 | { 478 | Debug.LogError($"{nameof(luisManager)} is not set to a valid instance. {nameof(LuisDictationManager)} is disabled."); 479 | enabled = false; 480 | return; 481 | } 482 | 483 | // Start listening? 484 | if (autoStartListening) 485 | { 486 | StartListening(); 487 | } 488 | } 489 | 490 | protected virtual void OnDestroy() 491 | { 492 | #if UNITY_WSA || UNITY_STANDALONE_WIN 493 | OnDestroyWin(); 494 | #endif // UNITY_WSA || UNITY_STANDALONE_WIN 495 | } 496 | #endregion // Unity Overrides 497 | 498 | #region Public Methods 499 | /// 500 | /// Starts the dictation listening. 501 | /// 502 | public void StartListening() 503 | { 504 | #if UNITY_ANDROID 505 | StartListeningAndroid(); 506 | #elif UNITY_WSA || UNITY_STANDALONE_WIN 507 | StartListeningWin(); 508 | #endif 509 | } 510 | 511 | /// 512 | /// Stops the dictation from listening. 513 | /// 514 | public void StopListening() 515 | { 516 | #if UNITY_ANDROID 517 | StopListeningAndroid(); 518 | #elif UNITY_WSA || UNITY_STANDALONE_WIN 519 | StopListeningWin(); 520 | #endif 521 | } 522 | #endregion // Public Methods 523 | 524 | #region Public Properties 525 | /// 526 | /// Gets or sets the time length in seconds before dictation recognizer session ends due to lack of audio input. 527 | /// 528 | public float AutoSilenceTimeout 529 | { 530 | get 531 | { 532 | return autoSilenceTimeout; 533 | } 534 | set 535 | { 536 | if ((value < 1) || (value > 60)) throw new ArgumentOutOfRangeException(nameof(value)); 537 | autoSilenceTimeout = value; 538 | } 539 | } 540 | 541 | /// 542 | /// Gets a value that indicates if dictation is listening. 543 | /// 544 | public bool IsListening => isListening; 545 | #endregion // Public Properties 546 | } 547 | } 548 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisDictationManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3abd7ed5b00ba0042800ddd8d0014fd3 3 | timeCreated: 1518721249 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Text; 31 | using System.Threading.Tasks; 32 | 33 | namespace Microsoft.MR.LUIS 34 | { 35 | /// 36 | /// Provides extensions to the LUIS SDK for .Net. 37 | /// 38 | static public class LuisExtensions 39 | { 40 | /// 41 | /// Gets the first item in the list with the specified key or 42 | /// if the list or item is not found. 43 | /// 44 | /// 45 | /// The lookup list where the item may be found. 46 | /// 47 | /// 48 | /// The name of the list to search. 49 | /// 50 | /// 51 | /// The first item in the list, if found; otherwise . 52 | /// 53 | static public T FirstOrDefaultItem(this IDictionary> lookup, string name) 54 | { 55 | // Validate 56 | if (lookup == null) throw new ArgumentNullException(nameof(lookup)); 57 | if (string.IsNullOrEmpty(name)) throw new ArgumentException(nameof(name)); 58 | 59 | // Try and get the table 60 | if (!lookup.ContainsKey(name)) { return default(T); } 61 | 62 | // Get the table and return the first if found 63 | return lookup[name].FirstOrDefault(); 64 | } 65 | 66 | /// 67 | /// Gets the first resolved value for the entity or 68 | /// if there is no resolution. 69 | /// 70 | /// 71 | /// The entity to resolve. 72 | /// 73 | /// 74 | /// The first resolved value for the entity or 75 | /// if there is no resolution. 76 | /// 77 | static public string FirstOrDefaultResolution(this Entity entity) 78 | { 79 | // Validate 80 | if (entity == null) throw new ArgumentNullException(nameof(entity)); 81 | 82 | // Attempt to get resolution 83 | if (entity.Resolution.ContainsKey("values")) 84 | { 85 | var resolution = entity.Resolution["values"]; 86 | 87 | // HACK: Remove extra carriage returns and line feeds 88 | var resString = resolution.ToString().Replace("[\r\n \"", ""); 89 | resString = resString.Replace("\"\r\n]", ""); 90 | resString = resString.Replace("[\n \"", ""); 91 | resString = resString.Replace("\"\n]", ""); 92 | 93 | // Return cleaned resolution 94 | return resString; 95 | } 96 | else 97 | { 98 | // No resolution 99 | return null; 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9aa46e381ca5d0640ac2c097f0d56755 3 | timeCreated: 1518720536 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisMRResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Text; 31 | using System.Threading.Tasks; 32 | using UnityEngine; 33 | 34 | namespace Microsoft.MR.LUIS 35 | { 36 | /// 37 | /// Represents a result of a LUIS prediction including entities mapped to the scene. 38 | /// 39 | public class LuisMRResult 40 | { 41 | #region Member Variables 42 | private PredictionContext context = new PredictionContext(); 43 | private Dictionary> resolvedEntities = new Dictionary>(); 44 | #endregion // Member Variables 45 | 46 | #region Public Methods 47 | /// 48 | /// Gets all entities that have been resolved to scene objects. 49 | /// 50 | /// 51 | /// A list of all resolved entities. 52 | /// 53 | public List GetAllResolvedEntities() 54 | { 55 | List list = new List(); 56 | foreach (var entityList in ResolvedEntities) 57 | { 58 | list.AddRange(entityList.Value); 59 | } 60 | return list; 61 | } 62 | 63 | /// 64 | /// Maps the specified entity to the specified game object. 65 | /// 66 | /// 67 | /// The set of context entity data to map. 68 | /// 69 | 70 | public void Map(EntityMap map) 71 | { 72 | // First, make sure the entity table is created 73 | List entityMapList; 74 | if (!resolvedEntities.TryGetValue(map.Entity.Name, out entityMapList)) 75 | { 76 | resolvedEntities[map.Entity.Name] = new List() { map }; 77 | } 78 | else 79 | { 80 | entityMapList.Add(map); 81 | } 82 | } 83 | 84 | /// 85 | /// Maps the specified entity to the specified game object. 86 | /// 87 | /// 88 | /// The LUIS to map. 89 | /// 90 | /// 91 | /// The Unity that the entity maps to. 92 | /// 93 | /// 94 | /// The resolver that resolved the entity. 95 | /// 96 | public void Map(Entity entity, GameObject gameObject, IEntityResolver resolver) 97 | { 98 | // Validate 99 | if (entity == null) throw new ArgumentNullException(nameof(entity)); 100 | if (gameObject == null) throw new ArgumentNullException(nameof(gameObject)); 101 | 102 | // Create the map entry 103 | EntityMap map = new EntityMap { Entity = entity, GameObject = gameObject, Resolver = resolver }; 104 | 105 | // Map 106 | Map(map); 107 | } 108 | #endregion // Public Methods 109 | 110 | #region Public Properties 111 | /// 112 | /// Gets or sets the that supplies additional context for the prediction. 113 | /// 114 | public PredictionContext Context 115 | { 116 | get 117 | { 118 | return context; 119 | } 120 | set 121 | { 122 | if (value == null) throw new ArgumentNullException(nameof(value)); 123 | this.context = value; 124 | } 125 | } 126 | 127 | /// 128 | /// Gets or sets a value that indicates if the result was handled by an intent handler. 129 | /// 130 | public bool Handled { get; set; } 131 | 132 | /// 133 | /// Gets or sets the that was returned from the LUIS prediction. 134 | /// 135 | /// 136 | /// The returned by the LUIS prediction. 137 | /// 138 | public LuisResult PredictionResult { get; set; } 139 | 140 | ///// 141 | ///// Collection of objects parsed accessed though a dictionary for easy access. 142 | ///// 143 | //public DDictionary> CompositeEntities { get; set; } 144 | 145 | /// 146 | /// Gets the collection of mappings between LUIS objects and their corresponding scene 147 | /// . Each mapping table is keyed by the entity type. 148 | /// 149 | public Dictionary> ResolvedEntities => resolvedEntities; 150 | #endregion // Public Properties 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisMRResult.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92a113b770de43d498af4ee3a119a3f6 3 | timeCreated: 1518483796 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using System; 28 | using System.Collections; 29 | using System.Collections.Generic; 30 | using System.Net; 31 | using System.Net.Security; 32 | using System.Threading.Tasks; 33 | using UnityEngine; 34 | using System.Linq; 35 | using Microsoft.Unity; 36 | 37 | #if !UNITY_WSA || UNITY_EDITOR 38 | using System.Security.Cryptography.X509Certificates; 39 | #endif 40 | 41 | namespace Microsoft.MR.LUIS 42 | { 43 | /// 44 | /// Manages configuration and connection to the LUIS service. 45 | /// 46 | public class LuisManager : MonoBehaviour 47 | { 48 | #region Member Variables 49 | private LuisClient client; 50 | private List contextProviders = new List(); 51 | private List entityResolvers = new List(); 52 | private List intentHandlers = new List(); 53 | #endregion // Member Variables 54 | 55 | #region Unity Inspector Variables 56 | [Tooltip("The application ID of the LUIS application.")] 57 | [SecretValue("LUIS_AppId_Shapes")] 58 | public string AppId; 59 | 60 | [Tooltip("The application subscription key of the LUIS application.")] 61 | [SecretValue("LUIS_AppKey_Shapes")] 62 | public string AppKey; 63 | 64 | [Tooltip("String that represents the domain of the LUIS endpoint.")] 65 | [SecretValue("LUIS_Region_Shapes")] 66 | public string Region = ""; 67 | 68 | [Tooltip("The minimum confidence level for an intent to be handled.")] 69 | [Range(0,1)] 70 | public double MinimumIntentScore = 0.5; 71 | 72 | [Tooltip("Whether to return all intents and not just the top scoring intent.")] 73 | public bool Verbose = true; 74 | #endregion // Unity Inspector Variables 75 | 76 | #region Internal Methods 77 | /// 78 | /// Makes sure that the client has been created. 79 | /// 80 | private void EnsureClient() 81 | { 82 | if (client == null) 83 | { 84 | if (!this.enabled) { throw new InvalidOperationException($"Attempting to connect to LUIS but {nameof(LuisManager)} is not enabled."); } 85 | client = new LuisClient(AppId, AppKey, Verbose, Region); 86 | } 87 | } 88 | #endregion // Internal Methods 89 | 90 | #region Unity Overrides 91 | protected virtual void Awake() 92 | { 93 | #if !UNITY_WSA || UNITY_EDITOR 94 | //This works, and one of these two options are required as Unity's TLS (SSL) support doesn't currently work like .NET 95 | //ServicePointManager.CertificatePolicy = new CustomCertificatePolicy(); 96 | 97 | //This 'workaround' seems to work for the .NET Storage SDK, but not event hubs. 98 | //If you need all of it (ex Storage, event hubs,and app insights) then consider using the above. 99 | //If you don't want to check an SSL certificate coming back, simply use the return true delegate below. 100 | //Also it may help to use non-ssl URIs if you have the ability to, until Unity fixes the issue (which may be fixed by the time you read this) 101 | ServicePointManager.ServerCertificateValidationCallback = CheckValidCertificateCallback; //delegate { return true; }; 102 | #endif 103 | 104 | // Attempt to load secrets 105 | SecretHelper.LoadSecrets(this); 106 | 107 | // Make sure we have enough to continue 108 | if (string.IsNullOrEmpty(AppId)) 109 | { 110 | Debug.LogErrorFormat($"'{nameof(AppId)}' is required but is not set. {nameof(LuisManager)} has been disabled."); 111 | this.enabled = false; 112 | } 113 | 114 | if (string.IsNullOrEmpty(AppKey)) 115 | { 116 | Debug.LogErrorFormat($"'{nameof(AppKey)}' is required but is not set. {nameof(LuisManager)} has been disabled."); 117 | this.enabled = false; 118 | } 119 | 120 | if (string.IsNullOrEmpty(Region)) 121 | { 122 | Debug.LogErrorFormat($"'{nameof(Region)}' is required but is not set. {nameof(LuisManager)} has been disabled."); 123 | this.enabled = false; 124 | } 125 | 126 | // Add default strategies (can be overridden) 127 | AddDefaultStrategies(); 128 | } 129 | #endregion // Unity Overrides 130 | 131 | #region Overridables / Event Triggers 132 | /// 133 | /// Adds default context providers, entity resolvers and intent handlers. 134 | /// 135 | protected virtual void AddDefaultStrategies() 136 | { 137 | // Default Resolvers 138 | EntityResolvers.Add(new EntityMetadataResolver()); 139 | 140 | // Default Handlers 141 | IntentHandlers.Add(new ResolvedIntentForwarder()); 142 | } 143 | 144 | #if !UNITY_WSA || UNITY_EDITOR 145 | protected virtual bool CheckValidCertificateCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 146 | { 147 | bool valid = true; 148 | 149 | //// If there are errors in the certificate chain, look at each error to determine the cause. 150 | //if (sslPolicyErrors != SslPolicyErrors.None) 151 | //{ 152 | // for (int i = 0; i < chain.ChainStatus.Length; i++) 153 | // { 154 | // if (chain.ChainStatus[i].Status != X509ChainStatusFlags.RevocationStatusUnknown) 155 | // { 156 | // chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain; 157 | // chain.ChainPolicy.RevocationMode = X509RevocationMode.Online; 158 | // chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0); 159 | // chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags; 160 | // bool chainIsValid = chain.Build((X509Certificate2)certificate); 161 | // if (!chainIsValid) 162 | // { 163 | // valid = false; 164 | // } 165 | // } 166 | // } 167 | //} 168 | return valid; 169 | } 170 | #endif 171 | 172 | /// 173 | /// Capture the current context for a prediction. 174 | /// 175 | /// 176 | /// The where context is stored. 177 | /// 178 | /// 179 | /// This is stage 1 in processing a LUIS utterance. 180 | /// The default implementation enumerates through all objects in 181 | /// and asks them to provide context. 182 | /// 183 | protected virtual void CaptureContext(PredictionContext context) 184 | { 185 | foreach (IContextProvider provider in contextProviders) 186 | { 187 | provider.CaptureContext(context); 188 | } 189 | } 190 | 191 | /// 192 | /// Handles the final result for a LUIS prediction. 193 | /// 194 | /// 195 | /// The that contains information about the prediction. 196 | /// 197 | /// 198 | /// This is stage 4 in processing a LUIS utterance. The default implementation looks for 199 | /// a global handler for the specified intent and executes it. If a global handler is not 200 | /// found and there is only one mapped entity, the entity will be checked to see if it 201 | /// can handle the intent. 202 | /// 203 | protected virtual void HandleIntent(LuisMRResult result) 204 | { 205 | // Which intent? 206 | Intent intent = result.PredictionResult.TopScoringIntent; 207 | 208 | // Handle the intent 209 | foreach (IIntentHandler handler in intentHandlers) 210 | { 211 | if (handler.CanHandle(intent.Name)) 212 | { 213 | handler.Handle(intent, result); 214 | } 215 | } 216 | } 217 | 218 | /// 219 | /// Attempts to resolve scene entities from LUIS entities. 220 | /// 221 | /// 222 | /// The that provides context and storage for the resolution. 223 | /// 224 | /// 225 | /// This is stage 3 in processing a LUIS utterance. 226 | /// The default implementation enumerates through all objects in the 227 | /// and asks them to resolve entities. 228 | /// 229 | protected virtual void ResolveEntities(LuisMRResult result) 230 | { 231 | foreach (IEntityResolver resolver in entityResolvers) 232 | { 233 | resolver.Resolve(result); 234 | } 235 | } 236 | #endregion // Overridables / Event Triggers 237 | 238 | #region Public Methods 239 | /// 240 | /// Attempts a LUIS prediction on the specified context and if confidence is high enough, the intent is executed. 241 | /// 242 | /// 243 | /// Context that is used for the prediction. Additional context may still be collected by 244 | /// the . 245 | /// 246 | /// 247 | /// A that yields the result of the operation as a . 248 | /// 249 | /// 250 | /// At a minimum, must be included within the context. 251 | /// 252 | public virtual async Task PredictAndHandleAsync(PredictionContext context) 253 | { 254 | // Validate 255 | if (context == null) throw new ArgumentNullException(nameof(context)); 256 | if (string.IsNullOrEmpty(context.PredictionText)) throw new InvalidOperationException("At a minimum, PredictionText must be included within the context."); 257 | 258 | // Make sure we have a client 259 | EnsureClient(); 260 | 261 | // Create our result object 262 | LuisMRResult mrResult = new LuisMRResult() { Context = context }; 263 | 264 | // Stage 1: Capture context 265 | CaptureContext(context); 266 | 267 | // Stage 2: Predict using the LUIS client 268 | mrResult.PredictionResult = await client.Predict(context.PredictionText); 269 | 270 | // Only do the next two stages if we have the minimum required confidence 271 | if (mrResult.PredictionResult.TopScoringIntent.Score >= MinimumIntentScore) 272 | { 273 | // Stage 3: Resolve Entities 274 | ResolveEntities(mrResult); 275 | 276 | // Stage 4: Handle Intents 277 | HandleIntent(mrResult); 278 | } 279 | 280 | // Done 281 | return mrResult; 282 | } 283 | /// 284 | /// Attempts a LUIS prediction on the specified text and if confidence is high enough, the intent is executed. 285 | /// 286 | /// 287 | /// The text used for the prediction. 288 | /// 289 | /// 290 | /// A that yields the result of the operation as a . 291 | /// 292 | public virtual Task PredictAndHandleAsync(string text) 293 | { 294 | // Validate 295 | if (string.IsNullOrEmpty(text)) throw new ArgumentException(nameof(text)); 296 | 297 | // Create a context and store the text 298 | PredictionContext context = new PredictionContext() { PredictionText = text }; 299 | 300 | // Pass to context override 301 | return PredictAndHandleAsync(context); 302 | } 303 | #endregion // Public Methods 304 | 305 | #region Public Properties 306 | /// 307 | /// Gets the instance created by this manager. 308 | /// 309 | public LuisClient Client 310 | { 311 | get 312 | { 313 | this.EnsureClient(); 314 | return client; 315 | } 316 | } 317 | 318 | /// 319 | /// Gets or sets the list of classes that can provide context for a LUIS prediction. 320 | /// 321 | public List ContextProviders 322 | { 323 | get 324 | { 325 | return contextProviders; 326 | } 327 | set 328 | { 329 | if (value == null) throw new ArgumentNullException(nameof(value)); 330 | this.contextProviders = value; 331 | } 332 | } 333 | 334 | /// 335 | /// Gets or sets the list of classes that can resolve LUIS Entity to GameObject relationships. 336 | /// 337 | public List EntityResolvers 338 | { 339 | get 340 | { 341 | return entityResolvers; 342 | } 343 | set 344 | { 345 | if (value == null) throw new ArgumentNullException(nameof(value)); 346 | this.entityResolvers = value; 347 | } 348 | } 349 | 350 | /// 351 | /// Gets or sets the list of handlers for LUIS intents. 352 | /// 353 | public List IntentHandlers 354 | { 355 | get 356 | { 357 | return intentHandlers; 358 | } 359 | set 360 | { 361 | if (value == null) throw new ArgumentNullException(nameof(value)); 362 | this.intentHandlers = value; 363 | } 364 | } 365 | #endregion // Public Properties 366 | } 367 | } -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d268b595133a624f8d05847a7d3ef36 3 | timeCreated: 1518189330 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisTester.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using Microsoft.MR.LUIS; 28 | using Microsoft.Unity; 29 | using System.Collections; 30 | using System.Collections.Generic; 31 | using UnityEngine; 32 | using UnityEngine.UI; 33 | 34 | /// 35 | /// Provides a quick way to test LUIS in a Unity scene. 36 | /// 37 | public class LuisTester : MonoBehaviour 38 | { 39 | #region Unity Inspector Variables 40 | [Tooltip("Enable debug handlers to increase debug information.")] 41 | public bool EnableDebugging = true; 42 | 43 | [Tooltip("The LuisManager that the tester will interface with.")] 44 | public LuisManager LuisManager; 45 | 46 | [Tooltip("Predict the Test Utterance automatically on start.")] 47 | public bool PredictOnStart = true; 48 | 49 | [Tooltip("Optional UI Button in the scene that can initiate the prediction.")] 50 | public Button SceneTestButton; 51 | 52 | [Tooltip("Optional UI Input field in the scene that supplies the test utterance.")] 53 | public InputField SceneUtteranceInput; 54 | 55 | [Tooltip("The utterance to test")] 56 | public string TestUtterance = ""; 57 | #endregion // Unity Inspector Variables 58 | 59 | #region Unity Overrides 60 | void Start() 61 | { 62 | // If no manager specified, see if one is on the same GameObject 63 | if (LuisManager == null) 64 | { 65 | LuisManager = GetComponent(); 66 | } 67 | 68 | // Validate components 69 | if (LuisManager == null) 70 | { 71 | Debug.LogErrorFormat("The {0} inspector field is not set and is required. {1} did not load.", nameof(LuisManager), this.GetType().Name); 72 | enabled = false; 73 | return; 74 | } 75 | 76 | // If there is a test button in the scene, wire up the click handler. 77 | if (SceneTestButton != null) 78 | { 79 | SceneTestButton.onClick.AddListener(() => 80 | { 81 | TryPredict(); 82 | }); 83 | } 84 | 85 | // If there is a test text field, setup the default 86 | if ((SceneUtteranceInput != null) && (string.IsNullOrEmpty(SceneUtteranceInput.text))) 87 | { 88 | SceneUtteranceInput.text = TestUtterance; 89 | } 90 | 91 | // Enable debugging? 92 | if (EnableDebugging) 93 | { 94 | LuisManager.IntentHandlers.Add(new DebugIntentHandler()); 95 | } 96 | 97 | // Predict on start? 98 | if ((PredictOnStart) && (!string.IsNullOrEmpty(TestUtterance))) 99 | { 100 | TryPredict(); 101 | } 102 | } 103 | #endregion // Unity Overrides 104 | 105 | #region Public Methods 106 | /// 107 | /// Attempts to try a prediction of the . 108 | /// 109 | public async void TryPredict() 110 | { 111 | // Make sure we're enabled 112 | if (!enabled) 113 | { 114 | Debug.LogError($"{nameof(LuisTester)} is not enabled. Can't predict."); 115 | return; 116 | } 117 | 118 | // Make sure we have a Luis Manager assigned 119 | if (LuisManager == null) 120 | { 121 | Debug.LogError($"{nameof(LuisManager)} is not set to a valid instance."); 122 | return; 123 | } 124 | 125 | // If there is a scene text control and its contents aren't empty use that 126 | if ((SceneUtteranceInput != null) && (!string.IsNullOrEmpty(SceneUtteranceInput.text))) 127 | { 128 | TestUtterance = SceneUtteranceInput.text; 129 | } 130 | 131 | // Make sure we have something to predict 132 | if (string.IsNullOrEmpty(TestUtterance)) 133 | { 134 | Debug.LogError($"{nameof(TestUtterance)} is empty. Nothing to predict."); 135 | return; 136 | } 137 | 138 | // Predict! 139 | await LuisManager.PredictAndHandleAsync(TestUtterance); 140 | } 141 | #endregion // Public Methods 142 | } 143 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/LuisTester.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49d7cd01fd87922428af51ee39a56761 3 | timeCreated: 1518568479 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d02aacc3cab885b4485f41a16041d4b1 3 | folderAsset: yes 4 | timeCreated: 1524157155 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/EntityMap.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Text; 31 | using System.Threading.Tasks; 32 | using UnityEngine; 33 | 34 | namespace Microsoft.MR.LUIS 35 | { 36 | /// 37 | /// Represents a map between an recognized by LUIS and a in the scene. 38 | /// 39 | public class EntityMap 40 | { 41 | /// 42 | /// Gets or sets the recognized by LUIS. 43 | /// 44 | public Entity Entity { get; set; } 45 | 46 | /// 47 | /// Gets or sets the that represents the LUIS Entity. 48 | /// 49 | public GameObject GameObject { get; set; } 50 | 51 | /// 52 | /// Gets or sets the resolver that resolved the entity. 53 | /// 54 | public IEntityResolver Resolver { get; set; } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/EntityMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b352c2a399b5674285b54cd38873532 3 | timeCreated: 1518539056 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/EntityMetadata.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using UnityEngine; 27 | 28 | namespace Microsoft.MR.LUIS 29 | { 30 | /// 31 | /// Provides data about a so that 32 | /// can map a Luis in a result to the object. 33 | /// 34 | public class EntityMetadata : MonoBehaviour 35 | { 36 | [Tooltip("The Name of the Luis Entity that will be mapped to this object.")] 37 | public string EntityName; 38 | 39 | [Tooltip("The Type of the Luis Entity that will be mapped to this object.")] 40 | public string EntityType; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/EntityMetadata.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 191a39b4e52ca2042b4d6913e578660c 3 | timeCreated: 1518674451 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/EntityMetadataResolver.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using Microsoft.Cognitive.LUIS; 27 | using Microsoft.MR.LUIS; 28 | using System; 29 | using System.Collections.Generic; 30 | using System.Linq; 31 | using System.Text; 32 | using System.Threading.Tasks; 33 | using UnityEngine; 34 | 35 | namespace Microsoft.MR.LUIS 36 | { 37 | /// 38 | /// Resolves entities in our prediction with entities in the scene. This resolver finds scene GameObjects by name or type. 39 | /// The name and type of a GameObject in the scene is defined with the behavior. 40 | /// 41 | public class EntityMetadataResolver : IEntityResolver 42 | { 43 | #region Member Variables 44 | private bool debugMessages = true; 45 | private string[] entityNames = new string[] 46 | { 47 | "MR.InstanceName", 48 | "MR.InstanceType" 49 | }; 50 | #endregion // Member Variables 51 | 52 | #region Public Methods 53 | /// 54 | /// Find all the scene GameObjects that have names matching the Entity value 55 | /// 56 | /// 57 | public void Resolve(LuisMRResult result) 58 | { 59 | // Collect any entities that match the entity names we're looking for 60 | List predictionEntities = result.PredictionResult.Entities.Where(x => entityNames.Contains(x.Key)).SelectMany(y => y.Value).ToList(); 61 | 62 | // If there are no entities in the prediction that we're looking for, nothing to do 63 | if (predictionEntities.Count < 1) 64 | { 65 | if (debugMessages) 66 | { 67 | Debug.Log("No entities in the prediction match the names configured for the resolver."); 68 | } 69 | return; 70 | } 71 | 72 | // Join the list of scene objects with prediction entities to get matches in the scene 73 | IEnumerable meq = 74 | from entity in predictionEntities 75 | let entityName = entity.Value.ToLower() 76 | from sceneEntity in GameObject.FindObjectsOfType() 77 | where entityName.Equals(sceneEntity.EntityName.ToLower()) || entityName.Equals(sceneEntity.EntityType.ToLower()) 78 | select new EntityMap() 79 | { 80 | Entity = entity, 81 | GameObject = sceneEntity.gameObject, 82 | Resolver = this 83 | }; 84 | List matchedEntities = meq.ToList(); 85 | 86 | //Add all our found entities to the result's entity map, which maps LUIS entities with scene entities. 87 | foreach (EntityMap entityMap in matchedEntities) 88 | { 89 | // Create map entry 90 | result.Map(entityMap); 91 | 92 | // Remove the entity from the prediction list to mark it as "mapped" 93 | predictionEntities.Remove(entityMap.Entity); 94 | } 95 | 96 | // If any entity is still in the prediction list, it was not matched. Log a warning. 97 | if (debugMessages) 98 | { 99 | foreach (var entity in predictionEntities) 100 | { 101 | Debug.LogWarning($"Warning: {entity.Name} \"{entity.Value}\" could not be mapped to the scene."); 102 | } 103 | } 104 | } 105 | #endregion // Public Methods 106 | 107 | #region Public Properties 108 | /// 109 | /// Gets or sets a value that indicates if debug messages will be printed during resolution. 110 | /// 111 | /// 112 | /// true if debug messages will be printed during resolution; otherwise false. 113 | /// 114 | public bool DebugMessages 115 | { 116 | get 117 | { 118 | return debugMessages; 119 | } 120 | set 121 | { 122 | debugMessages = value; 123 | } 124 | } 125 | 126 | /// 127 | /// Gets or sets the list of entity names that will be resolved from the result. 128 | /// 129 | public string[] EntityNames 130 | { 131 | get 132 | { 133 | return entityNames; 134 | } 135 | set 136 | { 137 | // Changing? 138 | if (entityNames != value) 139 | { 140 | // Validate 141 | if (value.Length < 1) { throw new ArgumentException("Must have at least one valid entity name."); } 142 | if (value.Any((s) => string.IsNullOrEmpty(s))) { throw new ArgumentException("Entity names cannot be null or empty."); } 143 | 144 | // Store 145 | entityNames = value; 146 | } 147 | } 148 | } 149 | #endregion // Public Properties 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/EntityMetadataResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2db6c0340c9eb741aec1ca4fb248e57 3 | timeCreated: 1518676170 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/IEntityResolver.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Threading.Tasks; 31 | 32 | namespace Microsoft.MR.LUIS 33 | { 34 | /// 35 | /// The interface for a class that can resolve a LUIS Entity into an application entity. 36 | /// 37 | public interface IEntityResolver 38 | { 39 | /// 40 | /// Attempts to resolve entities in a to scene entities in a . 41 | /// 42 | /// 43 | /// The where entities will be resolved. 44 | /// 45 | /// 46 | /// An Entity resolver may use all of the information available in the to resolve LUIS 47 | /// entities to scene entities. For example, the LUIS Entity "that" might be resolved using the 48 | /// GazedObject stored in the 49 | /// Context. 50 | /// 51 | void Resolve(LuisMRResult result); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Resolve/IEntityResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3696159e1b11b8d42a1ac42fa97e1b71 3 | timeCreated: 1518483796 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Route.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 081e1d33da47fc846992b500054cc340 3 | folderAsset: yes 4 | timeCreated: 1524157207 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Route/ResolvedIntentForwarder.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // MIT License: 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | // 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Threading.Tasks; 31 | using Microsoft.Cognitive.LUIS; 32 | using UnityEngine.EventSystems; 33 | 34 | namespace Microsoft.MR.LUIS 35 | { 36 | /// 37 | /// An that routes supported intents to resolved scene entities. 38 | /// 39 | public class ResolvedIntentForwarder : IIntentHandler 40 | { 41 | #region Member Variables 42 | private List excludedIntents = new List(); 43 | private List includedIntents = new List(); 44 | private IntentEventData intentEventData; 45 | #endregion // Member Variables 46 | 47 | /// 48 | /// 49 | /// 50 | public bool CanHandle(string intentName) 51 | { 52 | // Is it explicitly excluded? 53 | if (excludedIntents.Contains(intentName)) 54 | { 55 | return false; 56 | } 57 | 58 | // Is it either wildcard or explicitly included? 59 | if ((includedIntents.Count == 0) || (includedIntents.Contains(intentName))) 60 | { 61 | return true; 62 | } 63 | 64 | // Not supported 65 | return false; 66 | } 67 | 68 | /// 69 | /// 70 | /// 71 | public void Handle(Intent intent, LuisMRResult result) 72 | { 73 | // Validate 74 | if (intent == null) throw new ArgumentNullException(nameof(intent)); 75 | if (result == null) throw new ArgumentNullException(nameof(result)); 76 | 77 | // Make sure event data has been created 78 | if (intentEventData == null) 79 | { 80 | intentEventData = new IntentEventData(EventSystem.current); 81 | } 82 | 83 | // Update event data to current values 84 | intentEventData.Initialize(intent, result); 85 | 86 | // Get all resolved entities 87 | List resolvedEntities = result.GetAllResolvedEntities(); 88 | 89 | // Forward to all resolved entities 90 | foreach (EntityMap map in resolvedEntities) 91 | { 92 | // Execute on the game object 93 | if (SendToChildren) 94 | { 95 | ExecuteEvents.ExecuteHierarchy(map.GameObject, intentEventData, OnIntentHandler); 96 | } 97 | else 98 | { 99 | ExecuteEvents.Execute(map.GameObject, intentEventData, OnIntentHandler); 100 | } 101 | } 102 | } 103 | 104 | private static readonly ExecuteEvents.EventFunction OnIntentHandler = 105 | delegate (IIntentHandler handler, BaseEventData eventData) 106 | { 107 | var casted = ExecuteEvents.ValidateEventData(eventData); 108 | if (handler.CanHandle(casted.Intent.Name)) 109 | { 110 | handler.Handle(casted.Intent, casted.Result); 111 | casted.Use(); 112 | } 113 | }; 114 | 115 | /// 116 | /// Gets the list of explicitly excluded intents. 117 | /// 118 | public List ExcludedIntents => excludedIntents; 119 | 120 | /// 121 | /// Gets the list of explicitly included intents. 122 | /// 123 | /// 124 | /// If no intents are explicitly included, all intents will be forwarded. 125 | /// 126 | public List IncludedIntents => includedIntents; 127 | 128 | /// 129 | /// Gets or set a value that indicates if events should be sent to child game objects. 130 | /// 131 | /// 132 | /// true if if events should be sent to child game objects; otherwise false. The default is false. 133 | /// 134 | public bool SendToChildren { get; set; } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /Assets/MixedRealityAzure/LUIS/Scripts/Route/ResolvedIntentForwarder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c55cc0510917d84eafd29672cfac76c 3 | timeCreated: 1518656487 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05bb7a8daca51ab4c9b095cd44db2d1b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/LUIS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6cb65aa2f2bb8d9469bb83921cfd7c15 3 | folderAsset: yes 4 | timeCreated: 1512434868 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Plugins/LUIS/net45+win8+wpa81.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b5c154a760f57845955a7f18cb6a8ca 3 | folderAsset: yes 4 | timeCreated: 1512434857 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Plugins/LUIS/net45+win8+wpa81/Microsoft.Cognitive.LUIS.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ActiveNick/Unity-SpeechWithLUIS/b9ac4f200aba1b84b13375dbb52b95d6e366bbe1/Assets/Plugins/LUIS/net45+win8+wpa81/Microsoft.Cognitive.LUIS.dll -------------------------------------------------------------------------------- /Assets/Plugins/LUIS/net45+win8+wpa81/Microsoft.Cognitive.LUIS.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4dfd08f22d634d44baf03a9ee550b4e 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 0 17 | Exclude Editor: 0 18 | Exclude Linux: 0 19 | Exclude Linux64: 0 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXIntel: 1 22 | Exclude OSXIntel64: 1 23 | Exclude OSXUniversal: 0 24 | Exclude WebGL: 1 25 | Exclude Win: 0 26 | Exclude Win64: 0 27 | Exclude WindowsStoreApps: 0 28 | - first: 29 | Android: Android 30 | second: 31 | enabled: 1 32 | settings: 33 | CPU: ARMv7 34 | - first: 35 | Any: 36 | second: 37 | enabled: 0 38 | settings: {} 39 | - first: 40 | Editor: Editor 41 | second: 42 | enabled: 1 43 | settings: 44 | CPU: AnyCPU 45 | DefaultValueInitialized: true 46 | OS: AnyOS 47 | - first: 48 | Facebook: Win 49 | second: 50 | enabled: 0 51 | settings: 52 | CPU: AnyCPU 53 | - first: 54 | Facebook: Win64 55 | second: 56 | enabled: 0 57 | settings: 58 | CPU: AnyCPU 59 | - first: 60 | Standalone: Linux 61 | second: 62 | enabled: 1 63 | settings: 64 | CPU: x86 65 | - first: 66 | Standalone: Linux64 67 | second: 68 | enabled: 1 69 | settings: 70 | CPU: x86_64 71 | - first: 72 | Standalone: LinuxUniversal 73 | second: 74 | enabled: 1 75 | settings: 76 | CPU: AnyCPU 77 | - first: 78 | Standalone: OSXIntel 79 | second: 80 | enabled: 0 81 | settings: 82 | CPU: AnyCPU 83 | - first: 84 | Standalone: OSXIntel64 85 | second: 86 | enabled: 0 87 | settings: 88 | CPU: AnyCPU 89 | - first: 90 | Standalone: OSXUniversal 91 | second: 92 | enabled: 1 93 | settings: 94 | CPU: None 95 | - first: 96 | Standalone: Win 97 | second: 98 | enabled: 1 99 | settings: 100 | CPU: AnyCPU 101 | - first: 102 | Standalone: Win64 103 | second: 104 | enabled: 1 105 | settings: 106 | CPU: AnyCPU 107 | - first: 108 | Windows Store Apps: WindowsStoreApps 109 | second: 110 | enabled: 1 111 | settings: 112 | CPU: AnyCPU 113 | DontProcess: false 114 | PlaceholderPath: 115 | SDK: AnySDK 116 | ScriptingBackend: AnyScriptingBackend 117 | userData: 118 | assetBundleName: 119 | assetBundleVariant: 120 | -------------------------------------------------------------------------------- /Assets/Plugins/Newtonsoft.Json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c853715c7c345dc4fa7861d5fedd2414 3 | folderAsset: yes 4 | timeCreated: 1512435190 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Plugins/Newtonsoft.Json/portable-net45+wp80+win8+wpa81.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9120e8cf3520066489d5bcd98b27a81f 3 | folderAsset: yes 4 | timeCreated: 1512435062 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Plugins/Newtonsoft.Json/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ActiveNick/Unity-SpeechWithLUIS/b9ac4f200aba1b84b13375dbb52b95d6e366bbe1/Assets/Plugins/Newtonsoft.Json/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Assets/Plugins/Newtonsoft.Json/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e40da874901933347b9f4e609abc6b1c 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 0 17 | Exclude Editor: 0 18 | Exclude Linux: 0 19 | Exclude Linux64: 0 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXIntel: 1 22 | Exclude OSXIntel64: 1 23 | Exclude OSXUniversal: 0 24 | Exclude WebGL: 1 25 | Exclude Win: 0 26 | Exclude Win64: 0 27 | Exclude WindowsStoreApps: 0 28 | - first: 29 | Android: Android 30 | second: 31 | enabled: 1 32 | settings: 33 | CPU: ARMv7 34 | - first: 35 | Any: 36 | second: 37 | enabled: 0 38 | settings: {} 39 | - first: 40 | Editor: Editor 41 | second: 42 | enabled: 1 43 | settings: 44 | CPU: AnyCPU 45 | DefaultValueInitialized: true 46 | OS: AnyOS 47 | - first: 48 | Facebook: Win 49 | second: 50 | enabled: 0 51 | settings: 52 | CPU: AnyCPU 53 | - first: 54 | Facebook: Win64 55 | second: 56 | enabled: 0 57 | settings: 58 | CPU: AnyCPU 59 | - first: 60 | Standalone: Linux 61 | second: 62 | enabled: 1 63 | settings: 64 | CPU: x86 65 | - first: 66 | Standalone: Linux64 67 | second: 68 | enabled: 1 69 | settings: 70 | CPU: x86_64 71 | - first: 72 | Standalone: LinuxUniversal 73 | second: 74 | enabled: 1 75 | settings: 76 | CPU: AnyCPU 77 | - first: 78 | Standalone: OSXIntel 79 | second: 80 | enabled: 0 81 | settings: 82 | CPU: AnyCPU 83 | - first: 84 | Standalone: OSXIntel64 85 | second: 86 | enabled: 0 87 | settings: 88 | CPU: AnyCPU 89 | - first: 90 | Standalone: OSXUniversal 91 | second: 92 | enabled: 1 93 | settings: 94 | CPU: None 95 | - first: 96 | Standalone: Win 97 | second: 98 | enabled: 1 99 | settings: 100 | CPU: AnyCPU 101 | - first: 102 | Standalone: Win64 103 | second: 104 | enabled: 1 105 | settings: 106 | CPU: AnyCPU 107 | - first: 108 | Windows Store Apps: WindowsStoreApps 109 | second: 110 | enabled: 1 111 | settings: 112 | CPU: AnyCPU 113 | DontProcess: false 114 | PlaceholderPath: 115 | SDK: AnySDK 116 | ScriptingBackend: AnyScriptingBackend 117 | userData: 118 | assetBundleName: 119 | assetBundleVariant: 120 | -------------------------------------------------------------------------------- /Assets/Speech.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36f6ce7e247acad4fb66474abe3a3732 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9cc1a5cd91f62c45bf8c625864a35a5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/CogSvcSocketAuthentication.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // Microsoft Cognitive Services (formerly Project Oxford): 6 | // https://www.microsoft.com/cognitive-services 7 | // 8 | // New Speech Service: 9 | // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech-Service/ 10 | // Old Bing Speech SDK: 11 | // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech/home 12 | // 13 | // Copyright (c) Microsoft Corporation 14 | // All rights reserved. 15 | // 16 | // MIT License: 17 | // Permission is hereby granted, free of charge, to any person obtaining 18 | // a copy of this software and associated documentation files (the 19 | // "Software"), to deal in the Software without restriction, including 20 | // without limitation the rights to use, copy, modify, merge, publish, 21 | // distribute, sublicense, and/or sell copies of the Software, and to 22 | // permit persons to whom the Software is furnished to do so, subject to 23 | // the following conditions: 24 | // 25 | // The above copyright notice and this permission notice shall be 26 | // included in all copies or substantial portions of the Software. 27 | // 28 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 29 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 32 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 33 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 34 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 | // 36 | 37 | using System; 38 | using System.Net.Http; 39 | using System.Threading; 40 | using System.Threading.Tasks; 41 | using UnityEngine; 42 | 43 | namespace SpeechRecognitionService 44 | { 45 | public class CogSvcSocketAuthentication 46 | { 47 | public static string AuthenticationUri; 48 | private string subscriptionKey; 49 | private string token; 50 | private Timer accessTokenRenewer; 51 | 52 | //Access token expires every 10 minutes. Renew it every 9 minutes. 53 | private const int RefreshTokenDuration = 9; 54 | 55 | // Set usebingspeechservice to true in the client constructor if you want to use the old Bing Speech SDK 56 | // instead of the new Speech Service (new API is the default). 57 | public async Task Authenticate(string subscriptionKey, string region, bool usebingspeechservice = false) 58 | { 59 | try 60 | { 61 | // Important: The Bing Speech service and the new Speech Service DO NOT use the same Uri 62 | if (!usebingspeechservice) 63 | { 64 | AuthenticationUri = $"https://{region}.api.cognitive.microsoft.com/sts/v1.0"; 65 | } 66 | else 67 | { 68 | // The region is ignored for the old Bing Speech service 69 | AuthenticationUri = "https://api.cognitive.microsoft.com/sts/v1.0"; 70 | } 71 | 72 | this.subscriptionKey = subscriptionKey; 73 | this.token = await FetchToken(AuthenticationUri, subscriptionKey); 74 | 75 | // Renew the token based on a fixed interval using a Timer 76 | accessTokenRenewer = new Timer(new TimerCallback(OnTokenExpiredCallback), 77 | this, 78 | TimeSpan.FromMinutes(RefreshTokenDuration), 79 | TimeSpan.FromMilliseconds(-1)); 80 | return this.token; 81 | } 82 | catch (Exception ex) 83 | { 84 | Debug.Log($"An exception occurred during authentication:{Environment.NewLine}{ex.Message}"); 85 | return null; 86 | } 87 | } 88 | 89 | public string GetAccessToken() 90 | { 91 | return this.token; 92 | } 93 | 94 | private async void RenewAccessToken() 95 | { 96 | this.token = await FetchToken(AuthenticationUri, this.subscriptionKey); 97 | Debug.Log($"Renewed authentication token: {this.token}"); 98 | } 99 | 100 | private void OnTokenExpiredCallback(object stateInfo) 101 | { 102 | try 103 | { 104 | RenewAccessToken(); 105 | } 106 | catch (Exception ex) 107 | { 108 | Debug.Log($"Failed renewing access token. Details: {ex.Message}"); 109 | } 110 | finally 111 | { 112 | try 113 | { 114 | accessTokenRenewer.Change(TimeSpan.FromMinutes(RefreshTokenDuration), TimeSpan.FromMilliseconds(-1)); 115 | } 116 | catch (Exception ex) 117 | { 118 | Debug.Log($"Failed to reschedule the timer to renew access token. Details: {ex.Message}"); 119 | } 120 | } 121 | } 122 | 123 | private async Task FetchToken(string fetchUri, string subscriptionKey) 124 | { 125 | using (var client = new HttpClient()) 126 | { 127 | client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey); 128 | UriBuilder uriBuilder = new UriBuilder(fetchUri); 129 | uriBuilder.Path += "/issueToken"; 130 | 131 | // Using ConfigureAwait(false) to configures the awaiter used to await this Task to prevent 132 | // the attempt to marshal the continuation back to the original context captured. 133 | var result = await client.PostAsync(uriBuilder.Uri.AbsoluteUri, null).ConfigureAwait(false); 134 | Debug.Log("Token Uri: " + uriBuilder.Uri.AbsoluteUri); 135 | return await result.Content.ReadAsStringAsync(); 136 | } 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/CogSvcSocketAuthentication.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a210f41e72001b439d27093f2027568 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/RecognitionContent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // Microsoft Cognitive Services (formerly Project Oxford): 6 | // https://www.microsoft.com/cognitive-services 7 | // 8 | // New Speech Service: 9 | // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech-Service/ 10 | // Old Bing Speech SDK: 11 | // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech/home 12 | // 13 | // Copyright (c) Microsoft Corporation 14 | // All rights reserved. 15 | // 16 | // MIT License: 17 | // Permission is hereby granted, free of charge, to any person obtaining 18 | // a copy of this software and associated documentation files (the 19 | // "Software"), to deal in the Software without restriction, including 20 | // without limitation the rights to use, copy, modify, merge, publish, 21 | // distribute, sublicense, and/or sell copies of the Software, and to 22 | // permit persons to whom the Software is furnished to do so, subject to 23 | // the following conditions: 24 | // 25 | // The above copyright notice and this permission notice shall be 26 | // included in all copies or substantial portions of the Software. 27 | // 28 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 29 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 32 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 33 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 34 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 | // 36 | 37 | namespace SpeechRecognitionService 38 | { 39 | public class RecognitionContent 40 | { 41 | public Context context { get; set; } 42 | public string RecognitionStatus { get; set; } 43 | /// 44 | /// The Text field is used when a recognition HYPOTHESIS is produced. 45 | /// 46 | public string Text { get; set; } 47 | /// 48 | /// The Displaytext field is used when the final recognized PHRASE is produced. 49 | /// 50 | public string DisplayText { get; set; } 51 | public int Offset { get; set; } 52 | public int Duration { get; set; } 53 | } 54 | 55 | public class Context 56 | { 57 | public string serviceTag { get; set; } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/RecognitionContent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7793e6627d071834e962754fd854647d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/SpeechManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1da1775e686b0c439fcd33ed7ce1400 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/SpeechRecognitionService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ed11d4717b3fff48a90c3fe02551a16 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/SpeechServiceResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. 4 | // 5 | // Microsoft Cognitive Services (formerly Project Oxford): 6 | // https://www.microsoft.com/cognitive-services 7 | // 8 | // New Speech Service: 9 | // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech-Service/ 10 | // Old Bing Speech SDK: 11 | // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech/home 12 | // 13 | // Copyright (c) Microsoft Corporation 14 | // All rights reserved. 15 | // 16 | // MIT License: 17 | // Permission is hereby granted, free of charge, to any person obtaining 18 | // a copy of this software and associated documentation files (the 19 | // "Software"), to deal in the Software without restriction, including 20 | // without limitation the rights to use, copy, modify, merge, publish, 21 | // distribute, sublicense, and/or sell copies of the Software, and to 22 | // permit persons to whom the Software is furnished to do so, subject to 23 | // the following conditions: 24 | // 25 | // The above copyright notice and this permission notice shall be 26 | // included in all copies or substantial portions of the Software. 27 | // 28 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, 29 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 32 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 33 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 34 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 | // 36 | 37 | namespace SpeechRecognitionService 38 | { 39 | public class SpeechServiceResult 40 | { 41 | public enum SpeechMessagePaths { None, TurnStart, SpeechStartDetected, SpeechHypothesis, SpeechEndDetected, SpeechPhrase, TurnEnd }; 42 | 43 | public string RequestId { get; set; } 44 | public string ContentType { get; set; } 45 | public string CharSet { get; set; } 46 | public SpeechMessagePaths Path { get; set; } 47 | public RecognitionContent Result { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/SpeechServiceResult.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3326aa9329672e4fa6dbeda8dc367c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Speech/Scripts/UnityDispatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | #if WINDOWS_UWP 6 | /// 7 | /// A helper class for dispatching actions to run on various Unity threads. 8 | /// 9 | static public class UnityDispatcher 10 | { 11 | /// 12 | /// Schedules the specified action to be run on Unity's main thread. 13 | /// 14 | /// 15 | /// The action to run. 16 | /// 17 | static public void InvokeOnAppThread(Action action) 18 | { 19 | if (UnityEngine.WSA.Application.RunningOnAppThread()) 20 | { 21 | // Already on app thread, just run inline 22 | action(); 23 | } 24 | else 25 | { 26 | // Schedule 27 | UnityEngine.WSA.Application.InvokeOnAppThread(() => action(), false); 28 | } 29 | } 30 | } 31 | #endif 32 | 33 | #if !WINDOWS_UWP 34 | /// 35 | /// A helper class for dispatching actions to run on various Unity threads. 36 | /// 37 | public class UnityDispatcher : MonoBehaviour 38 | { 39 | #region Member Variables 40 | static private UnityDispatcher instance; 41 | static private Queue queue = new Queue(8); 42 | static private volatile bool queued = false; 43 | #endregion // Member Variables 44 | 45 | #region Internal Methods 46 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] 47 | static private void Initialize() 48 | { 49 | if (instance == null) 50 | { 51 | instance = new GameObject("Dispatcher").AddComponent(); 52 | DontDestroyOnLoad(instance.gameObject); 53 | } 54 | } 55 | #endregion // Internal Methods 56 | 57 | #region Unity Overrides 58 | protected virtual void Update() 59 | { 60 | // Action placeholder 61 | Action action = null; 62 | 63 | // Do this as long as there's something in the queue 64 | while (queued) 65 | { 66 | // Lock only long enough to take an item 67 | lock (queue) 68 | { 69 | // Get the next action 70 | action = queue.Dequeue(); 71 | 72 | // Have we exhausted the queue? 73 | if (queue.Count == 0) { queued = false; } 74 | } 75 | 76 | // Execute the action outside of the lock 77 | action(); 78 | } 79 | } 80 | #endregion // Unity Overrides 81 | 82 | #region Public Methods 83 | /// 84 | /// Schedules the specified action to be run on Unity's main thread. 85 | /// 86 | /// 87 | /// The action to run. 88 | /// 89 | static public void InvokeOnAppThread(Action action) 90 | { 91 | // Validate 92 | if (action == null) throw new ArgumentNullException(nameof(action)); 93 | 94 | // Lock to be thread-safe 95 | lock (queue) 96 | { 97 | // Add the action 98 | queue.Enqueue(action); 99 | 100 | // Action is in the queue 101 | queued = true; 102 | } 103 | } 104 | #endregion // Public Methods 105 | } 106 | #endif -------------------------------------------------------------------------------- /Assets/Speech/Scripts/UnityDispatcher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4e7289462662b244a89abd31700f307 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/mcs.rsp: -------------------------------------------------------------------------------- 1 | -r:System.Net.Http.dll -------------------------------------------------------------------------------- /Assets/mcs.rsp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edeb98001d6087249995c015b37b50b9 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/MixedRealityAzure-Examples/LUIS/Scenes/LuisTest.unity 10 | guid: 017fcfbfe9263b1459783ab0eed8f7f4 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: c1cf8506f04ef2c4a88b64b6c4202eea, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: 0cd792cc87e492d43b4e95b205fc5cc6, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: 7a99f8aa944efe94cb9bd74562b7d5f9, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 15 7 | productGUID: a18649924c852854c8cbbff4040abb04 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: UnityDemo-SpeechWithLUIS 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidBlitType: 0 67 | defaultIsNativeResolution: 1 68 | macRetinaSupport: 1 69 | runInBackground: 1 70 | captureSingleScreen: 0 71 | muteOtherAudioSources: 0 72 | Prepare IOS For Recording: 0 73 | Force IOS Speakers When Recording: 0 74 | deferSystemGesturesMode: 0 75 | hideHomeButton: 0 76 | submitAnalytics: 1 77 | usePlayerLog: 1 78 | bakeCollisionMeshes: 0 79 | forceSingleInstance: 0 80 | resizableWindow: 0 81 | useMacAppStoreValidation: 0 82 | macAppStoreCategory: public.app-category.games 83 | gpuSkinning: 1 84 | graphicsJobs: 0 85 | xboxPIXTextureCapture: 0 86 | xboxEnableAvatar: 0 87 | xboxEnableKinect: 0 88 | xboxEnableKinectAutoTracking: 0 89 | xboxEnableFitness: 0 90 | visibleInBackground: 1 91 | allowFullscreenSwitch: 1 92 | graphicsJobMode: 0 93 | fullscreenMode: 1 94 | xboxSpeechDB: 0 95 | xboxEnableHeadOrientation: 0 96 | xboxEnableGuest: 0 97 | xboxEnablePIXSampling: 0 98 | metalFramebufferOnly: 0 99 | n3dsDisableStereoscopicView: 0 100 | n3dsEnableSharedListOpt: 1 101 | n3dsEnableVSync: 0 102 | xboxOneResolution: 0 103 | xboxOneSResolution: 0 104 | xboxOneXResolution: 3 105 | xboxOneMonoLoggingLevel: 0 106 | xboxOneLoggingLevel: 1 107 | xboxOneDisableEsram: 0 108 | xboxOnePresentImmediateThreshold: 0 109 | switchQueueCommandMemory: 0 110 | videoMemoryForVertexBuffers: 0 111 | psp2PowerMode: 0 112 | psp2AcquireBGM: 1 113 | vulkanEnableSetSRGBWrite: 0 114 | vulkanUseSWCommandBuffers: 0 115 | m_SupportedAspectRatios: 116 | 4:3: 1 117 | 5:4: 1 118 | 16:10: 1 119 | 16:9: 1 120 | Others: 1 121 | bundleVersion: 0.1 122 | preloadedAssets: [] 123 | metroInputSource: 0 124 | wsaTransparentSwapchain: 0 125 | m_HolographicPauseOnTrackingLoss: 1 126 | xboxOneDisableKinectGpuReservation: 0 127 | xboxOneEnable7thCore: 0 128 | vrSettings: 129 | cardboard: 130 | depthFormat: 0 131 | enableTransitionView: 0 132 | daydream: 133 | depthFormat: 0 134 | useSustainedPerformanceMode: 0 135 | enableVideoLayer: 0 136 | useProtectedVideoMemory: 0 137 | minimumSupportedHeadTracking: 0 138 | maximumSupportedHeadTracking: 1 139 | hololens: 140 | depthFormat: 1 141 | depthBufferSharingEnabled: 0 142 | oculus: 143 | sharedDepthBuffer: 0 144 | dashSupport: 0 145 | enable360StereoCapture: 0 146 | protectGraphicsMemory: 0 147 | useHDRDisplay: 0 148 | m_ColorGamuts: 00000000 149 | targetPixelDensity: 30 150 | resolutionScalingMode: 0 151 | androidSupportedAspectRatio: 1 152 | androidMaxAspectRatio: 2.1 153 | applicationIdentifier: {} 154 | buildNumber: {} 155 | AndroidBundleVersionCode: 1 156 | AndroidMinSdkVersion: 16 157 | AndroidTargetSdkVersion: 0 158 | AndroidPreferredInstallLocation: 1 159 | aotOptions: 160 | stripEngineCode: 1 161 | iPhoneStrippingLevel: 0 162 | iPhoneScriptCallOptimization: 0 163 | ForceInternetPermission: 0 164 | ForceSDCardPermission: 0 165 | CreateWallpaper: 0 166 | APKExpansionFiles: 0 167 | keepLoadedShadersAlive: 0 168 | StripUnusedMeshComponents: 1 169 | VertexChannelCompressionMask: 4054 170 | iPhoneSdkVersion: 988 171 | iOSTargetOSVersionString: 8.0 172 | tvOSSdkVersion: 0 173 | tvOSRequireExtendedGameController: 0 174 | tvOSTargetOSVersionString: 9.0 175 | uIPrerenderedIcon: 0 176 | uIRequiresPersistentWiFi: 0 177 | uIRequiresFullScreen: 1 178 | uIStatusBarHidden: 1 179 | uIExitOnSuspend: 0 180 | uIStatusBarStyle: 0 181 | iPhoneSplashScreen: {fileID: 0} 182 | iPhoneHighResSplashScreen: {fileID: 0} 183 | iPhoneTallHighResSplashScreen: {fileID: 0} 184 | iPhone47inSplashScreen: {fileID: 0} 185 | iPhone55inPortraitSplashScreen: {fileID: 0} 186 | iPhone55inLandscapeSplashScreen: {fileID: 0} 187 | iPhone58inPortraitSplashScreen: {fileID: 0} 188 | iPhone58inLandscapeSplashScreen: {fileID: 0} 189 | iPadPortraitSplashScreen: {fileID: 0} 190 | iPadHighResPortraitSplashScreen: {fileID: 0} 191 | iPadLandscapeSplashScreen: {fileID: 0} 192 | iPadHighResLandscapeSplashScreen: {fileID: 0} 193 | appleTVSplashScreen: {fileID: 0} 194 | appleTVSplashScreen2x: {fileID: 0} 195 | tvOSSmallIconLayers: [] 196 | tvOSSmallIconLayers2x: [] 197 | tvOSLargeIconLayers: [] 198 | tvOSLargeIconLayers2x: [] 199 | tvOSTopShelfImageLayers: [] 200 | tvOSTopShelfImageLayers2x: [] 201 | tvOSTopShelfImageWideLayers: [] 202 | tvOSTopShelfImageWideLayers2x: [] 203 | iOSLaunchScreenType: 0 204 | iOSLaunchScreenPortrait: {fileID: 0} 205 | iOSLaunchScreenLandscape: {fileID: 0} 206 | iOSLaunchScreenBackgroundColor: 207 | serializedVersion: 2 208 | rgba: 0 209 | iOSLaunchScreenFillPct: 100 210 | iOSLaunchScreenSize: 100 211 | iOSLaunchScreenCustomXibPath: 212 | iOSLaunchScreeniPadType: 0 213 | iOSLaunchScreeniPadImage: {fileID: 0} 214 | iOSLaunchScreeniPadBackgroundColor: 215 | serializedVersion: 2 216 | rgba: 0 217 | iOSLaunchScreeniPadFillPct: 100 218 | iOSLaunchScreeniPadSize: 100 219 | iOSLaunchScreeniPadCustomXibPath: 220 | iOSUseLaunchScreenStoryboard: 0 221 | iOSLaunchScreenCustomStoryboardPath: 222 | iOSDeviceRequirements: [] 223 | iOSURLSchemes: [] 224 | iOSBackgroundModes: 0 225 | iOSMetalForceHardShadows: 0 226 | metalEditorSupport: 1 227 | metalAPIValidation: 1 228 | iOSRenderExtraFrameOnPause: 0 229 | appleDeveloperTeamID: 230 | iOSManualSigningProvisioningProfileID: 231 | tvOSManualSigningProvisioningProfileID: 232 | iOSManualSigningProvisioningProfileType: 0 233 | tvOSManualSigningProvisioningProfileType: 0 234 | appleEnableAutomaticSigning: 0 235 | iOSRequireARKit: 0 236 | appleEnableProMotion: 0 237 | vulkanEditorSupport: 0 238 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 239 | templatePackageId: com.unity.3d@1.0.2 240 | templateDefaultScene: Assets/Scenes/SampleScene.unity 241 | AndroidTargetArchitectures: 5 242 | AndroidSplashScreenScale: 0 243 | androidSplashScreen: {fileID: 0} 244 | AndroidKeystoreName: 245 | AndroidKeyaliasName: 246 | AndroidBuildApkPerCpuArchitecture: 0 247 | AndroidTVCompatibility: 1 248 | AndroidIsGame: 1 249 | AndroidEnableTango: 0 250 | androidEnableBanner: 1 251 | androidUseLowAccuracyLocation: 0 252 | m_AndroidBanners: 253 | - width: 320 254 | height: 180 255 | banner: {fileID: 0} 256 | androidGamepadSupportLevel: 0 257 | resolutionDialogBanner: {fileID: 0} 258 | m_BuildTargetIcons: [] 259 | m_BuildTargetPlatformIcons: [] 260 | m_BuildTargetBatching: 261 | - m_BuildTarget: Standalone 262 | m_StaticBatching: 1 263 | m_DynamicBatching: 0 264 | - m_BuildTarget: tvOS 265 | m_StaticBatching: 1 266 | m_DynamicBatching: 0 267 | - m_BuildTarget: Android 268 | m_StaticBatching: 1 269 | m_DynamicBatching: 0 270 | - m_BuildTarget: iPhone 271 | m_StaticBatching: 1 272 | m_DynamicBatching: 0 273 | - m_BuildTarget: WebGL 274 | m_StaticBatching: 0 275 | m_DynamicBatching: 0 276 | m_BuildTargetGraphicsAPIs: 277 | - m_BuildTarget: AndroidPlayer 278 | m_APIs: 0b00000015000000 279 | m_Automatic: 1 280 | - m_BuildTarget: iOSSupport 281 | m_APIs: 10000000 282 | m_Automatic: 1 283 | - m_BuildTarget: AppleTVSupport 284 | m_APIs: 10000000 285 | m_Automatic: 0 286 | - m_BuildTarget: WebGLSupport 287 | m_APIs: 0b000000 288 | m_Automatic: 1 289 | m_BuildTargetVRSettings: 290 | - m_BuildTarget: Standalone 291 | m_Enabled: 0 292 | m_Devices: 293 | - Oculus 294 | - OpenVR 295 | m_BuildTargetEnableVuforiaSettings: [] 296 | openGLRequireES31: 0 297 | openGLRequireES31AEP: 0 298 | m_TemplateCustomTags: {} 299 | mobileMTRendering: 300 | Android: 1 301 | iPhone: 1 302 | tvOS: 1 303 | m_BuildTargetGroupLightmapEncodingQuality: [] 304 | m_BuildTargetGroupLightmapSettings: [] 305 | playModeTestRunnerEnabled: 0 306 | runPlayModeTestAsEditModeTest: 0 307 | actionOnDotNetUnhandledException: 1 308 | enableInternalProfiler: 0 309 | logObjCUncaughtExceptions: 1 310 | enableCrashReportAPI: 0 311 | cameraUsageDescription: 312 | locationUsageDescription: 313 | microphoneUsageDescription: 314 | switchNetLibKey: 315 | switchSocketMemoryPoolSize: 6144 316 | switchSocketAllocatorPoolSize: 128 317 | switchSocketConcurrencyLimit: 14 318 | switchScreenResolutionBehavior: 2 319 | switchUseCPUProfiler: 0 320 | switchApplicationID: 0x01004b9000490000 321 | switchNSODependencies: 322 | switchTitleNames_0: 323 | switchTitleNames_1: 324 | switchTitleNames_2: 325 | switchTitleNames_3: 326 | switchTitleNames_4: 327 | switchTitleNames_5: 328 | switchTitleNames_6: 329 | switchTitleNames_7: 330 | switchTitleNames_8: 331 | switchTitleNames_9: 332 | switchTitleNames_10: 333 | switchTitleNames_11: 334 | switchTitleNames_12: 335 | switchTitleNames_13: 336 | switchTitleNames_14: 337 | switchPublisherNames_0: 338 | switchPublisherNames_1: 339 | switchPublisherNames_2: 340 | switchPublisherNames_3: 341 | switchPublisherNames_4: 342 | switchPublisherNames_5: 343 | switchPublisherNames_6: 344 | switchPublisherNames_7: 345 | switchPublisherNames_8: 346 | switchPublisherNames_9: 347 | switchPublisherNames_10: 348 | switchPublisherNames_11: 349 | switchPublisherNames_12: 350 | switchPublisherNames_13: 351 | switchPublisherNames_14: 352 | switchIcons_0: {fileID: 0} 353 | switchIcons_1: {fileID: 0} 354 | switchIcons_2: {fileID: 0} 355 | switchIcons_3: {fileID: 0} 356 | switchIcons_4: {fileID: 0} 357 | switchIcons_5: {fileID: 0} 358 | switchIcons_6: {fileID: 0} 359 | switchIcons_7: {fileID: 0} 360 | switchIcons_8: {fileID: 0} 361 | switchIcons_9: {fileID: 0} 362 | switchIcons_10: {fileID: 0} 363 | switchIcons_11: {fileID: 0} 364 | switchIcons_12: {fileID: 0} 365 | switchIcons_13: {fileID: 0} 366 | switchIcons_14: {fileID: 0} 367 | switchSmallIcons_0: {fileID: 0} 368 | switchSmallIcons_1: {fileID: 0} 369 | switchSmallIcons_2: {fileID: 0} 370 | switchSmallIcons_3: {fileID: 0} 371 | switchSmallIcons_4: {fileID: 0} 372 | switchSmallIcons_5: {fileID: 0} 373 | switchSmallIcons_6: {fileID: 0} 374 | switchSmallIcons_7: {fileID: 0} 375 | switchSmallIcons_8: {fileID: 0} 376 | switchSmallIcons_9: {fileID: 0} 377 | switchSmallIcons_10: {fileID: 0} 378 | switchSmallIcons_11: {fileID: 0} 379 | switchSmallIcons_12: {fileID: 0} 380 | switchSmallIcons_13: {fileID: 0} 381 | switchSmallIcons_14: {fileID: 0} 382 | switchManualHTML: 383 | switchAccessibleURLs: 384 | switchLegalInformation: 385 | switchMainThreadStackSize: 1048576 386 | switchPresenceGroupId: 387 | switchLogoHandling: 0 388 | switchReleaseVersion: 0 389 | switchDisplayVersion: 1.0.0 390 | switchStartupUserAccount: 0 391 | switchTouchScreenUsage: 0 392 | switchSupportedLanguagesMask: 0 393 | switchLogoType: 0 394 | switchApplicationErrorCodeCategory: 395 | switchUserAccountSaveDataSize: 0 396 | switchUserAccountSaveDataJournalSize: 0 397 | switchApplicationAttribute: 0 398 | switchCardSpecSize: -1 399 | switchCardSpecClock: -1 400 | switchRatingsMask: 0 401 | switchRatingsInt_0: 0 402 | switchRatingsInt_1: 0 403 | switchRatingsInt_2: 0 404 | switchRatingsInt_3: 0 405 | switchRatingsInt_4: 0 406 | switchRatingsInt_5: 0 407 | switchRatingsInt_6: 0 408 | switchRatingsInt_7: 0 409 | switchRatingsInt_8: 0 410 | switchRatingsInt_9: 0 411 | switchRatingsInt_10: 0 412 | switchRatingsInt_11: 0 413 | switchLocalCommunicationIds_0: 414 | switchLocalCommunicationIds_1: 415 | switchLocalCommunicationIds_2: 416 | switchLocalCommunicationIds_3: 417 | switchLocalCommunicationIds_4: 418 | switchLocalCommunicationIds_5: 419 | switchLocalCommunicationIds_6: 420 | switchLocalCommunicationIds_7: 421 | switchParentalControl: 0 422 | switchAllowsScreenshot: 1 423 | switchAllowsVideoCapturing: 1 424 | switchAllowsRuntimeAddOnContentInstall: 0 425 | switchDataLossConfirmation: 0 426 | switchSupportedNpadStyles: 3 427 | switchNativeFsCacheSize: 32 428 | switchIsHoldTypeHorizontal: 0 429 | switchSupportedNpadCount: 8 430 | switchSocketConfigEnabled: 0 431 | switchTcpInitialSendBufferSize: 32 432 | switchTcpInitialReceiveBufferSize: 64 433 | switchTcpAutoSendBufferSizeMax: 256 434 | switchTcpAutoReceiveBufferSizeMax: 256 435 | switchUdpSendBufferSize: 9 436 | switchUdpReceiveBufferSize: 42 437 | switchSocketBufferEfficiency: 4 438 | switchSocketInitializeEnabled: 1 439 | switchNetworkInterfaceManagerInitializeEnabled: 1 440 | switchPlayerConnectionEnabled: 1 441 | ps4NPAgeRating: 12 442 | ps4NPTitleSecret: 443 | ps4NPTrophyPackPath: 444 | ps4ParentalLevel: 11 445 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 446 | ps4Category: 0 447 | ps4MasterVersion: 01.00 448 | ps4AppVersion: 01.00 449 | ps4AppType: 0 450 | ps4ParamSfxPath: 451 | ps4VideoOutPixelFormat: 0 452 | ps4VideoOutInitialWidth: 1920 453 | ps4VideoOutBaseModeInitialWidth: 1920 454 | ps4VideoOutReprojectionRate: 60 455 | ps4PronunciationXMLPath: 456 | ps4PronunciationSIGPath: 457 | ps4BackgroundImagePath: 458 | ps4StartupImagePath: 459 | ps4StartupImagesFolder: 460 | ps4IconImagesFolder: 461 | ps4SaveDataImagePath: 462 | ps4SdkOverride: 463 | ps4BGMPath: 464 | ps4ShareFilePath: 465 | ps4ShareOverlayImagePath: 466 | ps4PrivacyGuardImagePath: 467 | ps4NPtitleDatPath: 468 | ps4RemotePlayKeyAssignment: -1 469 | ps4RemotePlayKeyMappingDir: 470 | ps4PlayTogetherPlayerCount: 0 471 | ps4EnterButtonAssignment: 1 472 | ps4ApplicationParam1: 0 473 | ps4ApplicationParam2: 0 474 | ps4ApplicationParam3: 0 475 | ps4ApplicationParam4: 0 476 | ps4DownloadDataSize: 0 477 | ps4GarlicHeapSize: 2048 478 | ps4ProGarlicHeapSize: 2560 479 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 480 | ps4pnSessions: 1 481 | ps4pnPresence: 1 482 | ps4pnFriends: 1 483 | ps4pnGameCustomData: 1 484 | playerPrefsSupport: 0 485 | enableApplicationExit: 0 486 | restrictedAudioUsageRights: 0 487 | ps4UseResolutionFallback: 0 488 | ps4ReprojectionSupport: 0 489 | ps4UseAudio3dBackend: 0 490 | ps4SocialScreenEnabled: 0 491 | ps4ScriptOptimizationLevel: 0 492 | ps4Audio3dVirtualSpeakerCount: 14 493 | ps4attribCpuUsage: 0 494 | ps4PatchPkgPath: 495 | ps4PatchLatestPkgPath: 496 | ps4PatchChangeinfoPath: 497 | ps4PatchDayOne: 0 498 | ps4attribUserManagement: 0 499 | ps4attribMoveSupport: 0 500 | ps4attrib3DSupport: 0 501 | ps4attribShareSupport: 0 502 | ps4attribExclusiveVR: 0 503 | ps4disableAutoHideSplash: 0 504 | ps4videoRecordingFeaturesUsed: 0 505 | ps4contentSearchFeaturesUsed: 0 506 | ps4attribEyeToEyeDistanceSettingVR: 0 507 | ps4IncludedModules: [] 508 | monoEnv: 509 | psp2Splashimage: {fileID: 0} 510 | psp2NPTrophyPackPath: 511 | psp2NPSupportGBMorGJP: 0 512 | psp2NPAgeRating: 12 513 | psp2NPTitleDatPath: 514 | psp2NPCommsID: 515 | psp2NPCommunicationsID: 516 | psp2NPCommsPassphrase: 517 | psp2NPCommsSig: 518 | psp2ParamSfxPath: 519 | psp2ManualPath: 520 | psp2LiveAreaGatePath: 521 | psp2LiveAreaBackroundPath: 522 | psp2LiveAreaPath: 523 | psp2LiveAreaTrialPath: 524 | psp2PatchChangeInfoPath: 525 | psp2PatchOriginalPackage: 526 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 527 | psp2KeystoneFile: 528 | psp2MemoryExpansionMode: 0 529 | psp2DRMType: 0 530 | psp2StorageType: 0 531 | psp2MediaCapacity: 0 532 | psp2DLCConfigPath: 533 | psp2ThumbnailPath: 534 | psp2BackgroundPath: 535 | psp2SoundPath: 536 | psp2TrophyCommId: 537 | psp2TrophyPackagePath: 538 | psp2PackagedResourcesPath: 539 | psp2SaveDataQuota: 10240 540 | psp2ParentalLevel: 1 541 | psp2ShortTitle: Not Set 542 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 543 | psp2Category: 0 544 | psp2MasterVersion: 01.00 545 | psp2AppVersion: 01.00 546 | psp2TVBootMode: 0 547 | psp2EnterButtonAssignment: 2 548 | psp2TVDisableEmu: 0 549 | psp2AllowTwitterDialog: 1 550 | psp2Upgradable: 0 551 | psp2HealthWarning: 0 552 | psp2UseLibLocation: 0 553 | psp2InfoBarOnStartup: 0 554 | psp2InfoBarColor: 0 555 | psp2ScriptOptimizationLevel: 0 556 | splashScreenBackgroundSourceLandscape: {fileID: 0} 557 | splashScreenBackgroundSourcePortrait: {fileID: 0} 558 | spritePackerPolicy: 559 | webGLMemorySize: 256 560 | webGLExceptionSupport: 1 561 | webGLNameFilesAsHashes: 0 562 | webGLDataCaching: 1 563 | webGLDebugSymbols: 0 564 | webGLEmscriptenArgs: 565 | webGLModulesDirectory: 566 | webGLTemplate: APPLICATION:Default 567 | webGLAnalyzeBuildSize: 0 568 | webGLUseEmbeddedResources: 0 569 | webGLCompressionFormat: 1 570 | webGLLinkerTarget: 1 571 | scriptingDefineSymbols: {} 572 | platformArchitecture: {} 573 | scriptingBackend: {} 574 | il2cppCompilerConfiguration: {} 575 | incrementalIl2cppBuild: {} 576 | allowUnsafeCode: 0 577 | additionalIl2CppArgs: 578 | scriptingRuntimeVersion: 1 579 | apiCompatibilityLevelPerPlatform: {} 580 | m_RenderingPath: 1 581 | m_MobileRenderingPath: 1 582 | metroPackageName: Template_3D 583 | metroPackageVersion: 584 | metroCertificatePath: 585 | metroCertificatePassword: 586 | metroCertificateSubject: 587 | metroCertificateIssuer: 588 | metroCertificateNotAfter: 0000000000000000 589 | metroApplicationDescription: Template_3D 590 | wsaImages: {} 591 | metroTileShortName: 592 | metroTileShowName: 0 593 | metroMediumTileShowName: 0 594 | metroLargeTileShowName: 0 595 | metroWideTileShowName: 0 596 | metroDefaultTileSize: 1 597 | metroTileForegroundText: 2 598 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 599 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 600 | a: 1} 601 | metroSplashScreenUseBackgroundColor: 0 602 | platformCapabilities: {} 603 | metroFTAName: 604 | metroFTAFileTypes: [] 605 | metroProtocolName: 606 | metroCompilationOverrides: 1 607 | n3dsUseExtSaveData: 0 608 | n3dsCompressStaticMem: 1 609 | n3dsExtSaveDataNumber: 0x12345 610 | n3dsStackSize: 131072 611 | n3dsTargetPlatform: 2 612 | n3dsRegion: 7 613 | n3dsMediaSize: 0 614 | n3dsLogoStyle: 3 615 | n3dsTitle: GameName 616 | n3dsProductCode: 617 | n3dsApplicationId: 0xFF3FF 618 | XboxOneProductId: 619 | XboxOneUpdateKey: 620 | XboxOneSandboxId: 621 | XboxOneContentId: 622 | XboxOneTitleId: 623 | XboxOneSCId: 624 | XboxOneGameOsOverridePath: 625 | XboxOnePackagingOverridePath: 626 | XboxOneAppManifestOverridePath: 627 | XboxOneVersion: 1.0.0.0 628 | XboxOnePackageEncryption: 0 629 | XboxOnePackageUpdateGranularity: 2 630 | XboxOneDescription: 631 | XboxOneLanguage: 632 | - enus 633 | XboxOneCapability: [] 634 | XboxOneGameRating: {} 635 | XboxOneIsContentPackage: 0 636 | XboxOneEnableGPUVariability: 0 637 | XboxOneSockets: {} 638 | XboxOneSplashScreen: {fileID: 0} 639 | XboxOneAllowedProductIds: [] 640 | XboxOnePersistentLocalStorageSize: 0 641 | XboxOneXTitleMemory: 8 642 | xboxOneScriptCompiler: 0 643 | vrEditorSettings: 644 | daydream: 645 | daydreamIconForeground: {fileID: 0} 646 | daydreamIconBackground: {fileID: 0} 647 | cloudServicesEnabled: 648 | UNet: 1 649 | facebookSdkVersion: 7.9.4 650 | apiCompatibilityLevel: 2 651 | cloudProjectId: 652 | projectName: 653 | organizationId: 654 | cloudEnabled: 0 655 | enableNativePlatformBackendsForNewInputSystem: 0 656 | disableOldInputManagerSupport: 0 657 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.2.20f1 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 4 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 2 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 40 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 1 136 | antiAliasing: 4 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 1 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSP2: 2 183 | Standalone: 5 184 | Tizen: 2 185 | WebGL: 3 186 | WiiU: 5 187 | Windows Store Apps: 5 188 | XboxOne: 5 189 | iPhone: 2 190 | tvOS: 2 191 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - PostProcessing 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity-SpeechWithLUIS 2 | Sample Unity project used to demonstrate the integration of Speech Recognition and Language Understanding using the new [Microsoft Speech Service](https://docs.microsoft.com/en-us/azure/cognitive-services/Speech-Service/) (currently in Preview) and [LUIS](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/) from Microsoft Cognitive Services. **This is a work in progress**. 3 | 4 | * **Unity version:** 2018.2.6f1 5 | * **Speech Service version:** 0.6.0 (Preview) 6 | 7 | ![Screenshot](Screenshots/SpeechWithLUIS-Test01.gif) 8 | 9 | ## Implementation Notes 10 | * The [Language Understanding (LUIS)]((https://docs.microsoft.com/en-us/azure/cognitive-services/luis/)) integration work with Unity is based on a reference architecture design by my colleague [Jared Bienz](https://github.com/jbienzms). Read his articles on [Natural Language for Simulations here](http://aka.ms/mrluis). The **LUIS for XR** code is [on GitHub here](https://github.com/Microsoft/mixedreality-azure-samples/tree/master/Reference-Architecture/Client/MixedReality-Azure-Unity/Assets/MixedRealityAzure/LUIS). Follow the instructions in the second article of this series to setup your LUIS app and import the app model from the sample JSON file. 11 | * This sample uses the [Microsoft Speech SDK Sample for Unity](https://github.com/ActiveNick/Unity-MS-SpeechSDK). Please check that repo for specific notes about the speech support. That repo should also be considered the latest version to be used for your your own projects since I will not update this Speech-LUIS sample as often. 12 | * You will need an Azure Cognitive Services account to use this sample: [Create an account here](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account). 13 | * If you see any API keys in the code, these are either trial keys that will expire soon or temporary keys that may get invalidated. Please get your own keys. [Get your own trial key to Bing Speech or the new Speech Service here](https://azure.microsoft.com/try/cognitive-services). A free tier is available allowing 5,000 transactions per month, at a rate of 20 per minute. 14 | * For LUIS, get your API key [in the LUIS portal here](https://www.luis.ai). [The free tier](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/language-understanding-intelligent-services/) allows up to 10,000 free transactions per month. 15 | 16 | ## Resource Links 17 | * [Microsoft Cognitive Services](https://www.microsoft.com/cognitive-services) (formerly Project Oxford) 18 | * [Language Understanding Service](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/) (aka LUIS) 19 | * [New Cognitive Services Speech Service](https://docs.microsoft.com/en-us/azure/cognitive-services/Speech-Service/) (currently in Preview) 20 | * [Natural Language for Simulations](http://aka.ms/mrluis), by [Jared Bienz](https://github.com/jbienzms) 21 | * [Microsoft Speech Recognition Sample for Unity](https://github.com/ActiveNick/Unity-MS-SpeechSDK) (aka Speech-to-Text) 22 | * [Microsoft Speech Synthesis Sample for Unity](https://github.com/ActiveNick/Unity-Text-to-Speech) (aka Text-to-Speech) 23 | 24 | ## Follow Me 25 | * Twitter: [@ActiveNick](http://twitter.com/ActiveNick) 26 | * SlideShare: [http://www.slideshare.net/ActiveNick](http://www.slideshare.net/ActiveNick) 27 | -------------------------------------------------------------------------------- /Screenshots/SpeechWithLUIS-Test01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ActiveNick/Unity-SpeechWithLUIS/b9ac4f200aba1b84b13375dbb52b95d6e366bbe1/Screenshots/SpeechWithLUIS-Test01.gif -------------------------------------------------------------------------------- /Unity-SpeechWithLUIS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{88AB25D6-BAF2-E49E-EBFC-C357ADD66235}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{19E72AD3-F37F-EDD1-8581-1AD3F737050A}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {88AB25D6-BAF2-E49E-EBFC-C357ADD66235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {88AB25D6-BAF2-E49E-EBFC-C357ADD66235}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {88AB25D6-BAF2-E49E-EBFC-C357ADD66235}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {88AB25D6-BAF2-E49E-EBFC-C357ADD66235}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {19E72AD3-F37F-EDD1-8581-1AD3F737050A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {19E72AD3-F37F-EDD1-8581-1AD3F737050A}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {19E72AD3-F37F-EDD1-8581-1AD3F737050A}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {19E72AD3-F37F-EDD1-8581-1AD3F737050A}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | --------------------------------------------------------------------------------