示例#1
0
 public void Draw(GameTime gameTime, BaseGame game)
 {
 }
        public GamePage(string launchArguments)
        {
            _toasts = new Queue <DelayedToast>();
            InitializeComponent();

            // Create the game.
            _game = XamlGame <BaseGame> .Create(launchArguments, Window.Current.CoreWindow, this);

            _game.ParentInterface = this;
            _windowBounds         = Window.Current.Bounds;
            // Added to listen for events when the window size is updated.
            Window.Current.SizeChanged += (s, e) =>
            {
                _windowBounds      = Window.Current.Bounds;
                _pausePopup.Width  = _windowBounds.Width;
                _pausePopup.Height = _windowBounds.Height;
            };
            SettingsPane.GetForCurrentView().CommandsRequested += (s, e) =>
            {
                UICommandInvokedHandler handler = command =>
                {
                    // Create a Popup window which will contain our flyout.
                    if (_settingsPopup == null)
                    {
                        _settingsPopup = new Popup();

                        _settingsPopup.Closed += (s2, e2) =>
                        {
                            Window.Current.Activated -= OnWindowActivated;
                            if (_toasts.Count == 0)
                            {
                                return;
                            }
                            var t = _toasts.Dequeue();
                            ShowToast(t.Toast, t.Title, t.Time);
                        };
                        Window.Current.Activated += OnWindowActivated;

                        _settingsPopup.IsLightDismissEnabled = true;
                        _settingsPopup.Width  = SettingsWidth;
                        _settingsPopup.Height = _windowBounds.Height;

                        // Add the proper animation for the panel.
                        _settingsPopup.ChildTransitions = new TransitionCollection
                        {
                            new PaneThemeTransition
                            {
                                Edge =
                                    (SettingsPane.Edge ==
                                     SettingsEdgeLocation.Right)
                                                                                    ? EdgeTransitionLocation.Right
                                                                                    : EdgeTransitionLocation.Left
                            }
                        };

                        // Create a SettingsFlyout the same dimenssions as the Popup.
                        var mypane = _game.Settings;
                        mypane.Width         = SettingsWidth;
                        mypane.Height        = _windowBounds.Height;
                        _settingsPopup.Child = mypane;
                    }
                    _settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (_windowBounds.Width - SettingsWidth) : 0);
                    _settingsPopup.SetValue(Canvas.TopProperty, 0);
                    _settingsPopup.IsOpen = true;
                };
                e.Request.ApplicationCommands.Add(new SettingsCommand("SettingsID", "Game Settings", handler));
            };
        }
示例#3
0
 public IGState Update(GameTime gameTime, BaseGame game)
 {
     return(this);
 }