/// <summary>
		/// Initializes the singleton application object.  This is the first line of authored code
		/// executed, and as such is the logical equivalent of main() or WinMain().
		/// </summary>
		public App()
		{
			this.InitializeComponent();
			appCallbacks = new AppCallbacks(false);
			appCallbacks.RenderingStarted += RemoveSplashScreen;
            appCallbacks.Initialized += appCallbacks_Initialized;
		}
Exemplo n.º 2
0
        public App()
        {
            m_AppCallbacks = new AppCallbacks();

            // Allow clients of this class to append their own callbacks.
            AddAppCallbacks(m_AppCallbacks);
        }
Exemplo n.º 3
0
        public App()
        {
            SetupOrientation();
            m_AppCallbacks = new AppCallbacks();

            // Allow clients of this class to append their own callbacks.
            AddAppCallbacks(m_AppCallbacks);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     appCallbacks     = new AppCallbacks();
     ApplicationView.PreferredLaunchViewSize      = new Size(500, 800);
     ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
 }
Exemplo n.º 5
0
 public UnityPlayer(AppCallbacks appCallbacks)
 {
     this.appCallbacks = appCallbacks;
     this.appCallbacks.InvokeOnAppThread(() =>
     {
         BridgeBootstrapper.SetDotNetBridge(this);
     }, true);
 }
        public MainPage()
        {
            this.InitializeComponent();
            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

#if !UNITY_WP_8_1
            appCallbacks.SetKeyboardTriggerControl(this);
#endif
            appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
            appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
            appCallbacks.InitializeD3DXAML();

            splash = ((App)App.Current).SplashScreen;
            GetSplashBackgroundColor();
            OnResize();

            onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
            Window.Current.SizeChanged += onResizeHandler;

#if UNITY_WP_8_1
            SetupLocationService();
#endif

#if UNITY_METRO_8_1
            // Configure settings charm
            settingsPane = SettingsPane.GetForCurrentView();
            settingsPane.CommandsRequested += SettingsPaneCommandsRequested;
#endif
            // provide the game configuration
            MarkerMetro.Unity.WinShared.GameController.Instance.Init(AppConfig.Instance);

            AppCallbacks.Instance.RenderingStarted += () =>
            {
                isUnityLoaded = true;
                AppCallbacks.Instance.InvokeOnAppThread(() =>
                {
                    MarkerMetro.Unity.WinShared.ExceptionManager.Instance.Init(Crash);
                }, false);
            };

            // create extended splash timer
            extendedSplashTimer          = new DispatcherTimer();
            extendedSplashTimer.Interval = TimeSpan.FromMilliseconds(100);
            extendedSplashTimer.Tick    += ExtendedSplashTimer_Tick;
            extendedSplashTimer.Start();

#if UNITY_METRO_8_1
            // set the fb web interface (only for Win8.1).
            FB.SetPlatformInterface(web);
#endif
        }
Exemplo n.º 7
0
        public App()
        {
            Debug.WriteLine("\t\t\t\t\t APP.CS: App (constructor)");
            SetupOrientation();
            m_AppCallbacks = new AppCallbacks();

            // Allow clients of this class to append their own callbacks.
            AddAppCallbacks(m_AppCallbacks);
        }
Exemplo n.º 8
0
 public static void CreatePlayer()
 {
     if (appCallbacks == null)
     {
         SetupOrientation();
         appCallbacks = new AppCallbacks();
         Player       = new UnityPlayer(appCallbacks);
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            SetupOrientation();
#if UNITY
            appCallbacks = new AppCallbacks();
#endif
        }
Exemplo n.º 10
0
        public App()
        {
            DebugUtil.CheckMainThread();

            SetupOrientation();
            _AppCallbacks = new AppCallbacks();

            // Allow clients of this class to append their own callbacks.
            AddAppCallbacks(_AppCallbacks);
        }
Exemplo n.º 11
0
        public MainPage()
        {
            this.InitializeComponent();
            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

            bool isWindowsHolographic = false;

                #if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the deviceFamily actually supports it,
            // otherwise we treat this as a normal XAML application
            string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
            isWindowsHolographic = String.Compare("Windows.Holographic", deviceFamily) == 0;
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager();
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

#if !UNITY_WP_8_1
                appCallbacks.SetKeyboardTriggerControl(this);
#endif
                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                splash = ((App)App.Current).splashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;

#if UNITY_WP_8_1
                onRotationChangedHandler = new TypedEventHandler <DisplayInformation, object>((di, o) => { OnRotate(di); });
                ExtendedSplashImage.RenderTransformOrigin = new Point(0.5, 0.5);
                var displayInfo = DisplayInformation.GetForCurrentView();
                displayInfo.OrientationChanged += onRotationChangedHandler;
                OnRotate(displayInfo);

                SetupLocationService();
#endif
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks = new AppCallbacks(false);
     appCallbacks.RenderingStarted   += RemoveSplashScreen;
     CustomXamlResourceLoader.Current = new TranslationResourceProvider();
     // BASIC SLIDEUP INTEGRATION:
     // Assigns the default Appboy slideup factory. The slideup will be displayed with the default Appboy slideup UI. The
     // default Appboy UI can be themed by editing the AppboyUI.Universal stylesheet.
     AppboyPlatform.Universal.Appboy.SharedInstance.SlideupManager.SlideupControlFactory = new AppboyUI.Universal.Factories.SlideupControlFactory();
     // Sets the feed modal that should be displayed when a slideup with ClickAction set to NEWS_FEED is clicked.
     AppboyPlatform.Universal.Appboy.SharedInstance.SlideupManager.FeedModal = new AppboyUI.Universal.Popups.FeedPopup();
 }
Exemplo n.º 13
0
		/// <summary>
		/// Initializes the singleton application object.  This is the first line of authored code
		/// executed, and as such is the logical equivalent of main() or WinMain().
		/// </summary>
		public App()
		{
			this.InitializeComponent();
			appCallbacks = new AppCallbacks(false);
			appCallbacks.RenderingStarted += RemoveSplashScreen;
      CustomXamlResourceLoader.Current = new TranslationResourceProvider();
      // BASIC SLIDEUP INTEGRATION:
      // Assigns the default Appboy slideup factory. The slideup will be displayed with the default Appboy slideup UI. The 
      // default Appboy UI can be themed by editing the AppboyUI.Universal stylesheet.
      AppboyPlatform.Universal.Appboy.SharedInstance.SlideupManager.SlideupControlFactory = new AppboyUI.Universal.Factories.SlideupControlFactory();
      // Sets the feed modal that should be displayed when a slideup with ClickAction set to NEWS_FEED is clicked.
      AppboyPlatform.Universal.Appboy.SharedInstance.SlideupManager.FeedModal = new AppboyUI.Universal.Popups.FeedPopup();
		}
Exemplo n.º 14
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();
            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

#if UNITY
            AppCallbacks appCallbacks = AppCallbacks.Instance;
            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

            bool isWindowsHolographic = false;

#if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the deviceFamily actually supports it,
            // otherwise we treat this as a normal XAML application
            string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
            isWindowsHolographic = String.Compare("Windows.Holographic", deviceFamily) == 0;
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager(Window.Current.CoreWindow);
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

#if UNITY_UWP
                if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
                {
                    isPhone = true;
                }
#endif
                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                //splash = ((App)App.Current).splashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;
            }
            PeerVideo.Visibility  = Visibility.Collapsed;
            PeerVideo2.Visibility = Visibility.Collapsed;
            SelfVideo.Visibility  = Visibility.Collapsed;
#else
            DXSwapChainPanel.Visibility = Visibility.Collapsed;
#endif // UNITY
        }
Exemplo n.º 15
0
        public MainPage()
        {
            this.InitializeComponent();
            _catalog = AppExtensionCatalog.Open("Atmosphere");
            _catalog.PackageInstalled += _catalog_PackageInstalled;
            InstallPackageContent();

            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

            appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

            this.Loaded  += MainPage_Loaded;
            this.KeyDown += MainPage_KeyDown;

            _timer          = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromSeconds(2);
            _timer.Tick    += _timer_Tick;
            _timer.Start();

#if !UNITY_WP_8_1
            appCallbacks.SetKeyboardTriggerControl(this);
#endif
            appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
            appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
            appCallbacks.InitializeD3DXAML();

            splash = ((App)App.Current).splashScreen;
            GetSplashBackgroundColor();
            OnResize();
            onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
            Window.Current.SizeChanged += onResizeHandler;

#if UNITY_WP_8_1
            onRotationChangedHandler = new TypedEventHandler <DisplayInformation, object>((di, o) => { OnRotate(di); });
            ExtendedSplashImage.RenderTransformOrigin = new Point(0.5, 0.5);
            var displayInfo = DisplayInformation.GetForCurrentView();
            displayInfo.OrientationChanged += onRotationChangedHandler;
            OnRotate(displayInfo);

            SetupLocationService();
#endif
        }
Exemplo n.º 16
0
        public void Quit()
        {
            var tmp = this.appCallbacks;

            this.appCallbacks = null;

            if (tmp != null)
            {
                tmp.InvokeOnAppThread(() =>
                {
                    BridgeBootstrapper.SetDotNetBridge(null);
                }, true);

                tmp.Dispose();
            }
        }
        public UnityView()
        {
            this.InitializeComponent();

            if (!UnityUtils.IsInitialized)
            {
                UnityUtils.CreatePlayer();
            }

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

            bool isWindowsHolographic = false;

#if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the device actually supports it,
            // otherwise we treat this as a normal XAML application
            isWindowsHolographic = AppCallbacks.IsMixedRealitySupported();
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager(Window.Current.CoreWindow);
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

                if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
                {
                    isPhone = true;
                }

                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                splash = UnityUtils.splashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;
            }
        }
Exemplo n.º 18
0
        public ChatPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);
            appCallbacks.SetKeyboardTriggerControl(this);
            appCallbacks.SetSwapChainPanel(DXSwapChainPanel);
            appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
            appCallbacks.InitializeD3DXAML();
            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            App.mainSkype.messageReceived += messageReceived;
        }
Exemplo n.º 19
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            appCallbacks = new AppCallbacks();

            UnhandledException += LogUnhandledException;

            // Prevents display to dim while the app is visible:
            var displayRequest = new Windows.System.Display.DisplayRequest();

            displayRequest.RequestActive();

            InitializeExceptionLogger();

#if DEBUG
            DebugSettings.EnableFrameRateCounter = true;
#endif
        }
Exemplo n.º 20
0
        internal void Initialize(Control keyboardControl, SwapChainPanel swapPanel)
        {
            // Validate
            if (keyboardControl == null)
            {
                throw new ArgumentNullException(nameof(keyboardControl));
            }
            if (swapPanel == null)
            {
                throw new ArgumentNullException(nameof(swapPanel));
            }

            // If already initialized, just ignore
            if (initStarted)
            {
                throw new InvalidOperationException("Unity has already been initialized by another control. Be sure to set cache mode to required on the page that uses UnityView.");
            }
            initStarted = true;

            // Get callbacks singleton
            appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(bridge);

            // Subscribe to events in order to forward
            appCallbacks.Initialized      += AppCallbacks_Initialized;
            appCallbacks.RenderingStarted += AppCallbacks_RenderingStarted;

            // Not sure if we should always do this, never do this or make it an option
            appCallbacks.SetKeyboardTriggerControl(keyboardControl);

            // Wire up to swap panel
            appCallbacks.SetSwapChainPanel(swapPanel);

            // Leaving this for now since it handles visibility, closing etc.
            // Hoping it doesn't impact rendering by listening to size changed.
            appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);

            // Initialize D3D
            appCallbacks.InitializeD3DXAML();
        }
Exemplo n.º 21
0
        // This is the default setup to show location consent message box to the user
        // You can customize it to your needs, but do not remove it completely if your application
        // uses location services, as it is a requirement in Windows Store certification process
        private async void SetupLocationService()
        {
            AppCallbacks appCallbacks = AppCallbacks.Instance;

            if (!appCallbacks.IsLocationCapabilitySet())
            {
                return;
            }

            const string settingName     = "LocationContent";
            bool         userGaveConsent = false;

            object consent;
            var    settings           = Windows.Storage.ApplicationData.Current.LocalSettings;
            var    userWasAskedBefore = settings.Values.TryGetValue(settingName, out consent);

            if (!userWasAskedBefore)
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("Can this application use your location?", "Location services");

                var acceptCommand  = new Windows.UI.Popups.UICommand("Yes");
                var declineCommand = new Windows.UI.Popups.UICommand("No");

                messageDialog.Commands.Add(acceptCommand);
                messageDialog.Commands.Add(declineCommand);

                userGaveConsent = (await messageDialog.ShowAsync()) == acceptCommand;
                settings.Values.Add(settingName, userGaveConsent);
            }
            else
            {
                userGaveConsent = (bool)consent;
            }

            if (userGaveConsent)
            {                   // Must be called from UI thread
                appCallbacks.SetupGeolocator();
            }
        }
Exemplo n.º 22
0
        public MainPage()
        {
            this.InitializeComponent();
            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            bool isWindowsHolographic = false;

#if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the device actually supports it,
            // otherwise we treat this as a normal XAML application
            isWindowsHolographic = AppCallbacks.IsMixedRealitySupported();
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager(Window.Current.CoreWindow);
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

                if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
                {
                    isPhone = true;
                }

                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                splash = ((App)App.Current).splashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks = new AppCallbacks(false);
     appCallbacks.Initialized += RemoveSplashScreen;
 }
Exemplo n.º 24
0
 public App()
 {
     SetupOrientation();
     m_AppCallbacks = new AppCallbacks();
 }
Exemplo n.º 25
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks              = new AppCallbacks(false);
     appCallbacks.Initialized += appCallbacks_Initialized;
 }
Exemplo n.º 26
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks = new AppCallbacks();
 }
Exemplo n.º 27
0
 public App()
 {
     appCallbacks = new AppCallbacks(false);
 }
Exemplo n.º 28
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks              = new AppCallbacks();
     appCallbacks.Initialized += RemoveSplashScreen;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks = new AppCallbacks(false);
     appCallbacks.RenderingStarted += RemoveSplashScreen;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks = new AppCallbacks(false);
     appCallbacks.Initialized += appCallbacks_Initialized;
 }
Exemplo n.º 31
0
 /// <summary>
 /// This is where apps can hook up any additional setup they need to do before Unity intializes.
 /// </summary>
 /// <param name="appCallbacks"></param>
 virtual protected void AddAppCallbacks(AppCallbacks appCallbacks)
 {
     Debug.WriteLine("\t\t\t\t\t APP.CS: AddAppCallbacks");
 }
Exemplo n.º 32
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     appCallbacks = new AppCallbacks();
 }
Exemplo n.º 33
0
 public App()
 {
     _appCallbacks = new AppCallbacks(SendInputData);
 }
Exemplo n.º 34
0
 /// <summary>
 /// This is where apps can hook up any additional setup they need to do before Unity intializes.
 /// </summary>
 /// <param name="appCallbacks"></param>
 virtual protected void AddAppCallbacks(AppCallbacks appCallbacks)
 {
 }
Exemplo n.º 35
0
        public MainPage()
        {
            this.InitializeComponent();
            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            Cars = new List <CarPrefabDetails>
            {
                new CarPrefabDetails {
                    Name = "Yellow Car", ImagePath = "/Assets/Car_0.png", ResourcePath = "Car_0"
                },
                new CarPrefabDetails {
                    Name = "Red Car", ImagePath = "/Assets/Car_1.png", ResourcePath = "Car_1"
                },
                new CarPrefabDetails {
                    Name = "Orange Van", ImagePath = "/Assets/Car_2.png", ResourcePath = "Car_2"
                },
                new CarPrefabDetails {
                    Name = "Bus", ImagePath = "/Assets/Bus.png", ResourcePath = "Bus"
                },
                new CarPrefabDetails {
                    Name = "Truck", ImagePath = "/Assets/Truck.png", ResourcePath = "Truck"
                }
            };

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

            bool isWindowsHolographic = false;

#if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the deviceFamily actually supports it,
            // otherwise we treat this as a normal XAML application
            string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
            isWindowsHolographic = String.Compare("Windows.Holographic", deviceFamily) == 0;
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager(Window.Current.CoreWindow);
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

#if UNITY_UWP
                if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
                {
                    isPhone = true;
                }
#endif
#if !UNITY_WP_8_1
                appCallbacks.SetKeyboardTriggerControl(this);
#else
                isPhone = true;
#endif
                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                splash = ((App)App.Current).splashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;

#if UNITY_WP_8_1
                onRotationChangedHandler = new TypedEventHandler <DisplayInformation, object>((di, o) => { OnRotate(di); });
                ExtendedSplashImage.RenderTransformOrigin = new Point(0.5, 0.5);
                var displayInfo = DisplayInformation.GetForCurrentView();
                displayInfo.OrientationChanged += onRotationChangedHandler;
                OnRotate(displayInfo);

                SetupLocationService();
#endif
            }
        }
Exemplo n.º 36
0
        public MainPage()
        {
            this.InitializeComponent();

            //Call the pointers of the screen. We use the pointers for draw and send position
            pointers = new Dictionary <uint, Windows.UI.Xaml.Input.Pointer>();

            VideoBorder.PointerMoved += new PointerEventHandler(VideoBorder_PointerMoved);
            NavigationCacheMode       = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;


            try
            {
                // connect to socket.io via other server when App start
                socketWrapper = new SocketWrapper();

                socketWrapper.OnReceiveMessenger += OnReceivedMessage_handler;
                socketWrapper.onDisconnect       += OnDisconnection_handler;
                socketWrapper.Connect("ws://172.16.6.10:3001/socket.io/?EIO=4&transport=websocket");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

#if UNITY
            AppCallbacks appCallbacks = AppCallbacks.Instance;
            // Setup scripting bridge
            _bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(_bridge);

            bool isWindowsHolographic = false;

#if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the deviceFamily actually supports it,
            // otherwise we treat this as a normal XAML application
            string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
            isWindowsHolographic = String.Compare("Windows.Holographic", deviceFamily) == 0;
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager(Window.Current.CoreWindow);
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

#if UNITY_UWP
                if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
                {
                    isPhone = true;
                }
#endif
                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                //splash = ((App)App.Current).splashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;
            }
            PeerVideo.Visibility = Visibility.Collapsed;
            SelfVideo.Visibility = Visibility.Collapsed;
#else
            DXSwapChainPanel.Visibility = Visibility.Collapsed;
#endif // UNITY
        }
Exemplo n.º 37
0
 public StartPage()
 {
     
     this.InitializeComponent();
     appCallbacks = new AppCallbacks(false);
 }
Exemplo n.º 38
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     SetupOrientation();
     appCallbacks = new AppCallbacks();
 }
Exemplo n.º 39
0
 /// <summary>
 /// This is where apps can hook up any additional setup they need to do before Unity intializes.
 /// </summary>
 /// <param name="appCallbacks"></param>
 protected virtual void AddAppCallbacks(AppCallbacks appCallbacks)
 {
 }