├── Doc
├── Reach.png
├── Shared.png
├── Companion.png
├── XamlUnity.png
├── UnifiedInput.png
└── UnityBinding.png
├── Samples
├── UWP
│ ├── EditorSample
│ │ ├── EditorSample
│ │ │ ├── Data
│ │ │ │ ├── managedAssemblies.txt
│ │ │ │ ├── level0
│ │ │ │ ├── level1
│ │ │ │ ├── level0.resS
│ │ │ │ ├── level1.resS
│ │ │ │ ├── globalgamemanagers
│ │ │ │ ├── sharedassets0.assets
│ │ │ │ ├── sharedassets1.assets
│ │ │ │ ├── globalgamemanagers.assets
│ │ │ │ └── Resources
│ │ │ │ │ ├── unity_builtin_extra
│ │ │ │ │ └── unity default resources
│ │ │ ├── Assets
│ │ │ │ ├── StoreLogo.png
│ │ │ │ ├── SplashScreen.scale-200.png
│ │ │ │ ├── Square44x44Logo.scale-200.png
│ │ │ │ ├── Wide310x150Logo.scale-200.png
│ │ │ │ ├── Square150x150Logo.scale-200.png
│ │ │ │ └── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ │ ├── WSATestCertificate.pfx
│ │ │ ├── App.xaml
│ │ │ ├── project.json
│ │ │ ├── Properties
│ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ └── Default.rd.xml
│ │ │ ├── MainPage.xaml
│ │ │ ├── MainPage.xaml.cs
│ │ │ ├── Package.appxmanifest
│ │ │ └── App.xaml.cs
│ │ ├── UnityCommon.props
│ │ ├── UnityOverwrite.txt
│ │ └── EditorSample.sln
│ └── InputSample
│ │ ├── Assets
│ │ ├── StoreLogo.png
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Wide310x150Logo.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ └── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── InputSample_TemporaryKey.pfx
│ │ ├── ApplicationInsights.config
│ │ ├── App.xaml
│ │ ├── project.json
│ │ ├── Views
│ │ ├── MainPage.xaml
│ │ └── MainPage.xaml.cs
│ │ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ │ ├── Package.appxmanifest
│ │ ├── App.xaml.cs
│ │ ├── InputSample.csproj
│ │ └── ViewModels
│ │ └── MainViewModel.cs
└── Unity
│ └── EditorSample
│ ├── ProjectSettings
│ ├── ProjectVersion.txt
│ ├── TagManager.asset
│ ├── AudioManager.asset
│ ├── InputManager.asset
│ ├── NavMeshAreas.asset
│ ├── TimeManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorSettings.asset
│ ├── NetworkManager.asset
│ ├── ProjectSettings.asset
│ ├── QualitySettings.asset
│ ├── GraphicsSettings.asset
│ ├── Physics2DSettings.asset
│ ├── UnityAdsSettings.asset
│ ├── ClusterInputManager.asset
│ ├── EditorBuildSettings.asset
│ └── UnityConnectSettings.asset
│ ├── Assets
│ ├── Scenes
│ │ ├── CubeScene.unity
│ │ └── SphereScene.unity
│ └── WSATestCertificate.pfx
│ ├── UWP
│ └── project.json
│ └── EditorSample.sln
├── Unity
└── Players
│ └── UAP
│ └── ARM
│ └── master
│ ├── WinRTBridge.pri
│ ├── UnityPlayer.winmd
│ ├── WinRTBridge.winmd
│ ├── BridgeInterface.pri
│ ├── UnityEngineProxy.pri
│ ├── BridgeInterface.winmd
│ ├── UnityEngineDelegates.pri
│ ├── UnityEngineDelegates.winmd
│ ├── WinRTBridge
│ └── Properties
│ │ └── WinRTBridge.rd.xml
│ └── UnityEngineProxy
│ └── Properties
│ └── UnityEngineProxy.rd.xml
├── Lib
├── UWP
│ ├── Adept.Input
│ │ ├── project.json
│ │ ├── ParameterValueSet.cs
│ │ ├── Gamepad
│ │ │ ├── GamepadBinding.cs
│ │ │ └── GamepadMapper.cs
│ │ ├── ParameterValue.cs
│ │ ├── ParameterDefinition.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── IInputAction.cs
│ │ ├── InputMap.cs
│ │ ├── IInputTrigger.cs
│ │ ├── Keyboard
│ │ │ ├── KeyBinding.cs
│ │ │ └── KeyboardMapper.cs
│ │ ├── Extensions
│ │ │ └── GamepadExtensions.cs
│ │ ├── Actions
│ │ │ └── MethodAction.cs
│ │ └── Adept.Input.csproj
│ ├── Adept.UnityXaml
│ │ ├── project.json
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ └── Adept.UnityXaml.rd.xml
│ │ ├── Themes
│ │ │ └── Generic.xaml
│ │ ├── UnityHelpers.cs
│ │ ├── Controls
│ │ │ └── UnityView.cs
│ │ └── Adept.UnityXaml.csproj
│ └── Adept.StateSync
│ │ ├── project.json
│ │ ├── Actions
│ │ ├── SyncAction.cs
│ │ └── SetPropertyAction.cs
│ │ ├── Strategies
│ │ ├── PropertyStrategyAttribute.cs
│ │ └── SynchronizeValueAttribute.cs
│ │ ├── SyncMessage.cs
│ │ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Adept.StateSync.rd.xml
│ │ ├── SynchronizationManager.cs
│ │ └── Adept.StateSync.csproj
└── Unity
│ └── Assets
│ └── Adept
│ ├── Controls
│ ├── Scripts
│ │ ├── ListBox.cs
│ │ ├── SelectionChangedEventArgs.cs
│ │ ├── ComboBox.cs
│ │ ├── ItemContainerGenerator.cs
│ │ └── Selector.cs
│ └── Prefabs
│ │ └── ItemContainer.prefab
│ ├── Utilities
│ └── Scripts
│ │ ├── ResourceHelper.cs
│ │ ├── CopyExtensions.cs
│ │ ├── Environment.cs
│ │ ├── ThreadExtensions.cs
│ │ └── ReflectionExtensions.cs
│ ├── Binding
│ └── Scripts
│ │ ├── DefaultTextConverter.cs
│ │ ├── DefaultTextBinding.cs
│ │ ├── TargetedBinding.cs
│ │ ├── ValueChangingEventArgs.cs
│ │ ├── DataBinding.cs
│ │ ├── ItemsSourceBinding.cs
│ │ ├── ControlBinding.cs
│ │ ├── ConvertableValueConverter.cs
│ │ ├── IValueConverter.cs
│ │ ├── InputFieldBinding.cs
│ │ ├── DataContext.cs
│ │ └── ConverterBehaviour.cs
│ └── Observable
│ └── Scripts
│ ├── INotifyCollectionChanged.cs
│ └── ObservableObject.cs
├── License
├── Adept.licenseheader
└── LICENSE.txt
├── UnityCommon.props
├── UnityLib.props
├── UnityAppLib.props
├── UnityApp.props
├── README.md
└── .gitignore
/Doc/Reach.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Doc/Reach.png
--------------------------------------------------------------------------------
/Doc/Shared.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Doc/Shared.png
--------------------------------------------------------------------------------
/Doc/Companion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Doc/Companion.png
--------------------------------------------------------------------------------
/Doc/XamlUnity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Doc/XamlUnity.png
--------------------------------------------------------------------------------
/Doc/UnifiedInput.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Doc/UnifiedInput.png
--------------------------------------------------------------------------------
/Doc/UnityBinding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Doc/UnityBinding.png
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/managedAssemblies.txt:
--------------------------------------------------------------------------------
1 | UnityEngine.UI.dll
2 | UnityEngine.Networking.dll
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.2f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/WinRTBridge.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/WinRTBridge.pri
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/UnityPlayer.winmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/UnityPlayer.winmd
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/WinRTBridge.winmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/WinRTBridge.winmd
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/level0:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/level0
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/level1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/level1
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/BridgeInterface.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/BridgeInterface.pri
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/UnityEngineProxy.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/UnityEngineProxy.pri
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/BridgeInterface.winmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/BridgeInterface.winmd
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/level0.resS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/level0.resS
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/level1.resS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/level1.resS
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/InputSample_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/InputSample_TemporaryKey.pfx
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/UnityEngineDelegates.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/UnityEngineDelegates.pri
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/Assets/Scenes/CubeScene.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/Assets/Scenes/CubeScene.unity
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/Assets/WSATestCertificate.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/Assets/WSATestCertificate.pfx
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/UnityEngineDelegates.winmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Unity/Players/UAP/ARM/master/UnityEngineDelegates.winmd
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/Assets/Scenes/SphereScene.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/Assets/Scenes/SphereScene.unity
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/TagManager.asset
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/globalgamemanagers:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/globalgamemanagers
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/WSATestCertificate.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/WSATestCertificate.pfx
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/AudioManager.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/InputManager.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/NavMeshAreas.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/TimeManager.asset
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/sharedassets0.assets:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/sharedassets0.assets
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/sharedassets1.assets:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/sharedassets1.assets
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/DynamicsManager.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/EditorSettings.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/NetworkManager.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/ProjectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/ProjectSettings.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/QualitySettings.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/GraphicsSettings.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/Physics2DSettings.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/UnityAdsSettings.asset
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/globalgamemanagers.assets:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/globalgamemanagers.assets
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/ClusterInputManager.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/EditorBuildSettings.asset
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/Unity/EditorSample/ProjectSettings/UnityConnectSettings.asset
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/Resources/unity_builtin_extra:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/Resources/unity_builtin_extra
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Data/Resources/unity default resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Data/Resources/unity default resources
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/InputSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jbienzms/Adept/HEAD/Samples/UWP/EditorSample/EditorSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/ApplicationInsights.config:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
--------------------------------------------------------------------------------
/Lib/UWP/Adept.UnityXaml/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/UWP/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
--------------------------------------------------------------------------------
/License/Adept.licenseheader:
--------------------------------------------------------------------------------
1 | extensions: designer.cs generated.cs
2 | extensions: .cs .cpp .h
3 | // Copyright (c) Microsoft. All rights reserved.
4 | //
5 | extensions: .aspx .ascx
6 | <%--
7 | Copyright (c) Microsoft. All rights reserved.
8 | --%>
9 | extensions: .vb
10 | 'Sample license text.
11 | extensions: .xml .config .xsd
12 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
4 | "Newtonsoft.Json": "8.0.3"
5 | },
6 | "frameworks": {
7 | "uap10.0": {}
8 | },
9 | "runtimes": {
10 | "win10-arm": {},
11 | "win10-arm-aot": {},
12 | "win10-x86": {},
13 | "win10-x86-aot": {},
14 | "win10-x64": {},
15 | "win10-x64-aot": {}
16 | }
17 | }
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/ParameterValueSet.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Adept.Input
11 | {
12 | public class ParameterValueSet : Collection
13 | {
14 | // TODO: Make sure not adding the same parameter more than once.
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Gamepad/GamepadBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Windows.Gaming.Input;
9 |
10 | namespace Adept.Input
11 | {
12 | ///
13 | /// A class that maps input to application actions.
14 | ///
15 | public class GamepadBinding
16 | {
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Samples/Unity/EditorSample/EditorSample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Global
5 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
6 | Debug|Any CPU = Debug|Any CPU
7 | Release|Any CPU = Release|Any CPU
8 | EndGlobalSection
9 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
10 | EndGlobalSection
11 | GlobalSection(SolutionProperties) = preSolution
12 | HideSolutionNode = FALSE
13 | EndGlobalSection
14 | EndGlobal
15 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/ParameterValue.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Adept.Input
10 | {
11 | ///
12 | /// Supplies a value to a parameter of an action.
13 | ///
14 | public class ParameterValue
15 | {
16 | public string Name { get; set; }
17 | public object Value { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/UnityCommon.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | C:\Program Files\Unity\Editor
4 | $(SolutionDir)Unity
5 | $(UnitySolutionDir)\Tools
6 | $(UnitySolutionDir)\Unprocessed
7 | $(UnitySolutionDir)\Players
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/ParameterDefinition.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Adept.Input
10 | {
11 | public class ParameterDefinition
12 | {
13 | public string Name { get; set; }
14 | public string Description { get; set; }
15 | public bool IsOptional { get; set; }
16 | public Type ParameterType { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/UnityCommon.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | C:\Program Files\Unity\Editor
4 | C:\Program Files\Unity\Editor\Data\PlaybackEngines\MetroSupport
5 | $(SolutionDir)Unity\Tools
6 | C:\Users\jbienz\Code\Microsoft\Adept\Samples\Unity\EditorSample
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.ApplicationInsights": "1.0.0",
4 | "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0",
5 | "Microsoft.ApplicationInsights.WindowsApps": "1.0.0",
6 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
7 | },
8 | "frameworks": {
9 | "uap10.0": {}
10 | },
11 | "runtimes": {
12 | "win10-arm": {},
13 | "win10-arm-aot": {},
14 | "win10-x86": {},
15 | "win10-x86-aot": {},
16 | "win10-x64": {},
17 | "win10-x64-aot": {}
18 | }
19 | }
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.ApplicationInsights": "1.0.0",
4 | "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0",
5 | "Microsoft.ApplicationInsights.WindowsApps": "1.0.0",
6 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
7 | "MvvmLightLibs": "5.2.0"
8 | },
9 | "frameworks": {
10 | "uap10.0": {}
11 | },
12 | "runtimes": {
13 | "win10-arm": {},
14 | "win10-arm-aot": {},
15 | "win10-x86": {},
16 | "win10-x86-aot": {},
17 | "win10-x64": {},
18 | "win10-x64-aot": {}
19 | }
20 | }
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Controls/Scripts/ListBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 |
5 | namespace Adept.Unity
6 | {
7 | ///
8 | /// Contains a list of selectable items.
9 | ///
10 | [AddComponentMenu("UI/List Box", 40)]
11 | public class ListBox : Selector
12 | {
13 | // Use this for initialization
14 | private void Start()
15 | {
16 | base.Initialize();
17 | this.gameObject.SetActive(false);
18 | this.gameObject.SetActive(true);
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Utilities/Scripts/ResourceHelper.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 |
5 | namespace Adept.Unity
6 | {
7 | static public class ResourceHelper
8 | {
9 | static private Font defaultFont;
10 |
11 | static public Font GetDefaultFont()
12 | {
13 | // Get default
14 | if (defaultFont == null)
15 | {
16 | defaultFont = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf");
17 | }
18 |
19 | //// Return clone
20 | //return (Font)UnityEngine.Object.Instantiate(defaultFont);
21 | return defaultFont;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Views/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/UnityLib.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(UnityUnprocessedDir)\UnityEngine.dll
6 | False
7 |
8 |
9 | $(UnityUnprocessedDir)\WinRTLegacy.dll
10 | False
11 |
12 |
13 | $(UnityUnprocessedDir)\UnityEngine.UI.dll
14 | False
15 |
16 |
17 | $(UnityUnprocessedDir)\UnityEngine.Networking.dll
18 | False
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/DefaultTextConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using Windows.UI.Xaml.Data;
5 |
6 | namespace Adept.Unity
7 | {
8 | ///
9 | /// A converter that provides a value by calling value.ToString.
10 | ///
11 | public class DefaultTextConverter : IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, string language)
14 | {
15 | return value != null ? value.ToString() : string.Empty;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, string language)
19 | {
20 | throw new NotImplementedException();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Utilities/Scripts/CopyExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine.UI;
4 |
5 | namespace Adept.Unity
6 | {
7 | static public class CopyExtensions
8 | {
9 | static public void CopyTo(this LayoutElement source, LayoutElement target)
10 | {
11 | if ((source == null) || (target == null)) { return; }
12 |
13 | target.enabled = source.enabled;
14 | target.flexibleHeight = source.flexibleHeight;
15 | target.flexibleWidth = source.flexibleWidth;
16 | target.ignoreLayout = source.ignoreLayout;
17 | target.minHeight = source.minHeight;
18 | target.minWidth = source.minWidth;
19 | target.preferredHeight = source.preferredHeight;
20 | target.preferredWidth = source.preferredWidth;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/DefaultTextBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 | using UnityEngine.UI;
5 |
6 | namespace Adept.Unity
7 | {
8 | ///
9 | /// A binding between a data item and a UI control.
10 | ///
11 | ///
12 | /// This binding uses a by default.
13 | ///
14 | public class DefaultTextBinding : BindingBase
15 | {
16 | #region Inspector Items
17 | [Tooltip("The text control that will represent the item.")]
18 | public Text text;
19 | #endregion // Inspector Items
20 |
21 | private void Start()
22 | {
23 | Converter = new DefaultTextConverter();
24 | TargetMemberName = "text";
25 | Target = text;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Utilities/Scripts/Environment.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | #if WINDOWS_UWP
4 | using Windows.System.Profile;
5 | #endif
6 |
7 | namespace Adept
8 | {
9 | ///
10 | /// Provides information about the environment in which the application is running.
11 | ///
12 | static public class Environment
13 | {
14 | ///
15 | /// Gets a value that indicates if the application is running on a holographic
16 | /// computing device such as the HoloLens.
17 | ///
18 | static public bool IsHolographic
19 | {
20 | get
21 | {
22 | #if WINDOWS_UWP
23 | return AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Holographic";
24 | #else
25 | return false;
26 | #endif
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/TargetedBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 |
5 | namespace Adept.Unity
6 | {
7 | ///
8 | /// Represents a binding where the target is known and shouldn't be displayed in the inspector.
9 | ///
10 | public abstract class TargetedBinding : BindingBase
11 | {
12 | #region Serialized Variables
13 | [SerializeField]
14 | [Tooltip("The name of the source member (property or field) that will participate in the binding.")]
15 | private string _sourceMemberName; // Inspector only.
16 | #endregion // Serialized Variables
17 |
18 | #region Overrides / Event Handlers
19 | protected override void Awake()
20 | {
21 | // Convert inspector values to property values
22 | SourceMemberName = _sourceMemberName;
23 |
24 | // Pass to base
25 | base.Awake();
26 | }
27 | #endregion // Overrides / Event Handlers
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/Actions/SyncAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Adept.StateSync
10 | {
11 | ///
12 | /// The interface for a single action to apply as part of a synchronization message.
13 | ///
14 | public interface ISyncAction
15 | {
16 | ///
17 | /// Applies the action to the specified target.
18 | ///
19 | ///
20 | /// The target where the action will be applied.
21 | ///
22 | ///
23 | /// A that represents the operation.
24 | ///
25 | Task ApplyAsync(object target);
26 | }
27 |
28 | ///
29 | /// Represents a single action to apply as part of a synchronization message.
30 | ///
31 | public abstract class SyncAction : ISyncAction
32 | {
33 | ///
34 | public abstract Task ApplyAsync(object target);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Utilities/Scripts/ThreadExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 |
5 | namespace Adept
6 | {
7 | static public class ThreadExtensions
8 | {
9 | ///
10 | /// Ensures that the action is performed on the Unity Application thread.
11 | ///
12 | ///
13 | /// The action to perform.
14 | ///
15 | ///
16 | /// If the current thread is already the App thread the action will be executed
17 | /// inline. Otherwise, the action will be scheduled using InvokeOnAppThread.
18 | ///
19 | static public void RunOnAppThread(Action action)
20 | {
21 | if (UnityEngine.WSA.Application.RunningOnAppThread())
22 | {
23 | action();
24 | }
25 | else
26 | {
27 | UnityEngine.WSA.Application.InvokeOnAppThread(()=>action(), false);
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/License/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
2 |
3 | The MIT License (MIT)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/Strategies/PropertyStrategyAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Adept.StateSync
11 | {
12 | ///
13 | /// Base class for synchronization strategies that apply to properties.
14 | ///
15 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
16 | public abstract class PropertyStrategyAttribute : Attribute
17 | {
18 | ///
19 | /// Adds custom actions to the message.
20 | ///
21 | ///
22 | /// The message where actions are added.
23 | ///
24 | ///
25 | /// The source object where the strategy is applied.
26 | ///
27 | ///
28 | /// The property that the strategy is applied to.
29 | ///
30 | public abstract void AddActions(SyncMessage message, object source, PropertyInfo property);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/SyncMessage.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using Newtonsoft.Json;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Adept.StateSync
11 | {
12 | ///
13 | /// Represents a network synchronization message which can include one or more actions to apply.
14 | ///
15 | [JsonObject(Id = "Sync")]
16 | public class SyncMessage
17 | {
18 | #region Member Variables
19 | private List actions = new List();
20 | #endregion // Member Variables
21 |
22 | #region Public Properties
23 | ///
24 | /// Gets the list of actions to be applied as part of the synchronization.
25 | ///
26 | [JsonProperty("actions")]
27 | public List Actions => actions;
28 |
29 | ///
30 | /// Gets or sets the ID of the object being synchronized.
31 | ///
32 | [JsonProperty("syncId")]
33 | public string SyncId { get; set; }
34 | #endregion // Public Properties
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("EditorSample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("DefaultCompany")]
12 | [assembly: AssemblyProduct("EditorSample")]
13 | [assembly: AssemblyCopyright("Copyright © DefaultCompany 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Observable/Scripts/INotifyCollectionChanged.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | #if !WINDOWS_UWP
4 | namespace System.Collections.Specialized
5 | {
6 | ///
7 | /// Represents the method that handles the event.
8 | ///
9 | ///
10 | /// The object that raised the event.
11 | ///
12 | ///
13 | /// Information about the event.
14 | ///
15 | public delegate void NotifyCollectionChangedEventHandler(object sender, NotifyCollectionChangedEventArgs e);
16 |
17 | ///
18 | /// Notifies listeners of dynamic changes, such as when items get added and removed or the whole list is refreshed.
19 | ///
20 | public interface INotifyCollectionChanged
21 | {
22 | #region Public Events
23 | ///
24 | /// Occurs when the collection changes.
25 | ///
26 | event NotifyCollectionChangedEventHandler CollectionChanged;
27 | #endregion // Public Events
28 | }
29 | }
30 | #endif // !WINDOWS_UWP
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System.Reflection;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("InputSample")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("InputSample")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System.Reflection;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Adept.Input")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Adept.Input")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Lib/UWP/Adept.UnityXaml/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System.Reflection;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Adept.UnityXaml")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Adept.UnityXaml")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System.Reflection;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Adept.StateSync")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Adept.StateSync")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/Strategies/SynchronizeValueAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Adept.StateSync
11 | {
12 | ///
13 | /// A strategy for synchronizing the raw property value.
14 | ///
15 | public class SynchronizeValueAttribute : PropertyStrategyAttribute
16 | {
17 | ///
18 | public override void AddActions(SyncMessage message, object source, PropertyInfo property)
19 | {
20 | // Validate
21 | if (message == null) throw new ArgumentNullException(nameof(message));
22 | if (source == null) throw new ArgumentNullException(nameof(source));
23 | if (property == null) throw new ArgumentNullException(nameof(property));
24 |
25 | // Create the action
26 | var action = new SetPropertyAction()
27 | {
28 | PropertyName = property.Name,
29 | Value = property.GetValue(source),
30 | };
31 |
32 | // Add it to the message
33 | message.Actions.Add(action);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/UnityAppLib.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | False
6 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\UnityPlayer.winmd
7 |
8 |
9 | False
10 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\WinRTBridge.winmd
11 |
12 |
13 | False
14 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\BridgeInterface.winmd
15 |
16 |
17 | False
18 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\UnityEngineDelegates.winmd
19 |
20 |
21 | False
22 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\UnityEngineProxy.dll
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Views/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using InputSample.ViewModels;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Runtime.InteropServices.WindowsRuntime;
9 | using Windows.Foundation;
10 | using Windows.Foundation.Collections;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
20 |
21 | namespace InputSample.Views
22 | {
23 | ///
24 | /// An empty page that can be used on its own or navigated to within a Frame.
25 | ///
26 | public sealed partial class MainPage : Page
27 | {
28 | private MainViewModel vm;
29 |
30 | public MainPage()
31 | {
32 | this.InitializeComponent();
33 | vm = (MainViewModel)DataContext;
34 | this.Loaded += MainPage_Loaded;
35 | }
36 |
37 | private void MainPage_Loaded(object sender, RoutedEventArgs e)
38 | {
39 | vm.SetupInput();
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Adept.UnityXaml;
2 | using System;
3 | using System.Collections;
4 | using Windows.UI.Popups;
5 | using Windows.UI.Xaml;
6 | using Windows.UI.Xaml.Controls;
7 |
8 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
9 |
10 | namespace EditorSample
11 | {
12 | ///
13 | /// An empty page that can be used on its own or navigated to within a Frame.
14 | ///
15 | public sealed partial class MainPage : Page
16 | {
17 | public MainPage()
18 | {
19 | this.InitializeComponent();
20 | }
21 |
22 | private async void CubeButton_Click(object sender, RoutedEventArgs e)
23 | {
24 | await UnityHelpers.LoadSceneAsync("CubeScene");
25 | await new MessageDialog("Loaded").ShowAsync();
26 | }
27 |
28 | private IEnumerator DoSomething()
29 | {
30 | UnityEngine.Debug.Log("Starting Wait...");
31 | yield return new UnityEngine.WaitForSeconds(5);
32 | UnityEngine.Debug.Log("Done with Wait...");
33 | }
34 |
35 | private async void Sphere_Click(object sender, RoutedEventArgs e)
36 | {
37 | await UnityHelpers.LoadSceneAsync("SphereScene");
38 | await new MessageDialog("Loaded").ShowAsync();
39 | await UnityBridge.Instance.InvokeAsync(()=> DoSomething());
40 | await new MessageDialog("Did Something").ShowAsync();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.UnityXaml/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
28 |
29 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/ValueChangingEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | namespace Adept.Unity
9 | {
10 | ///
11 | /// Provides the data for methods that handle values changing.
12 | ///
13 | ///
14 | /// The type of value that is changing.
15 | ///
16 | public class ValueChangingEventArgs : EventArgs
17 | {
18 | #region Constructors
19 | ///
20 | /// Initializes a new instance.
21 | ///
22 | ///
23 | /// The old value.
24 | ///
25 | ///
26 | /// The new value.
27 | ///
28 | public ValueChangingEventArgs(TValue oldValue, TValue newValue)
29 | {
30 | OldValue = oldValue;
31 | NewValue = newValue;
32 | }
33 | #endregion // Constructors
34 |
35 | #region Public Properties
36 | ///
37 | /// Gets the old value.
38 | ///
39 | public TValue OldValue { get; private set; }
40 |
41 | ///
42 | /// Gets the new value.
43 | ///
44 | public TValue NewValue { get; private set; }
45 | #endregion // Public Properties
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/UnityOverwrite.txt:
--------------------------------------------------------------------------------
1 | # Generated by Unity
2 | # Contains a list of files, that will not be overwritten by Unity, if modifield
3 | # Change hash to word 'overwrite' (without qoutes) to force it's overwrite
4 | # Delete line for file to restore it's hash and control overwrite since then
5 | # Write a line equal to 'overwrite-all' (without quotes) to overwrite everything (preserved accross builds)
6 | # Write a line equal to 'keep-all' (without quotes) to keep files regardless their modification (preserved accross builds)
7 | # Default behavior is to never overwrite files
8 | EditorSample\App.xaml: C0490BF8E77B223D616BFEED3CEC7676
9 | EditorSample\App.xaml.cs: F88F2901C2A967ED12EB29D577C159B8
10 | EditorSample\EditorSample.csproj: 0395E1C430C56753121ADCCC5597DE38
11 | EditorSample\EditorSample.csproj.user: 17684EBCF290AB966069C0E3031F6A64
12 | EditorSample\MainPage.xaml: FFA1224FF4E43C337F1DEA776E8591DE
13 | EditorSample\MainPage.xaml.cs: E36F4E2AFB7B3710F83D79BDD928FE60
14 | EditorSample\Package.appxmanifest: 8EAA642F4E15450B5B656F969BCEB2EA
15 | EditorSample\Assets\SplashScreen.scale-200.png: 891DE77A01089F354E2A956A744224AE
16 | EditorSample\Assets\Square150x150Logo.scale-200.png: E02834B4A5DFB97FF8E212C1CACBB084
17 | EditorSample\Assets\Square44x44Logo.scale-200.png: 6C6EF27184ABE9D870A9D564953775DE
18 | EditorSample\Assets\Square44x44Logo.targetsize-24_altform-unplated.png: 156637F7B5363E983E7A46D8E533A23D
19 | EditorSample\Assets\StoreLogo.png: 90BD194CA4A7CFFF3E8B8222229857FB
20 | EditorSample\Assets\Wide310x150Logo.scale-200.png: C96846A80DF667F87355569CD816192D
21 | EditorSample\Properties\AssemblyInfo.cs: F810EBC668DDA726D929D9F3A8F9B5CA
22 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Controls/Scripts/SelectionChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System.Collections;
4 |
5 | namespace Adept.Unity
6 | {
7 | ///
8 | /// Provides data for the event.
9 | ///
10 | public class SelectionChangedEventArgs
11 | {
12 | #region Constructors
13 | ///
14 | /// Initializes a new instance of the class.
15 | ///
16 | ///
17 | /// The items that were unselected during this event.
18 | ///
19 | ///
20 | /// The items that were selected during this event.
21 | ///
22 | public SelectionChangedEventArgs(IList removedItems, IList addedItems)
23 | {
24 | RemovedItems = (removedItems ?? new ArrayList());
25 | AddedItems = (addedItems ?? new ArrayList());
26 | }
27 | #endregion // Constructors
28 |
29 | #region Public Properties
30 | ///
31 | /// Gets a list of items that were selected during this event.
32 | ///
33 | public IList AddedItems { get; private set; }
34 |
35 | ///
36 | /// Gets a list of items that were unselected during this event.
37 | ///
38 | public IList RemovedItems { get; private set; }
39 | #endregion // Public Properties
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/DataBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 |
5 | namespace Adept.Unity
6 | {
7 | ///
8 | /// Represents a binding between a data item and another item.
9 | ///
10 | [AddComponentMenu("Binding/Data Binding", 51)]
11 | public class DataBinding : BindingBase
12 | {
13 | #region Serialized Variables
14 | [SerializeField]
15 | [Tooltip("The name of the source member (property or field) that will participate in the binding.")]
16 | private string _sourceMemberName; // Inspector only.
17 |
18 | [SerializeField]
19 | [Tooltip("The item that is the target of the binding.")]
20 | private Component _target; // Inspector only. Stored as Object in Source property during Initialize
21 |
22 | [SerializeField]
23 | [Tooltip("The name of the target member (property or field) that will participate in the binding.")]
24 | private string _targetMemberName; // Inspector only.
25 | #endregion // Serialized Variables
26 |
27 | #region Overrides / Event Handlers
28 | protected override void Awake()
29 | {
30 | // Convert inspector values to property values
31 | SourceMemberName = _sourceMemberName;
32 | TargetMemberName = _targetMemberName;
33 | Target = _target;
34 |
35 | // Pass to base
36 | base.Awake();
37 | }
38 | #endregion // Overrides / Event Handlers
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/WinRTBridge/Properties/WinRTBridge.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Unity/Players/UAP/ARM/master/UnityEngineProxy/Properties/UnityEngineProxy.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/Actions/SetPropertyAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using Newtonsoft.Json;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Reflection;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace Adept.StateSync
12 | {
13 | ///
14 | /// A synchronization action that sets a property.
15 | ///
16 | [JsonObject(Id = "SetProperty")]
17 | public class SetPropertyAction : SyncAction
18 | {
19 | #region Public Methods
20 | ///
21 | public override Task ApplyAsync(object target)
22 | {
23 | // Validate
24 | if (target == null) throw new ArgumentNullException(nameof(target));
25 | if (string.IsNullOrEmpty(PropertyName)) throw new ArgumentException(nameof(PropertyName));
26 |
27 | // Get the property
28 | var property = target.GetType().GetProperty(PropertyName);
29 |
30 | // Set the property
31 | property.SetValue(target, Value);
32 |
33 | // Done
34 | return Task.CompletedTask;
35 | }
36 | #endregion // Public Methods
37 |
38 | #region Public Properties
39 | ///
40 | /// Gets or sets the name of the property to set.
41 | ///
42 | [JsonProperty("name")]
43 | public string PropertyName { get; set; }
44 |
45 | ///
46 | /// Gets or sets the value to set for the property.
47 | ///
48 | [JsonProperty("value")]
49 | public object Value { get; set; }
50 | #endregion // Public Properties
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/ItemsSourceBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 | using UnityEngine.EventSystems;
5 |
6 | namespace Adept.Unity
7 | {
8 | ///
9 | /// Represents a binding between a data item and a UI Control.
10 | ///
11 | [AddComponentMenu("Binding/ItemsSource Binding", 54)]
12 | public class ItemsSourceBinding : TargetedBinding
13 | {
14 | #region Inspector Items
15 | [SerializeField]
16 | [Tooltip("The ItemsControl that will participate in the binding. (Required)")]
17 | private ItemsControl itemsControl;
18 | #endregion // Inspector Items
19 |
20 | #region Overrides / Event Handlers
21 | protected override void Awake()
22 | {
23 | // Set known member names
24 | TargetMemberName = "ItemsSource";
25 |
26 | // Convert inspector values to property values
27 | Target = itemsControl;
28 |
29 | // Pass to base
30 | base.Awake();
31 | }
32 | #endregion // Overrides / Event Handlers
33 |
34 | #region Public Properties
35 | ///
36 | /// Gets or sets the that will participate in the binding.
37 | ///
38 | public ItemsControl ItemsControl
39 | {
40 | get
41 | {
42 | return itemsControl;
43 | }
44 | set
45 | {
46 | itemsControl = value;
47 | }
48 | }
49 | #endregion // Public Properties
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | InputSample
18 | jbienz
19 | Assets\StoreLogo.png
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/Properties/Adept.StateSync.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.UnityXaml/Properties/Adept.UnityXaml.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/IInputAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Adept.Input
10 | {
11 | ///
12 | /// An action that can be triggered by a form of input.
13 | ///
14 | public interface IInputAction
15 | {
16 | #region Public Methods
17 | ///
18 | /// Invokes the action.
19 | ///
20 | ///
21 | /// The result of the action.
22 | ///
23 | object Invoke();
24 | #endregion // Public Methods
25 |
26 | #region Public Properties
27 | ///
28 | /// Gets or sets a value that indicates if the trigger is enabled.
29 | ///
30 | bool IsEnabled { get; set; }
31 |
32 | ///
33 | /// The name of the action.
34 | ///
35 | string Name { get; }
36 |
37 | ///
38 | /// A description of the action.
39 | ///
40 | string Description { get; }
41 |
42 | ///
43 | /// Gets a list of the parameters associated with the action.
44 | ///
45 | IReadOnlyList Parameters { get; }
46 |
47 | ///
48 | /// Gets the type of value returned by the action.
49 | ///
50 | Type ReturnType { get; }
51 |
52 | ///
53 | /// Gets or sets the collection of values that will be used when executing the action.
54 | ///
55 | ParameterValueSet Values { get; set; }
56 | #endregion // Public Properties
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EditorSample
7 | DefaultCompany
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/ControlBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 | using UnityEngine.EventSystems;
5 |
6 | namespace Adept.Unity
7 | {
8 | ///
9 | /// Represents a binding between a data item and a UI Control.
10 | ///
11 | [AddComponentMenu("Binding/Control Binding", 52)]
12 | public class ControlBinding : TargetedBinding
13 | {
14 | #region Serialized Variables
15 | [SerializeField]
16 | [Tooltip("The target control that will participate in the binding.")]
17 | private UIBehaviour control;
18 |
19 | [SerializeField]
20 | [Tooltip("The name of the target member (property or field) that will participate in the binding.")]
21 | private string _targetMemberName; // Inspector only.
22 | #endregion // Serialized Variables
23 |
24 | #region Overrides / Event Handlers
25 | protected override void Awake()
26 | {
27 | // Convert inspector values to property values
28 | TargetMemberName = _targetMemberName;
29 | Target = control;
30 |
31 | // Pass to base
32 | base.Awake();
33 | }
34 | #endregion // Overrides / Event Handlers
35 |
36 | #region Public Properties
37 | ///
38 | /// Gets or sets the target control that will participate in the binding.
39 | ///
40 | public UIBehaviour Control
41 | {
42 | get
43 | {
44 | return control;
45 | }
46 | set
47 | {
48 | if (control != value)
49 | {
50 | control = value;
51 | Target = value;
52 | }
53 | }
54 | }
55 | #endregion // Public Properties
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/ConvertableValueConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using Windows.UI.Xaml.Data;
5 |
6 | namespace Adept.Unity
7 | {
8 | ///
9 | /// A value converter that attempts to convert values using the interface.
10 | ///
11 | public class ConvertableValueConverter : IValueConverter
12 | {
13 | static private IFormatProvider TryGetFormatProvider(string language)
14 | {
15 | // Placeholder
16 | IFormatProvider provider = null;
17 |
18 | // Must have a language
19 | if (!string.IsNullOrEmpty(language))
20 | {
21 | // Try to load a culture
22 | try
23 | {
24 | provider = new System.Globalization.CultureInfo(language);
25 | }
26 | catch (Exception) { }
27 | }
28 |
29 | // Done
30 | return provider;
31 | }
32 |
33 | public object Convert(object value, Type targetType, object parameter, string language)
34 | {
35 | var provider = TryGetFormatProvider(language);
36 | if (provider != null)
37 | {
38 | return System.Convert.ChangeType(value, targetType, provider);
39 | }
40 | else
41 | {
42 | return System.Convert.ChangeType(value, targetType);
43 | }
44 | }
45 |
46 | public object ConvertBack(object value, Type targetType, object parameter, string language)
47 | {
48 | var provider = TryGetFormatProvider(language);
49 | if (provider != null)
50 | {
51 | return System.Convert.ChangeType(value, targetType, provider);
52 | }
53 | else
54 | {
55 | return System.Convert.ChangeType(value, targetType);
56 | }
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/IValueConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | #if !WINDOWS_UWP
4 | using System;
5 | using System.Globalization;
6 |
7 | namespace Windows.UI.Xaml.Data
8 | {
9 | ///
10 | /// Exposes methods that allow modifying the data as it passes through the binding engine.
11 | ///
12 | public interface IValueConverter
13 | {
14 | ///
15 | /// Modifies the source data before passing it to the target for display in the UI.
16 | ///
17 | ///
18 | /// The source data being passed to the target.
19 | ///
20 | ///
21 | /// The of data expected by the target property.
22 | ///
23 | ///
24 | /// An optional parameter to be used in the converter logic.
25 | ///
26 | ///
27 | /// The language of the conversion.
28 | ///
29 | ///
30 | /// The value to be passed to the target property.
31 | ///
32 | Object Convert(Object value, Type targetType, Object parameter, string language);
33 |
34 | ///
35 | /// Converts a value.
36 | ///
37 | ///
38 | /// The value that is produced by the binding target.
39 | ///
40 | ///
41 | /// The type to convert to.
42 | ///
43 | ///
44 | /// The converter parameter to use.
45 | ///
46 | ///
47 | /// The language of the conversion.
48 | ///
49 | ///
50 | /// A converted value.
51 | ///
52 | Object ConvertBack(Object value, Type targetType, Object parameter, string language);
53 | }
54 | }
55 | #endif // !WINDOWS_UWP
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/InputFieldBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 | using UnityEngine.UI;
5 |
6 | namespace Adept.Unity
7 | {
8 | ///
9 | /// A binding between a data item and an UI control.
10 | ///
11 | [AddComponentMenu("Binding/Input Field Binding", 53)]
12 | public class InputFieldBinding : TargetedBinding
13 | {
14 | #region Serialized Variables
15 | [SerializeField]
16 | [Tooltip("The input field that will participate in the binding.")]
17 | private InputField inputField;
18 | #endregion // Serialized Items
19 |
20 | #region Overrides / Event Handlers
21 | protected override void Awake()
22 | {
23 | // Set mode to bi-directional
24 | Mode = BindingMode.TwoWay;
25 |
26 | // Set the target member to text
27 | TargetMemberName = "text";
28 |
29 | // Set the target
30 | Target = inputField;
31 |
32 | if (inputField != null)
33 | {
34 | // Subscribe to character change
35 | inputField.onValueChanged.AddListener(OnInputChanged);
36 | }
37 |
38 | // Pass to base
39 | base.Awake();
40 | }
41 |
42 | private void OnInputChanged(string text)
43 | {
44 | if (Mode == BindingMode.TwoWay)
45 | {
46 | ApplyBinding(BindingDirection.TargetToSource);
47 | }
48 | }
49 | #endregion // Overrides / Event Handlers
50 |
51 | #region Public Properties
52 | ///
53 | /// Gets or sets the that will participate in the binding.
54 | ///
55 | public InputField InputField
56 | {
57 | get
58 | {
59 | return inputField;
60 | }
61 | set
62 | {
63 | inputField = value;
64 | }
65 | }
66 | #endregion // Public Properties
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/UnityApp.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | False
9 | .\UnityEngine.dll
10 | True
11 |
12 |
13 | False
14 | .\WinRTLegacy.dll
15 | True
16 |
17 |
18 | False
19 | .\UnityEngine.UI.dll
20 | True
21 |
22 |
23 | False
24 | .\UnityEngine.Networking.dll
25 | True
26 |
27 |
28 |
29 |
30 | False
31 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\UnityPlayer.winmd
32 | True
33 |
34 |
35 | False
36 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\WinRTBridge.winmd
37 | True
38 |
39 |
40 | False
41 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\BridgeInterface.winmd
42 | True
43 |
44 |
45 | False
46 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\UnityEngineDelegates.winmd
47 | True
48 |
49 |
50 | False
51 | $(UnityPlayersDir)\UAP\$(PlatformTarget)\$(Configuration)\UnityEngineProxy.dll
52 | True
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Overview
2 | Adept is a library for helping code adapt to different devices and environments running the Universal Windows Platform. Adept is especially designed to help share code between Xaml applications and HoloLens applications running Unity 3D.
3 |
4 | Adept was designed with the following scenarios in mind:
5 |
6 | ## Reach ##
7 | 
8 | Share as much code as possible between the XAML world and the Unity 3D world to enable write-once code that runs across all devices.
9 |
10 | ## Companion Device ##
11 | 
12 | Synchronizing state between an app running on HoloLens and an app running XAML on a phone or tablet to enable "companion" scenarios.
13 |
14 | ## Shared Experience ##
15 | 
16 | Synchronizing state between an app running on two or more HoloLenses to allow multiple users to share an app experience.
17 |
18 |
19 | # Components
20 | Adept offers several key components that help deliver the scenarios outlined above.
21 |
22 | ## Xaml Unity "Control" ##
23 | 
24 | Allows an entire Unity application to be run as an "island" within a XAMl application. Full interaction is supported between the two environments including the ability to run Unity coroutines in the XAML app and treat them as awaitable Tasks. Unity AsyncActions are also converted to Tasks that supply progress reports to the hosting xaml application.
25 |
26 | ## Unity Data Binding and Templates ##
27 | 
28 | Adept offers full two-way data binding for Unity UI and even allows XAML-like data templates in Unity using prefabs. The binding system is also extensible so leveraging Unity UI isn't a requirement. For example, a custom binder might monitor a string property and use it to load a named model. These features allows the MVVM pattern to be used in Unity and allows ViewModels (and therefore scenarios) to be shared with XAML apps. To see this feature in action, check out [this video](https://youtu.be/MrZd3Ldks14).
29 |
30 | ## Unified Input ##
31 | 
32 | Unity provides a fairly flexible input system out of the box for mouse, keyboard and gamepad, but this input system doesn't doesn't work in XAML apps. Adepts unified input system goes beyond what Unity offers to convert mouse, keyboard, gamepad, speech and even gestures into actions that can be carried out in Unity *and* the Xaml world.
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Gamepad/GamepadMapper.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Windows.Gaming.Input;
9 | using Windows.System;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Input;
12 |
13 | namespace Adept.Input
14 | {
15 | ///
16 | /// A class that maps input to application actions.
17 | ///
18 | public class GamepadMapper
19 | {
20 |
21 |
22 | ///
23 | /// Processes a KeyDown event which may include a GamePad virtual key.
24 | ///
25 | ///
26 | /// The sender of the event.
27 | ///
28 | ///
29 | /// A which contains the event data.
30 | ///
31 | public void ProcessKeyDown(object sender, KeyRoutedEventArgs e)
32 | {
33 |
34 | }
35 |
36 | ///
37 | /// Processes a KeyUp event which may include a GamePad virtual key.
38 | ///
39 | ///
40 | /// The sender of the event.
41 | ///
42 | ///
43 | /// A which contains the event data.
44 | ///
45 | public void ProcessKeyUp(object sender, KeyRoutedEventArgs e)
46 | {
47 |
48 | }
49 |
50 | ///
51 | /// Subscribes to related events on the specified control.
52 | ///
53 | ///
54 | /// The control supplying the events.
55 | ///
56 | public void SubscribeEvents(Control control)
57 | {
58 | control.KeyDown += ProcessKeyDown;
59 | control.KeyUp += ProcessKeyUp;
60 | }
61 |
62 | ///
63 | /// Unsubscribes from related events on the specified control.
64 | ///
65 | ///
66 | /// The control supplying the events.
67 | ///
68 | public void UnsubscribeEvents(Control control)
69 | {
70 | control.KeyDown -= ProcessKeyDown;
71 | control.KeyUp -= ProcessKeyUp;
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/InputMap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Collections.Specialized;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Microsoft.Adept.Input
10 | {
11 | ///
12 | /// Maps one or more triggers to an action.
13 | ///
14 | public class InputMap
15 | {
16 | #region Member Variables
17 | private ObservableCollection triggers;
18 | #endregion // Member Variables
19 |
20 | public InputMap()
21 | {
22 | triggers = new ObservableCollection();
23 | triggers.CollectionChanged += Triggers_CollectionChanged;
24 | }
25 |
26 | private void Triggers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
27 | {
28 | switch (e.Action)
29 | {
30 | case NotifyCollectionChangedAction.Add:
31 | foreach (IInputTrigger t in e.NewItems)
32 | {
33 | t.Fired += Trigger_Fired;
34 | }
35 | break;
36 | case NotifyCollectionChangedAction.Remove:
37 | foreach (IInputTrigger t in e.OldItems)
38 | {
39 | t.Fired -= Trigger_Fired;
40 | }
41 | break;
42 | case NotifyCollectionChangedAction.Reset:
43 | // TODO: Support Clear
44 | throw new InvalidOperationException();
45 | // break;
46 | }
47 | }
48 |
49 | private void Trigger_Fired(object sender, EventArgs e)
50 | {
51 | // Make sure we have an action
52 | if (Action == null)
53 | {
54 | throw new InvalidOperationException("Action is not specified.");
55 | }
56 |
57 | // Cast
58 | IInputTrigger trigger = (IInputTrigger)sender;
59 |
60 | // Invoke action
61 | Action.Invoke(trigger.Values);
62 | }
63 |
64 | #region Public Properties
65 | ///
66 | /// Gets or sets the action that will be invoked when any of the triggers fire.
67 | ///
68 | public IInputAction Action { get; set; }
69 |
70 | ///
71 | /// Gets the collection of triggers that can invoke the action.
72 | ///
73 | public Collection Triggers => triggers;
74 | #endregion // Public Properties
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/DataContext.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel;
6 | using UnityEngine;
7 |
8 | namespace Adept.Unity
9 | {
10 | ///
11 | /// Represents the source of data for multiple bindings.
12 | ///
13 | [AddComponentMenu("Binding/Data Context", 50)]
14 | public class DataContext : MonoBehaviour
15 | {
16 | #region Member Variables
17 | private List bindings = new List();
18 | private object source;
19 | #endregion // Member Variables
20 |
21 | #region Internal Methods
22 | private void InnerSourceChanged(object source)
23 | {
24 | // Update all registered bindings
25 | lock (bindings)
26 | {
27 | foreach (var binding in bindings)
28 | {
29 | binding.HandleSourceChanged(source);
30 | }
31 | }
32 | }
33 | #endregion // Internal Methods
34 |
35 | #region Public Methods
36 | [EditorBrowsable(EditorBrowsableState.Never)]
37 | public void RegisterBinding(BindingBase binding)
38 | {
39 | if (binding == null) throw new ArgumentNullException("binding");
40 | lock (bindings)
41 | {
42 | if (!bindings.Contains(binding))
43 | {
44 | bindings.Add(binding);
45 | }
46 | }
47 | }
48 |
49 | [EditorBrowsable(EditorBrowsableState.Never)]
50 | public void UnregisterBinding(BindingBase binding)
51 | {
52 | if (binding == null) throw new ArgumentNullException("binding");
53 | lock (bindings)
54 | {
55 | bindings.Remove(binding);
56 | }
57 | }
58 | #endregion // Public Methods
59 |
60 | #region Public Properties
61 | ///
62 | /// Gets or sets the source of data for the data context.
63 | ///
64 | public object Source
65 | {
66 | get
67 | {
68 | return source;
69 | }
70 | set
71 | {
72 | if (value != source)
73 | {
74 | InnerSourceChanged(value);
75 | source = value;
76 | }
77 | }
78 | }
79 | #endregion // Public Properties
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.UnityXaml/UnityHelpers.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using UnityEngine.SceneManagement;
9 |
10 | namespace Adept.UnityXaml
11 | {
12 | ///
13 | /// Helper methods for working with Unity.
14 | ///
15 | static public class UnityHelpers
16 | {
17 | #region Member Variables
18 | static private UnityBridge bridge;
19 | #endregion // Member Variables
20 |
21 | #region Constructors
22 | ///
23 | /// Initializes
24 | ///
25 | static UnityHelpers()
26 | {
27 | bridge = UnityBridge.Instance;
28 | }
29 | #endregion // Constructors
30 |
31 | #region Public Methods
32 | ///
33 | /// Loads the scene with the specified name.
34 | ///
35 | ///
36 | /// The name of the scene to load.
37 | ///
38 | ///
39 | /// An optional progress handler to receive notifications during the load.
40 | ///
41 | ///
42 | /// A that represents the operation.
43 | ///
44 | static public Task LoadSceneAsync(string sceneName, IProgress progress = null)
45 | {
46 | // Validate
47 | if (string.IsNullOrEmpty(sceneName)) throw new ArgumentException(nameof(sceneName));
48 | ValidateInitialized();
49 |
50 | // HACK: SceneManager.LoadSceneAsync never completes. Instead it gets to 90%. This is a known issue.
51 | // http://answers.unity3d.com/questions/1073557/additively-loaded-scene-gets-stuck-at-90-even-if-a.html#answer-1073667
52 |
53 | // Execute
54 | return bridge.InvokeAsync(() =>SceneManager.LoadSceneAsync(sceneName), progressCompleteOverride: 0.9f);
55 | }
56 |
57 | ///
58 | /// Validates that the has been initialized.
59 | ///
60 | static public void ValidateInitialized()
61 | {
62 | if (!bridge.IsInitialized)
63 | {
64 | throw new InvalidOperationException("This operation is not valid until Unity has completed initialization. Subscribe to the UnityBridge.Initialized event or await on UnityBridge.InitializedTask before calling this function.");
65 | }
66 | }
67 | #endregion // Public Methods
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/IInputTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Windows.Foundation;
7 |
8 | namespace Microsoft.Adept.Input
9 | {
10 | /*
11 | ///
12 | /// The base interface for an input trigger.
13 | ///
14 | public interface IInputTriggerBase
15 | {
16 | #region Public Properties
17 | ///
18 | /// Gets or sets a value that indicates if the trigger is enabled.
19 | ///
20 | bool IsEnabled { get; set; }
21 |
22 | ///
23 | /// The name of the action.
24 | ///
25 | string Name { get; }
26 |
27 | ///
28 | /// A description of the action.
29 | ///
30 | string Description { get; }
31 | #endregion // Public Properties
32 | }*/
33 |
34 | ///
35 | /// The interface for a class that can trigger an input action.
36 | ///
37 | public interface IInputTrigger
38 | {
39 | #region Public Properties
40 | ///
41 | /// Gets or sets a value that indicates if the trigger is enabled.
42 | ///
43 | bool IsEnabled { get; set; }
44 |
45 | ///
46 | /// The name of the action.
47 | ///
48 | string Name { get; }
49 |
50 | ///
51 | /// A description of the action.
52 | ///
53 | string Description { get; }
54 |
55 | ///
56 | /// Gets the list of values provided by the trigger.
57 | ///
58 | ParameterValueSet Values { get; }
59 | #endregion // Public Properties
60 |
61 | #region Public Events
62 | ///
63 | /// Raised at the moment the trigger fires.
64 | ///
65 | event EventHandler Fired;
66 | #endregion // Public Events
67 | }
68 |
69 | /*
70 | ///
71 | /// An input trigger that provides custom data.
72 | ///
73 | ///
74 | /// The data provided by the trigger.
75 | ///
76 | public interface IInputTrigger : IInputTriggerBase
77 | {
78 | #region Public Events
79 | ///
80 | /// Raised at the moment the trigger starts.
81 | ///
82 | event TypedEventHandler, T> Started;
83 |
84 | ///
85 | /// Raised at the moment the trigger ends.
86 | ///
87 | event TypedEventHandler, T> Ended;
88 | #endregion // Public Events
89 | }
90 | */
91 | }
92 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Keyboard/KeyBinding.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Windows.System;
9 |
10 | namespace Adept.Input
11 | {
12 | ///
13 | /// Represents a binding between a keyboard key and an action.
14 | ///
15 | public class KeyBinding
16 | {
17 | #region Constructors
18 | ///
19 | /// Initializes a new instance.
20 | ///
21 | public KeyBinding()
22 | {
23 | IsEnabled = true;
24 | }
25 | #endregion // Constructors
26 |
27 | #region Public Properties
28 | ///
29 | /// Gets or sets the action that will be invoked when any of the triggers fire.
30 | ///
31 | public IInputAction Action { get; set; }
32 |
33 | ///
34 | /// Gets or sets a value that indicates if the binding is enabled.
35 | ///
36 | ///
37 | /// true if the binding is enabled; otherwise false. The default is true.
38 | ///
39 | public bool IsEnabled { get; set; }
40 |
41 | ///
42 | /// Gets or sets the involved in the binding.
43 | ///
44 | ///
45 | /// The involved in the binding.
46 | ///
47 | public VirtualKey Key { get; set; }
48 |
49 | ///
50 | /// Gets or sets the that must be pressed in combination with the key to satisfy the binding.
51 | ///
52 | ///
53 | /// The modifier.
54 | ///
55 | public VirtualKey Modifier { get; set; }
56 |
57 | ///
58 | /// Gets or sets a value that indicates if the action should be triggered when the key is released.
59 | ///
60 | ///
61 | /// true if the action should be triggered when the key is released; otherwise false. The default is false.
62 | ///
63 | public bool WhenReleased { get; set; }
64 |
65 | ///
66 | /// Gets or sets a value that indicates if the action should be triggered when the key is repeated.
67 | ///
68 | ///
69 | /// true if the action should be triggered when the key is repeated; otherwise false. The default is false.
70 | ///
71 | public bool WhenRepeated { get; set; }
72 | #endregion // Public Properties
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Utilities/Scripts/ReflectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using System.Reflection;
5 |
6 | namespace Adept
7 | {
8 | static internal class ReflectionExtensions
9 | {
10 | static public MemberInfo GetMemeber(this object obj, string memberName)
11 | {
12 | if ((obj == null) || (string.IsNullOrEmpty(memberName)))
13 | {
14 | return null;
15 | }
16 | else
17 | {
18 | MemberInfo member = obj.GetType().GetProperty(memberName);
19 | if (member == null)
20 | {
21 | member = obj.GetType().GetField(memberName);
22 | }
23 | return member;
24 | }
25 | }
26 |
27 | static public object GetValue(this MemberInfo member, object obj)
28 | {
29 | if ((member == null) || (obj == null)) { return null; }
30 |
31 | var prop = member as PropertyInfo;
32 | var field = member as FieldInfo;
33 |
34 | if (prop != null)
35 | {
36 | return prop.GetValue(obj, null);
37 | }
38 | else if (field != null)
39 | {
40 | return field.GetValue(obj);
41 | }
42 | else
43 | {
44 | throw new InvalidOperationException("Unknown MemberInfo type in GetValue");
45 | }
46 | }
47 |
48 | static public Type GetValueType(this MemberInfo member)
49 | {
50 | if (member == null) { return typeof(object); }
51 |
52 | var prop = member as PropertyInfo;
53 | var field = member as FieldInfo;
54 |
55 | if (prop != null)
56 | {
57 | return prop.PropertyType;
58 | }
59 | else if (field != null)
60 | {
61 | return field.FieldType;
62 | }
63 | else
64 | {
65 | throw new InvalidOperationException("Unknown MemberInfo type in GetValueType");
66 | }
67 | }
68 |
69 | static public void SetValue(this MemberInfo member, object obj, object value)
70 | {
71 | if ((member == null) || (obj == null)) { return; }
72 |
73 | var prop = member as PropertyInfo;
74 | var field = member as FieldInfo;
75 |
76 | if (prop != null)
77 | {
78 | prop.SetValue(obj, value, null);
79 | }
80 | else if (field != null)
81 | {
82 | field.SetValue(obj, value);
83 | }
84 | else
85 | {
86 | throw new InvalidOperationException("Unknown MemberInfo type in SetValue");
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.22512.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorSample", "EditorSample\EditorSample.csproj", "{13A45C13-3265-47B8-BC48-A553B569DF55}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|ARM = Debug|ARM
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Master|ARM = Master|ARM
14 | Master|x64 = Master|x64
15 | Master|x86 = Master|x86
16 | Release|ARM = Release|ARM
17 | Release|x64 = Release|x64
18 | Release|x86 = Release|x86
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|ARM.ActiveCfg = Debug|ARM
22 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|ARM.Build.0 = Debug|ARM
23 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|ARM.Deploy.0 = Debug|ARM
24 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|x64.ActiveCfg = Debug|x64
25 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|x64.Build.0 = Debug|x64
26 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|x64.Deploy.0 = Debug|x64
27 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|x86.ActiveCfg = Debug|x86
28 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|x86.Build.0 = Debug|x86
29 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Debug|x86.Deploy.0 = Debug|x86
30 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|ARM.ActiveCfg = Master|ARM
31 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|ARM.Build.0 = Master|ARM
32 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|ARM.Deploy.0 = Master|ARM
33 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|x64.ActiveCfg = Master|x64
34 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|x64.Build.0 = Master|x64
35 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|x64.Deploy.0 = Master|x64
36 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|x86.ActiveCfg = Master|x86
37 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|x86.Build.0 = Master|x86
38 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Master|x86.Deploy.0 = Master|x86
39 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|ARM.ActiveCfg = Release|ARM
40 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|ARM.Build.0 = Release|ARM
41 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|ARM.Deploy.0 = Release|ARM
42 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|x64.ActiveCfg = Release|x64
43 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|x64.Build.0 = Release|x64
44 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|x64.Deploy.0 = Release|x64
45 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|x86.ActiveCfg = Release|x86
46 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|x86.Build.0 = Release|x86
47 | {13A45C13-3265-47B8-BC48-A553B569DF55}.Release|x86.Deploy.0 = Release|x86
48 | EndGlobalSection
49 | GlobalSection(SolutionProperties) = preSolution
50 | HideSolutionNode = FALSE
51 | EndGlobalSection
52 | EndGlobal
53 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Binding/Scripts/ConverterBehaviour.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using UnityEngine;
5 | using Windows.UI.Xaml.Data;
6 |
7 | namespace Adept.Unity
8 | {
9 | ///
10 | /// An abstract base class for a behavior that implements .
11 | ///
12 | public abstract class ConverterBehaviour : MonoBehaviour, IValueConverter
13 | {
14 | ///
15 | /// Modifies the source data before passing it to the target for display in the UI.
16 | ///
17 | ///
18 | /// The source data being passed to the target.
19 | ///
20 | ///
21 | /// The of data expected by the target property.
22 | ///
23 | ///
24 | /// An optional parameter to be used in the converter logic.
25 | ///
26 | ///
27 | /// The language of the conversion.
28 | ///
29 | ///
30 | /// The value to be passed to the target property.
31 | ///
32 | public abstract object Convert(object value, Type targetType, object parameter, string language);
33 |
34 | ///
35 | /// Converts a value.
36 | ///
37 | ///
38 | /// The value that is produced by the binding target.
39 | ///
40 | ///
41 | /// The type to convert to.
42 | ///
43 | ///
44 | /// The converter parameter to use.
45 | ///
46 | ///
47 | /// The language of the conversion.
48 | ///
49 | ///
50 | /// A converted value.
51 | ///
52 | public abstract object ConvertBack(object value, Type targetType, object parameter, string language);
53 | }
54 |
55 | ///
56 | /// A class that wraps any IValueConverter as a behavior so it can be placed in the Unity scene tree.
57 | ///
58 | ///
59 | /// The actual type that implements IValueConverter.
60 | ///
61 | public class ConverterBehavior : ConverterBehaviour where TConverter : IValueConverter, new()
62 | {
63 | #region Member Variables
64 | private TConverter converter;
65 | #endregion // Member Variables
66 |
67 | #region Overrides / Event Handlers
68 | public override object Convert(object value, Type targetType, object parameter, string language)
69 | {
70 | if (converter == null) { converter = new TConverter(); }
71 | return converter.Convert(value, targetType, parameter, language);
72 | }
73 |
74 | public override object ConvertBack(object value, Type targetType, object parameter, string language)
75 | {
76 | if (converter == null) { converter = new TConverter(); }
77 | return converter.ConvertBack(value, targetType, parameter, language);
78 | }
79 | #endregion // Overrides / Event Handlers
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Extensions/GamepadExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Windows.Gaming.Input;
7 | using Windows.System;
8 |
9 | namespace Microsoft.Adept.Input
10 | {
11 | static public class GamepadExtensions
12 | {
13 | ///
14 | /// Attempts to convert a to its corresponding enum value.
15 | ///
16 | ///
17 | /// The to convert.
18 | ///
19 | ///
20 | /// The converted enum value, which may be .
21 | ///
22 | static public GamepadButtons ToButton(this VirtualKey key)
23 | {
24 | switch (key)
25 | {
26 | case VirtualKey.GamepadA:
27 | return GamepadButtons.A;
28 | case VirtualKey.GamepadB:
29 | return GamepadButtons.B;
30 | case VirtualKey.GamepadDPadDown:
31 | return GamepadButtons.A;
32 | case VirtualKey.GamepadDPadLeft:
33 | return GamepadButtons.A;
34 | case VirtualKey.GamepadDPadRight:
35 | return GamepadButtons.A;
36 | case VirtualKey.GamepadDPadUp:
37 | return GamepadButtons.A;
38 | case VirtualKey.GamepadLeftShoulder:
39 | return GamepadButtons.A;
40 | case VirtualKey.GamepadLeftThumbstickButton:
41 | return GamepadButtons.A;
42 | case VirtualKey.GamepadLeftThumbstickDown:
43 | return GamepadButtons.A;
44 | case VirtualKey.GamepadLeftThumbstickRight:
45 | return GamepadButtons.A;
46 | case VirtualKey.GamepadLeftThumbstickUp:
47 | return GamepadButtons.A;
48 | case VirtualKey.GamepadLeftTrigger:
49 | return GamepadButtons.A;
50 | case VirtualKey.GamepadMenu:
51 | return GamepadButtons.A;
52 | case VirtualKey.GamepadA:
53 | return GamepadButtons.A;
54 | case VirtualKey.GamepadA:
55 | return GamepadButtons.A;
56 | case VirtualKey.GamepadA:
57 | return GamepadButtons.A;
58 | case VirtualKey.GamepadA:
59 | return GamepadButtons.A;
60 | case VirtualKey.GamepadA:
61 | return GamepadButtons.A;
62 | case VirtualKey.GamepadA:
63 | return GamepadButtons.A;
64 | case VirtualKey.GamepadA:
65 | return GamepadButtons.A;
66 | case VirtualKey.GamepadA:
67 | return GamepadButtons.A;
68 | case VirtualKey.GamepadA:
69 | return GamepadButtons.A;
70 | case VirtualKey.GamepadA:
71 | return GamepadButtons.A;
72 | case VirtualKey.GamepadA:
73 | return GamepadButtons.A;
74 | case VirtualKey.GamepadA:
75 | return GamepadButtons.A;
76 | case VirtualKey.GamepadA:
77 | return GamepadButtons.A;
78 | case VirtualKey.GamepadA:
79 | return GamepadButtons.A;
80 | case VirtualKey.GamepadA:
81 | return GamepadButtons.A;
82 | case VirtualKey.GamepadA:
83 | return GamepadButtons.A;
84 | case VirtualKey.GamepadA:
85 | return GamepadButtons.A;
86 | case VirtualKey.GamepadA:
87 | return GamepadButtons.A;
88 | case VirtualKey.GamepadA:
89 | return GamepadButtons.A;
90 |
91 | default:
92 | return GamepadButtons.None;
93 | }
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Observable/Scripts/ObservableObject.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using System.ComponentModel;
5 | using System.Linq.Expressions;
6 |
7 | namespace Adept
8 | {
9 | ///
10 | /// The base class for an object that provides notification of property changes.
11 | ///
12 | public class ObservableObject : INotifyPropertyChanged
13 | {
14 | #region Overridables / Event Triggers
15 | ///
16 | /// Notifies listeners that a property value has changed.
17 | ///
18 | /// Name of the property used to notify listeners. This
19 | /// value is optional and can be provided automatically when invoked from compilers
20 | /// that support .
21 | protected virtual void OnPropertyChanged(string propertyName)
22 | {
23 | var eventHandler = this.PropertyChanged;
24 | if (eventHandler != null)
25 | {
26 | eventHandler(this, new PropertyChangedEventArgs(propertyName));
27 | }
28 | }
29 |
30 | static private string GetMemberName(Expression> expression)
31 | {
32 | if (expression.NodeType != ExpressionType.Lambda)
33 | {
34 | throw new ArgumentException("Value must be a lamda expression", "expression");
35 | }
36 |
37 | var mExpression = expression.Body as MemberExpression;
38 | if (mExpression == null)
39 | {
40 | throw new ArgumentException("The body of the expression must be a memberref", "expression");
41 | }
42 |
43 | return mExpression.Member.Name;
44 | }
45 | #endregion // Overridables / Event Triggers
46 |
47 | #region Internal Methods
48 | ///
49 | /// Checks if a property already matches a desired value. Sets the property and
50 | /// notifies listeners only when necessary.
51 | ///
52 | /// Type of the property.
53 | /// Reference to a property with both getter and setter.
54 | /// Desired value for the property.
55 | /// Name of the property used to notify listeners.
56 | /// True if the value was changed, false if the existing value matched the
57 | /// desired value.
58 | protected bool Set(ref T storage, T value, String propertyName)
59 | {
60 | if (object.Equals(storage, value)) return false;
61 |
62 | storage = value;
63 | this.OnPropertyChanged(propertyName);
64 | return true;
65 | }
66 |
67 | ///
68 | /// Checks if a property already matches a desired value. Sets the property and
69 | /// notifies listeners only when necessary.
70 | ///
71 | /// Type of the property.
72 | /// Reference to a property with both getter and setter.
73 | /// Desired value for the property.
74 | /// An expression that represents the property used to notify listeners.
75 | /// True if the value was changed, false if the existing value matched the
76 | /// desired value.
77 | protected bool Set(ref T storage, T value, Expression> property)
78 | {
79 | if (object.Equals(storage, value)) return false;
80 |
81 | storage = value;
82 | this.OnPropertyChanged(GetMemberName(property));
83 | return true;
84 | }
85 | #endregion // Internal Methods
86 |
87 | #region Public Events
88 | ///
89 | /// Raised when a property changes.
90 | ///
91 | public event PropertyChangedEventHandler PropertyChanged;
92 | #endregion // Public Events
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Samples/UWP/EditorSample/EditorSample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Core;
11 | using Windows.UI.ViewManagement;
12 | using Windows.UI.Xaml;
13 | using Windows.UI.Xaml.Controls;
14 | using Windows.UI.Xaml.Controls.Primitives;
15 | using Windows.UI.Xaml.Data;
16 | using Windows.UI.Xaml.Input;
17 | using Windows.UI.Xaml.Media;
18 | using Windows.UI.Xaml.Navigation;
19 | using UnityPlayer;
20 | // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
21 |
22 | namespace EditorSample
23 | {
24 | ///
25 | /// Provides application-specific behavior to supplement the default Application class.
26 | ///
27 | sealed partial class App : Application
28 | {
29 | private AppCallbacks appCallbacks;
30 | public SplashScreen splashScreen;
31 |
32 | ///
33 | /// Initializes the singleton application object. This is the first line of authored code
34 | /// executed, and as such is the logical equivalent of main() or WinMain().
35 | ///
36 | public App()
37 | {
38 | this.InitializeComponent();
39 | appCallbacks = new AppCallbacks();
40 | }
41 |
42 | ///
43 | /// Invoked when application is launched through protocol.
44 | /// Read more - http://msdn.microsoft.com/library/windows/apps/br224742
45 | ///
46 | ///
47 | protected override void OnActivated(IActivatedEventArgs args)
48 | {
49 | string appArgs = "";
50 |
51 | switch (args.Kind)
52 | {
53 | case ActivationKind.Protocol:
54 | ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
55 | splashScreen = eventArgs.SplashScreen;
56 | appArgs += string.Format("Uri={0}", eventArgs.Uri.AbsoluteUri);
57 | break;
58 | }
59 | InitializeUnity(appArgs);
60 | }
61 |
62 | ///
63 | /// Invoked when application is launched via file
64 | /// Read more - http://msdn.microsoft.com/library/windows/apps/br224742
65 | ///
66 | ///
67 | protected override void OnFileActivated(FileActivatedEventArgs args)
68 | {
69 | string appArgs = "";
70 |
71 | splashScreen = args.SplashScreen;
72 | appArgs += "File=";
73 | bool firstFileAdded = false;
74 | foreach (var file in args.Files)
75 | {
76 | if (firstFileAdded) appArgs += ";";
77 | appArgs += file.Path;
78 | firstFileAdded = true;
79 | }
80 |
81 | InitializeUnity(appArgs);
82 | }
83 |
84 | ///
85 | /// Invoked when the application is launched normally by the end user. Other entry points
86 | /// will be used when the application is launched to open a specific file, to display
87 | /// search results, and so forth.
88 | ///
89 | /// Details about the launch request and process.
90 | protected override void OnLaunched(LaunchActivatedEventArgs args)
91 | {
92 | splashScreen = args.SplashScreen;
93 | InitializeUnity(args.Arguments);
94 | }
95 |
96 | private void InitializeUnity(string args)
97 | {
98 | #if UNITY_WP_8_1 || UNITY_UWP
99 | ApplicationView.GetForCurrentView().SuppressSystemOverlays = true;
100 | #if UNITY_UWP
101 | if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
102 | #endif
103 | #pragma warning disable 4014
104 | {
105 | StatusBar.GetForCurrentView().HideAsync();
106 | }
107 | #pragma warning restore 4014
108 | #endif
109 | appCallbacks.SetAppArguments(args);
110 | Frame rootFrame = Window.Current.Content as Frame;
111 |
112 | // Do not repeat app initialization when the Window already has content,
113 | // just ensure that the window is active
114 | if (rootFrame == null && !appCallbacks.IsInitialized())
115 | {
116 | rootFrame = new Frame();
117 | Window.Current.Content = rootFrame;
118 | Window.Current.Activate();
119 |
120 | rootFrame.Navigate(typeof(MainPage));
121 | }
122 |
123 | Window.Current.Activate();
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/.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 | build/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 |
26 | # Packaging libraries
27 | [Pp]ackaging/Builds/*
28 | [Pp]ackaging/Packages/*
29 |
30 | # Packaging content OK
31 | ![Pp]ackaging/Content/**
32 |
33 | # Always get Unity root tools
34 | ![U]nity/**
35 |
36 | # Always ignore Unity Library and Temp folders
37 | **/[Ll]ibrary/*
38 | **/[Tt]emp/
39 |
40 | # Visual Studo 2015 cache/options directory
41 | .vs/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUNIT
48 | *.VisualState.xml
49 | TestResult.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | *_i.c
57 | *_p.c
58 | *_i.h
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.svclog
79 | *.scc
80 |
81 | # Chutzpah Test files
82 | _Chutzpah*
83 |
84 | # Visual C++ cache files
85 | ipch/
86 | *.aps
87 | *.ncb
88 | *.opensdf
89 | *.sdf
90 | *.cachefile
91 |
92 | # Visual Studio profiler
93 | *.psess
94 | *.vsp
95 | *.vspx
96 |
97 | # TFS 2012 Local Workspace
98 | $tf/
99 |
100 | # Guidance Automation Toolkit
101 | *.gpState
102 |
103 | # ReSharper is a .NET coding add-in
104 | _ReSharper*/
105 | *.[Rr]e[Ss]harper
106 | *.DotSettings.user
107 |
108 | # JustCode is a .NET coding addin-in
109 | .JustCode
110 |
111 | # TeamCity is a build add-in
112 | _TeamCity*
113 |
114 | # DotCover is a Code Coverage Tool
115 | *.dotCover
116 |
117 | # NCrunch
118 | _NCrunch_*
119 | .*crunch*.local.xml
120 |
121 | # MightyMoose
122 | *.mm.*
123 | AutoTest.Net/
124 |
125 | # Web workbench (sass)
126 | .sass-cache/
127 |
128 | # Installshield output folder
129 | [Ee]xpress/
130 |
131 | # DocProject is a documentation generator add-in
132 | DocProject/buildhelp/
133 | DocProject/Help/*.HxT
134 | DocProject/Help/*.HxC
135 | DocProject/Help/*.hhc
136 | DocProject/Help/*.hhk
137 | DocProject/Help/*.hhp
138 | DocProject/Help/Html2
139 | DocProject/Help/html
140 |
141 | # Click-Once directory
142 | publish/
143 |
144 | # Publish Web Output
145 | *.[Pp]ublish.xml
146 | *.azurePubxml
147 | # TODO: Comment the next line if you want to checkin your web deploy settings
148 | # but database connection strings (with potential passwords) will be unencrypted
149 | *.pubxml
150 | *.publishproj
151 |
152 | # NuGet Packages
153 | *.nupkg
154 | # The packages folder can be ignored because of Package Restore
155 | **/packages/*
156 | # except build/, which is used as an MSBuild target.
157 | !**/packages/build/
158 | # Uncomment if necessary however generally it will be regenerated when needed
159 | #!**/packages/repositories.config
160 | # VSIX Packages OK
161 | !**/VisualStudio/VSFeatureEngine/Packages/*
162 | # Lock files
163 | **/project.lock.json
164 |
165 | # Windows Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Windows Store app package directory
170 | AppPackages/
171 |
172 | # Others
173 | *.[Cc]ache
174 | ClientBin/
175 | [Ss]tyle[Cc]op.*
176 | ~$*
177 | *~
178 | *.dbmdl
179 | *.dbproj.schemaview
180 | # *.pfx // Allowing PFX because all PFX files are for samples
181 | *.publishsettings
182 | node_modules/
183 | bower_components/
184 |
185 | # RIA/Silverlight projects
186 | Generated_Code/
187 |
188 | # Backup & report files from converting an old project file
189 | # to a newer Visual Studio version. Backup files are not needed,
190 | # because we have git ;-)
191 | _UpgradeReport_Files/
192 | Backup*/
193 | UpgradeLog*.XML
194 | UpgradeLog*.htm
195 |
196 | # SQL Server files
197 | *.mdf
198 | *.ldf
199 |
200 | # Business Intelligence projects
201 | *.rdl.data
202 | *.bim.layout
203 | *.bim_*.settings
204 |
205 | # Microsoft Fakes
206 | FakesAssemblies/
207 |
208 | # Node.js Tools for Visual Studio
209 | .ntvs_analysis.dat
210 |
211 | # Visual Studio 6 build log
212 | *.plg
213 |
214 | # Visual Studio 6 workspace options file
215 | *.opt
216 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.UnityXaml/Controls/UnityView.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Runtime.InteropServices.WindowsRuntime;
7 | using System.Threading.Tasks;
8 | using UnityEngine.SceneManagement;
9 | using UnityPlayer;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Documents;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 |
17 | // The Templated Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234235
18 |
19 | namespace Adept.UnityXaml
20 | {
21 | ///
22 | /// A Xaml control that can display Unity 3D content.
23 | ///
24 | [TemplatePart(Name = SWAP_PANEL_NAME, Type = typeof(SwapChainPanel))]
25 | [TemplatePart(Name = PLACEHOLDER_ELEMENT_NAME, Type = typeof(UIElement))]
26 | public sealed class UnityView : Control
27 | {
28 | #region Constants
29 | private const string SWAP_PANEL_NAME = "SwapPanel";
30 | private const string PLACEHOLDER_ELEMENT_NAME = "PlaceholderElement";
31 | #endregion // Constants
32 |
33 | #region Dependency Property Definitions
34 | ///
35 | /// Identifies the dependency property.
36 | ///
37 | static public readonly DependencyProperty PlaceholderSourceProperty = DependencyProperty.Register("PlaceholderSource", typeof(ImageSource), typeof(UnityView), new PropertyMetadata(null));
38 | #endregion // Dependency Property Definitions
39 |
40 | #region Member Variables
41 | private UnityBridge bridge;
42 | private UIElement placeholderElement;
43 | private SwapChainPanel swapPanel;
44 | #endregion // Member Variables
45 |
46 | #region Constructors
47 | ///
48 | /// Initializes a new instance.
49 | ///
50 | public UnityView()
51 | {
52 | this.DefaultStyleKey = typeof(UnityView);
53 | }
54 | #endregion // Constructors
55 |
56 |
57 | #region Overrides / Event Handlers
58 | private void Bridge_RenderingStarted(object sender, EventArgs e)
59 | {
60 | // Hide the placeholder element(s)
61 | if (placeholderElement != null)
62 | {
63 | placeholderElement.Visibility = Visibility.Collapsed;
64 | }
65 | }
66 |
67 | protected override void OnApplyTemplate()
68 | {
69 | // Pass to base first
70 | base.OnApplyTemplate();
71 |
72 | // Get the swap chain panel
73 | swapPanel = GetTemplateChild(SWAP_PANEL_NAME) as SwapChainPanel;
74 |
75 | // Ensure panel was found
76 | if (swapPanel == null) { throw new InvalidOperationException($"A {nameof(SwapChainPanel)} named {SWAP_PANEL_NAME} is required in the control template."); }
77 |
78 | // Attempt to get the preview element
79 | placeholderElement = GetTemplateChild(PLACEHOLDER_ELEMENT_NAME) as UIElement;
80 |
81 | // Panel found. If not in design mode, load Unity.
82 | if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
83 | {
84 | // Get the bridge
85 | bridge = UnityBridge.Instance;
86 |
87 | // Subscribe to bridge events
88 | bridge.RenderingStarted += Bridge_RenderingStarted;
89 |
90 | // Initialize Unity
91 | bridge.Initialize(this, swapPanel);
92 | }
93 | }
94 | #endregion // Overrides / Event Handlers
95 |
96 | #region Public Properties
97 | ///
98 | /// Gets or sets the source of the placeholder image. This is a dependency property.
99 | ///
100 | ///
101 | /// The source of the placeholder image.
102 | ///
103 | public ImageSource PlaceholderSource
104 | {
105 | get
106 | {
107 | return (ImageSource)GetValue(PlaceholderSourceProperty);
108 | }
109 | set
110 | {
111 | SetValue(PlaceholderSourceProperty, value);
112 | }
113 | }
114 | #endregion // Public Properties
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Controls/Scripts/ComboBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using UnityEngine;
4 |
5 | namespace Adept.Unity
6 | {
7 | ///
8 | /// A selection control that combines a non-editable selection box and a drop-down
9 | /// containing a list box that allows users to select an item from a list.
10 | ///
11 | [AddComponentMenu("UI/Combo Box", 41)]
12 | public class ComboBox : Selector
13 | {
14 | #region Constants
15 | ///
16 | /// The name of the child GameObject that represents the instantiated selected item.
17 | ///
18 | public const string SelectedItemTemplateName = "SelectedItemTemplate";
19 | #endregion // Constants
20 |
21 | #region Member Variables
22 | private bool dropdownOpen;
23 | #endregion // Member Variables
24 |
25 | // Use this for initialization
26 | private void Start()
27 | {
28 | base.Initialize();
29 | if (selectedItemContainer == null)
30 | {
31 | selectedItemContainer = transform.Find("SelectedItemContainer").gameObject;
32 | }
33 | if (itemsContainer == null)
34 | {
35 | itemsContainer = transform.Find("ItemsContainer").gameObject;
36 | }
37 | this.itemsContainer.SetActive(false);
38 | this.gameObject.SetActive(false);
39 | this.gameObject.SetActive(true);
40 | }
41 |
42 | protected override void OnSelectionChanged(SelectionChangedEventArgs e)
43 | {
44 | // Pass to base first
45 | base.OnSelectionChanged(e);
46 |
47 | // Hide the dropdown
48 | HideDrowpdown();
49 |
50 | // If there is no selected item container, nothing else to do
51 | if (selectedItemContainer == null) { return; }
52 |
53 | // If there was a previously selected item template instance, destroy it
54 | var selectedItemTrans = selectedItemContainer.transform.Find(SelectedItemTemplateName);
55 | if (selectedItemTrans != null)
56 | {
57 | Destroy(selectedItemTrans.gameObject);
58 | }
59 |
60 | // If there is no selected item, bail
61 | if (SelectedItem == null) { return; }
62 |
63 | // Create a new selected item template instance
64 | var selectedItemTemplate = CreateItemTemplate();
65 |
66 | // Prepare the template which does binding
67 | PrepareTemplateForItem(selectedItemTemplate, SelectedItem);
68 |
69 | // Give it the correct name
70 | selectedItemTemplate.name = SelectedItemTemplateName;
71 |
72 | // Add it to the container
73 | selectedItemTemplate.transform.SetParent(selectedItemContainer.transform, false);
74 | }
75 |
76 | public void HideDrowpdown()
77 | {
78 | dropdownOpen = false;
79 | if (itemsContainer != null)
80 | {
81 | itemsContainer.SetActive(dropdownOpen);
82 | }
83 | }
84 |
85 | public void ShowDropdown()
86 | {
87 | dropdownOpen = true;
88 | if (itemsContainer != null)
89 | {
90 | itemsContainer.SetActive(dropdownOpen);
91 | }
92 | }
93 |
94 | public void ToggleDropdown()
95 | {
96 | dropdownOpen = !dropdownOpen;
97 | if (itemsContainer != null)
98 | {
99 | itemsContainer.SetActive(dropdownOpen);
100 | }
101 | }
102 |
103 | #region Inspector Properties
104 | ///
105 | /// Gets or sets the contianer that will hold the template instance for the selected item.
106 | ///
107 | [Tooltip("The contianer that will hold the template instance for the selected item.")]
108 | public GameObject selectedItemContainer;
109 |
110 | ///
111 | /// Gets or sets the container that will hold template instances for all items in the list.
112 | ///
113 | [Tooltip("The container that will hold template instances for all items in the list.")]
114 | public GameObject itemsContainer;
115 | #endregion // Inspector Properties
116 | }
117 | }
--------------------------------------------------------------------------------
/Samples/UWP/InputSample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using InputSample.Views;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Runtime.InteropServices.WindowsRuntime;
9 | using Windows.ApplicationModel;
10 | using Windows.ApplicationModel.Activation;
11 | using Windows.Foundation;
12 | using Windows.Foundation.Collections;
13 | using Windows.UI.Xaml;
14 | using Windows.UI.Xaml.Controls;
15 | using Windows.UI.Xaml.Controls.Primitives;
16 | using Windows.UI.Xaml.Data;
17 | using Windows.UI.Xaml.Input;
18 | using Windows.UI.Xaml.Media;
19 | using Windows.UI.Xaml.Navigation;
20 |
21 | namespace InputSample
22 | {
23 | ///
24 | /// Provides application-specific behavior to supplement the default Application class.
25 | ///
26 | sealed partial class App : Application
27 | {
28 | ///
29 | /// Initializes the singleton application object. This is the first line of authored code
30 | /// executed, and as such is the logical equivalent of main() or WinMain().
31 | ///
32 | public App()
33 | {
34 | Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
35 | Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
36 | Microsoft.ApplicationInsights.WindowsCollectors.Session);
37 | this.InitializeComponent();
38 | this.Suspending += OnSuspending;
39 | }
40 |
41 | ///
42 | /// Invoked when the application is launched normally by the end user. Other entry points
43 | /// will be used such as when the application is launched to open a specific file.
44 | ///
45 | /// Details about the launch request and process.
46 | protected override void OnLaunched(LaunchActivatedEventArgs e)
47 | {
48 |
49 | #if DEBUG
50 | if (System.Diagnostics.Debugger.IsAttached)
51 | {
52 | this.DebugSettings.EnableFrameRateCounter = true;
53 | }
54 | #endif
55 |
56 | Frame rootFrame = Window.Current.Content as Frame;
57 |
58 | // Do not repeat app initialization when the Window already has content,
59 | // just ensure that the window is active
60 | if (rootFrame == null)
61 | {
62 | // Create a Frame to act as the navigation context and navigate to the first page
63 | rootFrame = new Frame();
64 |
65 | rootFrame.NavigationFailed += OnNavigationFailed;
66 |
67 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
68 | {
69 | //TODO: Load state from previously suspended application
70 | }
71 |
72 | // Place the frame in the current Window
73 | Window.Current.Content = rootFrame;
74 | }
75 |
76 | if (rootFrame.Content == null)
77 | {
78 | // When the navigation stack isn't restored navigate to the first page,
79 | // configuring the new page by passing required information as a navigation
80 | // parameter
81 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
82 | }
83 | // Ensure the current window is active
84 | Window.Current.Activate();
85 | }
86 |
87 | ///
88 | /// Invoked when Navigation to a certain page fails
89 | ///
90 | /// The Frame which failed navigation
91 | /// Details about the navigation failure
92 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
93 | {
94 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
95 | }
96 |
97 | ///
98 | /// Invoked when application execution is being suspended. Application state is saved
99 | /// without knowing whether the application will be terminated or resumed with the contents
100 | /// of memory still intact.
101 | ///
102 | /// The source of the suspend request.
103 | /// Details about the suspend request.
104 | private void OnSuspending(object sender, SuspendingEventArgs e)
105 | {
106 | var deferral = e.SuspendingOperation.GetDeferral();
107 | //TODO: Save application state and stop any background activity
108 | deferral.Complete();
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Actions/MethodAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Linq.Expressions;
7 | using System.Reflection;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace Adept.Input
12 | {
13 | public class MethodAction : IInputAction
14 | {
15 | private string description;
16 | private MethodInfo method;
17 | private string name;
18 | private List parameters = new List();
19 | private Dictionary paramPositionTable = new Dictionary();
20 | private object target;
21 | private ParameterValueSet values = new ParameterValueSet();
22 |
23 | //public MethodAction()
24 | //{
25 | // Action a = Foo;
26 | // MethodCallExpression e;
27 | // // (()=>Foo);
28 | // var mi = SymbolExtensions.GetMethodInfo(() => Foo());
29 |
30 |
31 | //}
32 |
33 | //public void Foo() { }
34 |
35 | public MethodAction(MethodInfo method, object target)
36 | {
37 | // Defaults
38 | IsEnabled = true;
39 |
40 | // Validate
41 | if (method == null) throw new ArgumentNullException("method");
42 | if (target == null) throw new ArgumentNullException("target");
43 |
44 | // Store
45 | this.method = method;
46 | this.target = target;
47 |
48 | // Determine Name
49 | // TODO: Use attributes?
50 | name = method.Name;
51 |
52 | // TODO: Determine Description
53 |
54 | // Determine parameters
55 | foreach (var par in method.GetParameters())
56 | {
57 | // Create parameter
58 | parameters.Add(new ParameterDefinition()
59 | {
60 | // Description, // TODO: From attributes
61 | IsOptional = par.IsOptional,
62 | Name = par.Name, // TODO: From attributes
63 | ParameterType = par.ParameterType
64 | });
65 |
66 | // Set position
67 | paramPositionTable[par.Name] = par.Position;
68 |
69 | }
70 | }
71 |
72 | ///
73 | public object Invoke()
74 | {
75 | // Placeholder
76 | object[] vals = null;
77 |
78 | // Have values to pass in?
79 | if (values != null)
80 | {
81 | // Convert parameters to value array
82 | vals = (from v in values
83 | orderby paramPositionTable[v.Name]
84 | select v.Value).ToArray();
85 | }
86 |
87 | // Invoke
88 | return method.Invoke(target, vals);
89 | }
90 |
91 | ///
92 | public string Description
93 | {
94 | get
95 | {
96 | return description;
97 | }
98 |
99 | set
100 | {
101 | description = value;
102 | }
103 | }
104 |
105 | ///
106 | public bool IsEnabled { get; set; }
107 |
108 | ///
109 | /// Gets the method that will be invoked by the action.
110 | ///
111 | public MethodInfo Method => method;
112 |
113 | ///
114 | public string Name
115 | {
116 | get
117 | {
118 | return name;
119 | }
120 |
121 | set
122 | {
123 | name = value;
124 | }
125 | }
126 |
127 | ///
128 | public IReadOnlyList Parameters => parameters;
129 |
130 | ///
131 | public Type ReturnType
132 | {
133 | get
134 | {
135 | return method.ReturnType;
136 | }
137 | }
138 |
139 | ///
140 | /// Gets the object that is the target of the method invocation.
141 | ///
142 | public object Target => target;
143 |
144 | ///
145 | public ParameterValueSet Values
146 | {
147 | get
148 | {
149 | return values;
150 | }
151 | set
152 | {
153 | if (value == null) throw new ArgumentNullException("value");
154 | values = value;
155 | }
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.Input/Keyboard/KeyboardMapper.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Diagnostics;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using Windows.System;
10 | using Windows.UI.Core;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Input;
14 |
15 | namespace Adept.Input
16 | {
17 | ///
18 | /// A class that maps keyboard input to actions.
19 | ///
20 | public class KeyboardMapper
21 | {
22 | #region Member Variables
23 | private List bindings = new List();
24 | private List pressedKeys = new List();
25 | #endregion // Member Variables
26 |
27 | private void ExecuteBindings(VirtualKey key, bool repeated, bool released)
28 | {
29 | // Find all matching bindings
30 | var query = (from b in bindings
31 | where b.IsEnabled && // Enabled
32 | b.Key == key && // Matches key
33 | b.WhenReleased == released && // Matches released or pressed passed in above
34 |
35 | (b.Modifier == VirtualKey.None // No modifier
36 | || pressedKeys.Contains(b.Modifier)) // - OR - modifier is currently pressed
37 |
38 | select b);
39 |
40 | // Repeated?
41 | if (repeated)
42 | {
43 | query = query.Where(b => b.WhenRepeated);
44 | }
45 |
46 | // To list
47 | var active = query.ToList();
48 |
49 | // Fire all
50 | foreach (var b in active)
51 | {
52 | try
53 | {
54 | b.Action.Invoke();
55 | }
56 | catch (Exception ex)
57 | {
58 | // TODO: Log exception.
59 | Debug.WriteLine(string.Format("Error executing binding: {0}", ex.Message));
60 | }
61 | }
62 | }
63 |
64 | ///
65 | /// Processes a KeyDown event.
66 | ///
67 | ///
68 | /// The sender of the event.
69 | ///
70 | ///
71 | /// A which contains the event data.
72 | ///
73 | private void ProcessKeyDown(CoreWindow sender, KeyEventArgs e)
74 | {
75 | // Repeated?
76 | bool repeated = e.KeyStatus.WasKeyDown;
77 |
78 | if (!repeated)
79 | {
80 | // Add to pressed
81 | pressedKeys.Add(e.VirtualKey);
82 | }
83 |
84 | // Execute matching bindings
85 | ExecuteBindings(e.VirtualKey, repeated, false);
86 | }
87 |
88 | ///
89 | /// Processes a KeyUp event.
90 | ///
91 | ///
92 | /// The sender of the event.
93 | ///
94 | ///
95 | /// A which contains the event data.
96 | ///
97 | private void ProcessKeyUp(CoreWindow sender, KeyEventArgs e)
98 | {
99 | // Repeated?
100 | bool repeated = (!e.KeyStatus.IsKeyReleased);
101 |
102 | if (!repeated)
103 | {
104 | // Remove from pressed
105 | pressedKeys.Remove(e.VirtualKey);
106 | }
107 |
108 | // Execute matching bindings
109 | ExecuteBindings(e.VirtualKey, repeated, true);
110 | }
111 |
112 | ///
113 | /// Subscribes to keyboard events on the specified control.
114 | ///
115 | public void SubscribeEvents()
116 | {
117 | Window.Current.CoreWindow.KeyDown += ProcessKeyDown;
118 | Window.Current.CoreWindow.KeyUp += ProcessKeyUp;
119 | }
120 |
121 | ///
122 | /// Unsubscribes from keyboard events on the specified control.
123 | ///
124 | public void UnsubscribeEvents()
125 | {
126 | Window.Current.CoreWindow.KeyDown -= ProcessKeyDown;
127 | Window.Current.CoreWindow.KeyUp -= ProcessKeyUp;
128 | }
129 |
130 | ///
131 | /// Gets the list of keyboard bindings.
132 | ///
133 | public List Bindings
134 | {
135 | get
136 | {
137 | return bindings;
138 | }
139 | set
140 | {
141 | if (value == null) throw new ArgumentNullException("value");
142 | bindings = value;
143 | }
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Controls/Prefabs/ItemContainer.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &171236
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 224: {fileID: 22471236}
11 | - 222: {fileID: 22271236}
12 | - 114: {fileID: 11471238}
13 | - 114: {fileID: 11471236}
14 | - 114: {fileID: 11456162}
15 | m_Layer: 5
16 | m_Name: ItemContainer
17 | m_TagString: Untagged
18 | m_Icon: {fileID: 0}
19 | m_NavMeshLayer: 0
20 | m_StaticEditorFlags: 0
21 | m_IsActive: 1
22 | --- !u!114 &11456162
23 | MonoBehaviour:
24 | m_ObjectHideFlags: 1
25 | m_PrefabParentObject: {fileID: 0}
26 | m_PrefabInternal: {fileID: 100100000}
27 | m_GameObject: {fileID: 171236}
28 | m_Enabled: 1
29 | m_EditorHideFlags: 0
30 | m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
31 | m_Name:
32 | m_EditorClassIdentifier:
33 | m_IgnoreLayout: 0
34 | m_MinWidth: -1
35 | m_MinHeight: 30
36 | m_PreferredWidth: -1
37 | m_PreferredHeight: -1
38 | m_FlexibleWidth: -1
39 | m_FlexibleHeight: -1
40 | --- !u!114 &11471236
41 | MonoBehaviour:
42 | m_ObjectHideFlags: 1
43 | m_PrefabParentObject: {fileID: 0}
44 | m_PrefabInternal: {fileID: 100100000}
45 | m_GameObject: {fileID: 171236}
46 | m_Enabled: 1
47 | m_EditorHideFlags: 0
48 | m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
49 | m_Name:
50 | m_EditorClassIdentifier:
51 | m_Navigation:
52 | m_Mode: 3
53 | m_SelectOnUp: {fileID: 0}
54 | m_SelectOnDown: {fileID: 0}
55 | m_SelectOnLeft: {fileID: 0}
56 | m_SelectOnRight: {fileID: 0}
57 | m_Transition: 1
58 | m_Colors:
59 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
60 | m_HighlightedColor: {r: 1, g: 0.55862063, b: 0, a: 1}
61 | m_PressedColor: {r: 0.48081273, g: 0.65882355, b: 0, a: 1}
62 | m_DisabledColor: {r: 0.2509804, g: 0.2509804, b: 0.2509804, a: 0.5019608}
63 | m_ColorMultiplier: 2
64 | m_FadeDuration: 0.1
65 | m_SpriteState:
66 | m_HighlightedSprite: {fileID: 0}
67 | m_PressedSprite: {fileID: 0}
68 | m_DisabledSprite: {fileID: 0}
69 | m_AnimationTriggers:
70 | m_NormalTrigger: Normal
71 | m_HighlightedTrigger: Highlighted
72 | m_PressedTrigger: Pressed
73 | m_DisabledTrigger: Disabled
74 | m_Interactable: 1
75 | m_TargetGraphic: {fileID: 11471238}
76 | m_OnClick:
77 | m_PersistentCalls:
78 | m_Calls:
79 | - m_Target: {fileID: 0}
80 | m_MethodName: SelectItem
81 | m_Mode: 2
82 | m_Arguments:
83 | m_ObjectArgument: {fileID: 0}
84 | m_ObjectArgumentAssemblyTypeName: UnityEngine.UI.Text, UnityEngine.UI
85 | m_IntArgument: 0
86 | m_FloatArgument: 0
87 | m_StringArgument:
88 | m_BoolArgument: 0
89 | m_CallState: 1
90 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
91 | Culture=neutral, PublicKeyToken=null
92 | --- !u!114 &11471238
93 | MonoBehaviour:
94 | m_ObjectHideFlags: 1
95 | m_PrefabParentObject: {fileID: 0}
96 | m_PrefabInternal: {fileID: 100100000}
97 | m_GameObject: {fileID: 171236}
98 | m_Enabled: 1
99 | m_EditorHideFlags: 0
100 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
101 | m_Name:
102 | m_EditorClassIdentifier:
103 | m_Material: {fileID: 0}
104 | m_Color: {r: 1, g: 1, b: 1, a: 0.078431375}
105 | m_RaycastTarget: 1
106 | m_OnCullStateChanged:
107 | m_PersistentCalls:
108 | m_Calls: []
109 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
110 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
111 | m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
112 | m_Type: 1
113 | m_PreserveAspect: 0
114 | m_FillCenter: 1
115 | m_FillMethod: 4
116 | m_FillAmount: 1
117 | m_FillClockwise: 1
118 | m_FillOrigin: 0
119 | --- !u!222 &22271236
120 | CanvasRenderer:
121 | m_ObjectHideFlags: 1
122 | m_PrefabParentObject: {fileID: 0}
123 | m_PrefabInternal: {fileID: 100100000}
124 | m_GameObject: {fileID: 171236}
125 | --- !u!224 &22471236
126 | RectTransform:
127 | m_ObjectHideFlags: 1
128 | m_PrefabParentObject: {fileID: 0}
129 | m_PrefabInternal: {fileID: 100100000}
130 | m_GameObject: {fileID: 171236}
131 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
132 | m_LocalPosition: {x: 0, y: 0, z: 0}
133 | m_LocalScale: {x: 1, y: 1, z: 1}
134 | m_Children: []
135 | m_Father: {fileID: 0}
136 | m_RootOrder: 0
137 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
138 | m_AnchorMin: {x: 0, y: 0}
139 | m_AnchorMax: {x: 1, y: 1}
140 | m_AnchoredPosition: {x: 0, y: 0}
141 | m_SizeDelta: {x: 0, y: 0}
142 | m_Pivot: {x: 0.5, y: 0.5}
143 | --- !u!1001 &100100000
144 | Prefab:
145 | m_ObjectHideFlags: 1
146 | serializedVersion: 2
147 | m_Modification:
148 | m_TransformParent: {fileID: 0}
149 | m_Modifications: []
150 | m_RemovedComponents: []
151 | m_ParentPrefab: {fileID: 0}
152 | m_RootGameObject: {fileID: 171236}
153 | m_IsPrefabParent: 1
154 |
--------------------------------------------------------------------------------
/Lib/UWP/Adept.StateSync/SynchronizationManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | //
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.ComponentModel;
7 | using System.Reflection;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 |
12 | namespace Adept.StateSync
13 | {
14 | ///
15 | /// Synchronizes object state across devices and application instances.
16 | ///
17 | public class SynchronizationManager
18 | {
19 | #region Nested Classes
20 | private class SyncRegistration
21 | {
22 | public string Id;
23 | public INotifyPropertyChanged Instance;
24 | public bool IsHost;
25 | public PropertyChangedEventHandler PropertyChanged;
26 | }
27 | #endregion // Nested Classes
28 |
29 | #region Member Variables
30 | private Dictionary registrations = new Dictionary();
31 | #endregion // Member Variables
32 |
33 | #region Overrides / Event Handlers
34 | private void Registration_PropertyChanged(SyncRegistration sender, PropertyChangedEventArgs e)
35 | {
36 | // Get the actual registered object
37 | var source = sender.Instance;
38 |
39 | // Get the property from the sender
40 | var property = source.GetType().GetProperty(e.PropertyName);
41 |
42 | // Look for a strategy
43 | var strategy = property.GetCustomAttribute(true);
44 |
45 | // If strategy was found, execute it
46 | if (strategy != null)
47 | {
48 | // Create the message
49 | SyncMessage message = new SyncMessage()
50 | {
51 | SyncId = sender.Id
52 | };
53 |
54 | // Ask the strategy to add the actions
55 | strategy.AddActions(message, source, property);
56 |
57 | // TODO: Send the message
58 | }
59 | }
60 | #endregion // Overrides / Event Handlers
61 |
62 | #region Public Methods
63 | ///
64 | /// Starts synchronization of the object.
65 | ///
66 | ///
67 | /// The instance of the object to synchronize.
68 | ///
69 | ///
70 | /// The unique ID of the instance.
71 | ///
72 | ///
73 | /// true if the instance should act as the host instance; otherwise false.
74 | ///
75 | ///
76 | ///
77 | /// If is true, will
78 | /// automatically send a FullState message with the current state of the object
79 | /// provided at least one other client is currently connected. In addition, this instance
80 | /// will be used to respond to GetFullState messages in the future.
81 | ///
82 | ///
83 | /// If is false, will
84 | /// automatically send a GetFullState message provided at least one other client is
85 | /// currently connected.
86 | ///
87 | ///
88 | public void StartSync(INotifyPropertyChanged instance, string id, bool isHost = false)
89 | {
90 | // Validate
91 | if (instance == null) throw new ArgumentNullException(nameof(instance));
92 | if (string.IsNullOrEmpty(id)) throw new ArgumentException(nameof(id));
93 |
94 | // Thread safe
95 | lock (registrations)
96 | {
97 | // Look for an existing registration
98 | if (registrations.ContainsKey(id)) { throw new InvalidOperationException($"The ID '{id}' is already registered."); }
99 |
100 | // Create Registration
101 | var reg = new SyncRegistration()
102 | {
103 | Id = id,
104 | Instance = instance,
105 | IsHost = isHost
106 | };
107 |
108 | // Register
109 | registrations[id] = reg;
110 |
111 | // Setup property changed to registration changed delegate
112 | reg.PropertyChanged = (o, e) => Registration_PropertyChanged(reg, e);
113 |
114 | // Subscribe to changes
115 | instance.PropertyChanged += reg.PropertyChanged;
116 | }
117 |
118 | if (isHost)
119 | {
120 | // TODO: Send full state
121 | }
122 | }
123 |
124 | ///
125 | /// Stops synchronization of the specified object.
126 | ///
127 | ///
128 | /// The unique ID of the object.
129 | ///
130 | public void StopSync(string id)
131 | {
132 | // Validate
133 | if (id == null) throw new ArgumentNullException(nameof(id));
134 |
135 | // Thread safe
136 | lock (registrations)
137 | {
138 | // Try to get the instance
139 | if (!registrations.ContainsKey(id)) { return; }
140 | var reg = registrations[id];
141 | var instance = reg.Instance;
142 |
143 | // Unsubscribe from changes
144 | instance.PropertyChanged -= reg.PropertyChanged;
145 |
146 | // Unregister
147 | registrations.Remove(id);
148 | }
149 | }
150 | #endregion // Public Methods
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/Lib/Unity/Assets/Adept/Controls/Scripts/ItemContainerGenerator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License. See LICENSE in the project root for license information.
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.Collections.Specialized;
7 | using System.Linq;
8 | using UnityEngine;
9 |
10 | namespace Adept.Unity
11 | {
12 | public class ItemContainerGenerator
13 | {
14 | #region Member Variables
15 | private Dictionary