private void InitializeUnity(string args) { #if UNITY_WP_8_1 || UNITY_UWP ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #if UNITY_UWP if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) #endif #pragma warning disable 4014 { StatusBar.GetForCurrentView().HideAsync(); } #pragma warning restore 4014 #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; #if !UNITY_HOLOGRAPHIC Window.Current.Activate(); #endif rootFrame.Navigate(typeof(MainPage)); MainPageRef = rootFrame.Content as MainPage; MainViewId = ApplicationView.GetForCurrentView().Id; } Window.Current.Activate(); }
private void InitializeUnity(string args) { #if UNITY_WP_8_1 ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #pragma warning disable 4014 StatusBar.GetForCurrentView().HideAsync(); #pragma warning restore 4014 #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { // Initialise Store system #if QA || DEBUG MarkerMetro.Unity.WinIntegration.Store.StoreManager.Instance.Initialise(true); #else MarkerMetro.Unity.WinIntegration.Store.StoreManager.Instance.Initialise(false); #endif rootFrame = new Frame(); Window.Current.Content = rootFrame; Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage)); AppCallBacksInitialized(); } Window.Current.Activate(); }
private void InitializeUnity(string args) { #if UNITY_WP_8_1 || UNITY_UWP ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #endif #if UNITY_WP_8_1 StatusBar.GetForCurrentView().HideAsync(); #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; #if !UNITY_HOLOGRAPHIC Window.Current.Activate(); #endif rootFrame.Navigate(typeof(MainPage)); } Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { appCallbacks.SetAppArguments(args.Arguments); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { var mainPage = new MainPage(args.SplashScreen); Window.Current.Content = mainPage; Window.Current.Activate(); // Setup scripting bridge _bridge = new WinRTBridge.WinRTBridge(); appCallbacks.SetBridge(_bridge); appCallbacks.SetSwapChainBackgroundPanel(mainPage.GetSwapChainBackgroundPanel()); appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow); appCallbacks.InitializeD3DXAML(); } Window.Current.Activate(); }
private void InitializeUnity(string args, Windows.ApplicationModel.Activation.SplashScreen splashScreen) { appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { var mainPage = new MainPage(splashScreen); Window.Current.Content = mainPage; Window.Current.Activate(); // Setup scripting bridge _bridge = new WinRTBridge.WinRTBridge(); appCallbacks.SetBridge(_bridge); appCallbacks.SetKeyboardTriggerControl(mainPage); appCallbacks.SetSwapChainPanel(mainPage.GetSwapChainPanel()); appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow); appCallbacks.InitializeD3DXAML(); } Window.Current.Activate(); }
private void InitializeUnity(string args) { #if UNITY_WP_8_1 ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #pragma warning disable 4014 StatusBar.GetForCurrentView().HideAsync(); #pragma warning restore 4014 #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage)); } Microsoft.UnityPlugins.MicrosoftAdsBridge.InterstitialAdFactory = new Microsoft.UnityPlugins.MicrosoftAdsFactory(); Window.Current.Activate(); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { if (appCallbacks.IsInitialized()) { appCallbacks.UnityPause(0); } }
private void InitializeUnity(string args) { #if UNITY_WP_8_1 || UNITY_UWP ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #if UNITY_UWP if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) #endif #pragma warning disable 4014 { StatusBar.GetForCurrentView().HideAsync(); } #pragma warning restore 4014 #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; Window.Current.Activate(); rootFrame.Navigate(typeof(MainPage)); } Window.Current.Activate(); Microsoft.UnityPlugins.Utils.Initialize((action) => AppCallbacks.Instance.InvokeOnAppThread(new AppCallbackItem(() => action()), false)); }
private void InitializeUnity(string args) { ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; #if !UNITY_HOLOGRAPHIC Window.Current.Activate(); #endif rootFrame.Navigate(typeof(MainPage)); } Window.Current.Activate(); //Add this statement to allow Unity code call IAP code on UWP UI thread AppCallbacks.Instance.InvokeOnAppThread(new AppCallbackItem(() => { IAPCaller.callIAP = new IAPCaller.CallIAP(CallIAP); }), false); }
private void InitializeUnity(string args) { #if UNITY_UWP ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) #pragma warning disable 4014 { StatusBar.GetForCurrentView().HideAsync(); } #pragma warning restore 4014 #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; #if UNITY_HOLOGRAPHIC CoreWindow.GetForCurrentThread().Activated += WindowActivated; #else Window.Current.Activate(); #endif rootFrame.Navigate(typeof(MainPage)); } Window.Current.Activate(); // Integrate with Shell back button behavior on non-Holographic UWP platforms such as Desktop and Mobile. // Using DeviceFamily name here instead of an API Contract check since the UWP API we will subsequently // call when the back button should be visible (AppViewBackButtonVisibility) is present on all platforms // and simply no-ops on some. Unity has the UnityEngine.VR.VRDevice.isPresent which would work here but // since this will wind up including a check for SurfaceHub as well in the future which Unity does not // know about, this will consistently use DeviceFamily for these platform checks if (AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Holographic") { AppCallbacks.Instance.InvokeOnAppThread(() => { ToolManager.BackButtonVisibilityChangeRequested += ToolManager_BackButtonVisibilityChangeRequested; }, waitUntilDone: false); } }
private void InitializeUnity(string args) { #if UNITY_WP_8_1 || UNITY_UWP ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #endif #if UNITY_WP_8_1 StatusBar.GetForCurrentView().HideAsync(); #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { rootFrame = new Frame(); Window.Current.Content = rootFrame; #if !UNITY_HOLOGRAPHIC Window.Current.Activate(); #endif rootFrame.Navigate(typeof(MainPage)); } Window.Current.Activate(); // Integrate with Shell back button behavior on non-Holographic UWP // platforms such as Desktop and Mobile. Using DeviceFamily name // here instead of an API Contract check since the UWP API we will // subsequently call when the back button should be visible // (AppViewBackButtonVisibility) is present on all platforms and // simply no-ops on some. // Unity has the UnityEngine.VR.VRDevice.isPresent which would work // here but since this will wind up including a check for // SurfaceHub as well in the future which Unity does not know about, // this will consistently use DeviceFamily for these platform checks AppCallbacks.Instance.InvokeOnAppThread(() => { MyAppPlatformManager.MyAppPlatformManagerInitialized += RegisterForBackButtonChangeRequests; }, waitUntilDone: false); }
private void InitializeUnity(string args, Windows.ApplicationModel.Activation.SplashScreen splashScreen) { #if UNITY_WP_8_1 ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #pragma warning disable 4014 StatusBar.GetForCurrentView().HideAsync(); #pragma warning restore 4014 #endif appCallbacks.SetAppArguments(args); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null && !appCallbacks.IsInitialized()) { var mainPage = new MainPage(splashScreen); Window.Current.Content = mainPage; Window.Current.Activate(); // Setup scripting bridge _bridge = new WinRTBridge.WinRTBridge(); appCallbacks.SetBridge(_bridge); #if !UNITY_WP_8_1 appCallbacks.SetKeyboardTriggerControl(mainPage); #endif appCallbacks.SetSwapChainPanel(mainPage.GetSwapChainPanel()); appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow); appCallbacks.InitializeD3DXAML(); } Window.Current.Activate(); #if UNITY_WP_8_1 SetupLocationService(); #endif }
private void InitializeUnity(string args) { #if UNITY #if UNITY_UWP ApplicationView.GetForCurrentView().SuppressSystemOverlays = true; #endif appCallbacks.SetAppArguments(args); appCallbacks.AddCommandLineArg("-force-d3d11-no-singlethreaded"); #endif // UNITY Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active #if UNITY if (rootFrame == null && !appCallbacks.IsInitialized()) #else if (rootFrame == null) #endif { rootFrame = new Frame(); // Set the default language rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; Window.Current.Content = rootFrame; } //Do not activate now. //https://msdn.microsoft.com/en-us/library/windows/apps/hh465338.aspx: //"Flicker occurs if you activate the current window (by calling Window.Current.Activate) //before the content of the page finishes rendering. You can reduce the likelihood of seeing //a flicker by making sure your extended splash screen image has been read before you activate //the current window. Additionally, you should use a timer to try to avoid the flicker by //making your application wait briefly, 50ms for example, before you activate the current window. //Unfortunately, there is no guaranteed way to prevent the flicker because XAML renders content //asynchronously and there is no guaranteed way to predict when rendering will be complete." mainViewModel = new ViewModels.MainViewModel(CoreApplication.MainView.CoreWindow.Dispatcher); mainViewModel.OnInitialized += OnMainViewModelInitialized; }