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);

			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
			SetupLocationService();
#endif
            Interop.LoadInterstitialEvent += Interop_LoadInterstitialEvent;
            Interop.ShowInterstitialEvent += Interop_ShowInterstitialEvent;
        }
예제 #2
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);

			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
		}
예제 #3
0
		// Constructor
		public MainPage()
		{
			var bridge = new UnityBridge();
			UnityApp.SetBridge(bridge);
			InitializeComponent();
			bridge.Control = DrawingSurfaceBackground;
          //  WP8Statics.WP8FunctionHandleSMSOpen += WP8Statics_OpenSMSHandle;
            WP8Statics.WP8FunctionHandleStopAds += WP8Statics_StopAds;
            WP8Statics.WP8FunctionHandleShowAds += WP8Statics_ShowAds;
            WP8Statics.WP8FunctionHandleRateApp += WP8Statics_RateApp;
            WP8Statics.WP8FunctionHandle2FbShared += WP8Statics_FbClickHandle;
            MainPage._mainPage = this;
            isShowAds = 1;
            if (isShowAds == 1)
            {

               // AdmobFullAdsShow();
			   //VservAdControl VMB = VservAdControl.Instance; //full ads
               //VMB.DisplayAd("xxxxxx", LayoutRoot);  //n_m_hoang
               //VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
               //VMB.VservAdError += new EventHandler(VACCallback_OnVservAdNetworkError);
               //VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
            }
			
		}
예제 #4
0
 // Constructor
 public MainPage()
 {
     var bridge = new UnityBridge();
     UnityApp.SetBridge(bridge);
     InitializeComponent();
     bridge.Control = DrawingSurfaceBackground;
 }
예제 #5
0
        /// <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)
        {
            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)
            {
                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();
        }
예제 #6
0
파일: App.cs 프로젝트: nor0x/HappyNerd
        public void Initialize(CoreApplicationView applicationView)
        {
            // Setup scripting bridge
            m_bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(m_bridge);

            appCallbacks.SetCoreApplicationViewEvents(applicationView);
        }
        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;
            Window.Current.VisibilityChanged += OnWindowVisibilityChanged;

#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
        }
예제 #8
0
		// Constructor
		public MainPage()
		{
			var bridge = new UnityBridge();
			UnityApp.SetBridge(bridge);
			InitializeComponent();
			bridge.Control = DrawingSurfaceBackground;

            WindowsGateway.OnClickPlay = OnClickPlay;
            
		}
예제 #9
0
        public virtual void Initialize(CoreApplicationView applicationView)
        {
            applicationView.Activated  += ApplicationView_Activated;
            CoreApplication.Suspending += CoreApplication_Suspending;

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

            m_AppCallbacks.SetCoreApplicationViewEvents(applicationView);
        }
예제 #10
0
        // Constructor
        public MainPage()
        {
            var bridge = new UnityBridge();

            UnityApp.SetBridge(bridge);
            InitializeComponent();
            bridge.Control = DrawingSurfaceBackground;

            Interop.ShowInterstitialEvent += Interop_ShowInterstitialEvent;
            Interop.LoadInterstitialEvent += Interop_LoadInterstitialEvent;
        }
예제 #11
0
        public virtual void Initialize(CoreApplicationView applicationView)
        {
            applicationView.Activated += ApplicationView_Activated;
            CoreApplication.Suspending += CoreApplication_Suspending;

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

            m_AppCallbacks.SetCoreApplicationViewEvents(applicationView);
        }
        public static int isShowAds = 1;//1 = true
		// Constructor
		public MainPage()
		{
			var bridge = new UnityBridge();
			UnityApp.SetBridge(bridge);
			InitializeComponent();
			bridge.Control = DrawingSurfaceBackground;
            VservAdControl VMB = VservAdControl.Instance; //full ads
            VMB.DisplayAd("0425a166", LayoutRoot);  //8063
            VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
            VMB.VservAdError += new EventHandler(VACCallback_OnVservAdNetworkError);
            VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
		}
예제 #13
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
            }
        }
예제 #14
0
        public virtual void Initialize(CoreApplicationView applicationView)
        {
            // UnityEngine.XR.XRDevice .SetTrackingSpaceType(UnityEngine.XR.TrackingSpaceType.Stationary);

            applicationView.Activated  += ApplicationView_Activated;
            CoreApplication.Suspending += CoreApplication_Suspending;

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

            m_AppCallbacks.SetCoreApplicationViewEvents(applicationView);
        }
예제 #15
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
        }
예제 #16
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
        }
예제 #17
0
        private void Mirror_Mode_Tapped(object sender, TappedRoutedEventArgs e)
        {
            
            var mainPage = new MainPage();
            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();
            this.Frame.Navigate(typeof(MainPage));
        }
예제 #18
0
        public virtual async void Initialize(CoreApplicationView applicationView)
        {
            DebugUtil.CheckAppThread();

            applicationView.Activated  += ApplicationView_Activated;
            CoreApplication.Suspending += CoreApplication_Suspending;

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

            _AppCallbacks.SetCoreApplicationViewEvents(applicationView);

            _audioGraphImpl = new AudioGraphImpl();
            await _audioGraphImpl.InitializeAsync();
        }
예제 #19
0
        // Constructor
        public MainPage()
        {
            var bridge = new UnityBridge();

            UnityApp.SetBridge(bridge);
            InitializeComponent();
            bridge.Control = DrawingSurfaceBackground;

            _extendedSplashTimer          = new DispatcherTimer();
            _extendedSplashTimer.Interval = TimeSpan.FromMilliseconds(50);
            _extendedSplashTimer.Tick    += ExtendedSplashTimer_Tick;
            _extendedSplashTimer.Start();

            // ensure we listen to when unity tells us game is ready
            WindowsGateway.UnityLoaded = OnUnityLoaded;
        }
        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;
            }
        }
예제 #21
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;
        }
예제 #22
0
		// Constructor
		public MainPage()
		{

			var bridge = new UnityBridge();
			UnityApp.SetBridge(bridge);
			InitializeComponent();
			bridge.Control = DrawingSurfaceBackground;

            _extendedSplashTimer = new DispatcherTimer();
            _extendedSplashTimer.Interval = TimeSpan.FromMilliseconds(50);
            _extendedSplashTimer.Tick += ExtendedSplashTimer_Tick;
            _extendedSplashTimer.Start();

            // ensure we listen to when unity tells us game is ready
            WindowsGateway.UnityLoaded = OnUnityLoaded;

    
		}
예제 #23
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();
        }
        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
        }
        // Constructor
        public MainPage()
        {
            var bridge = new UnityBridge();

            UnityApp.SetBridge(bridge);
            InitializeComponent();
            bridge.Control = DrawingSurfaceBackground;
            //  WP8Statics.WP8FunctionHandleSMSOpen += WP8Statics_OpenSMSHandle;
            WP8Statics.WP8FunctionHandleStopAds   += WP8Statics_StopAds;
            WP8Statics.WP8FunctionHandleShowAds   += WP8Statics_ShowAds;
            WP8Statics.WP8FunctionHandleRateApp   += WP8Statics_RateApp;
            WP8Statics.WP8FunctionHandle2FbShared += WP8Statics_FbClickHandle;
            MainPage._mainPage = this;
            isShowAds          = 1;
            if (isShowAds == 1)
            {
                VservAdControl VMB = VservAdControl.Instance; //full ads
                VMB.DisplayAd("7d2532e8", LayoutRoot);        //n_m_hoang
                VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
                VMB.VservAdError  += new EventHandler(VACCallback_OnVservAdNetworkError);
                VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
            }
        }
예제 #26
0
        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();
            }

            SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;

            Window.Current.Activate();
        }
예제 #27
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
        }
예제 #28
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
            }
        }
		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
		}