Fix AssociationLaunching example
This commit is contained in:
Родитель
71cd2f6981
Коммит
3efca017ce
|
@ -16,9 +16,13 @@ public class AssocationLaunching : MonoBehaviour
|
|||
// Update is called once per frame
|
||||
void OnGUI ()
|
||||
{
|
||||
#if UNITY_METRO
|
||||
#if UNITY_WSA
|
||||
#if UNITY_EDITOR
|
||||
GUILayout.Label("Build to Windows Store Apps first!");
|
||||
#endif
|
||||
GUILayout.Label("Application args: " + UnityEngine.WSA.Application.arguments);
|
||||
GUILayout.Space(15);
|
||||
GUILayout.Label("1. Example: shows how to open an URL in a browser");
|
||||
uri = GUILayout.TextField(uri);
|
||||
if (GUILayout.Button("Launch via Uri"))
|
||||
UnityEngine.WSA.Launcher.LaunchUri(uri, true);
|
||||
|
@ -26,6 +30,7 @@ public class AssocationLaunching : MonoBehaviour
|
|||
GUILayout.Space(15);
|
||||
// Note: myunitygame tag must match with the one in Package.appxmanifest under Protocol field
|
||||
// You can also Wnd+R, and type myunitygame:// , this will also launch this application.
|
||||
GUILayout.Label("2. Example: shows how to open this Windows Store application via protocol, this way you can open this application from another Windows Store application.");
|
||||
if (GUILayout.Button("Launch via Uri with 'myunitygame'"))
|
||||
{
|
||||
// This will invoke OnActivated function in App.xaml.cs
|
||||
|
@ -33,18 +38,21 @@ public class AssocationLaunching : MonoBehaviour
|
|||
}
|
||||
GUILayout.Space(15);
|
||||
// Note: myunitygame extension must match with the one in Package.appxmanifest under File Type Assocations
|
||||
GUILayout.Label("3. Example: shows how to open this Windows Store application via file association. Try creating a file, for ex., 'test.myunitygame', open it, this WSA application should open.");
|
||||
if (GUILayout.Button("Launch via File '" + assocationFilePath + "'"))
|
||||
{
|
||||
// This will invoke OnFileActivated function in App.xaml.cs
|
||||
UnityEngine.WSA.Launcher.LaunchFile(UnityEngine.WSA.Folder.Installation, assocationFilePath, true);
|
||||
}
|
||||
GUILayout.Space(15);
|
||||
GUILayout.Label(string.Format("4. Example: open an application associated {0} extension (by default it's notepad.exe)", extension));
|
||||
extension = GUILayout.TextField(extension);
|
||||
if (GUILayout.Button("Launch via File Picker"))
|
||||
UnityEngine.WSA.Launcher.LaunchFileWithPicker(extension);
|
||||
|
||||
GUILayout.Space(15);
|
||||
relativeFilePath = GUILayout.TextField(relativeFilePath);
|
||||
GUILayout.Label("5. Example: shows how to open a file from application data folder");
|
||||
if (GUILayout.Button("Launch via File"))
|
||||
UnityEngine.WSA.Launcher.LaunchFile(UnityEngine.WSA.Folder.Installation, relativeFilePath, true);
|
||||
#else
|
||||
|
|
Двоичные данные
AssocationLaunch/Assets/MetroTestCertificate.pfx
Двоичные данные
AssocationLaunch/Assets/MetroTestCertificate.pfx
Двоичный файл не отображается.
|
@ -1,5 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7fb73e680deb39b45913deac5f1acc08
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
Двоичный файл не отображается.
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7a9618c7089a5f9448673cd9f7744057
|
||||
timeCreated: 1461582991
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
Двоичные данные
AssocationLaunch/ProjectSettings/GraphicsSettings.asset
Двоичные данные
AssocationLaunch/ProjectSettings/GraphicsSettings.asset
Двоичный файл не отображается.
Двоичные данные
AssocationLaunch/ProjectSettings/ProjectSettings.asset
Двоичные данные
AssocationLaunch/ProjectSettings/ProjectSettings.asset
Двоичный файл не отображается.
|
@ -0,0 +1,2 @@
|
|||
m_EditorVersion: 5.3.4p4
|
||||
m_StandardAssetsVersion: 0
|
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,6 @@
|
|||
Windows Store App example showing how to launch an app for file type or a protocol.
|
||||
More info - https://code.msdn.microsoft.com/windowsapps/Association-Launching-535d2cec
|
||||
|
||||
* Open project with Unity 5.3 or higher
|
||||
* Build to Windows Store (SDK 8.1)
|
||||
* Click on buttons to see protocol and file type association in action.
|
Загрузка…
Ссылка в новой задаче