コード例 #1
0
        private void Open()
        {
            if (this.isOpened)
            {
                return;
            }

            this.isOpened = true;
            this.UpdateLayout();
            this.storyboardFadeIn?.Begin(this);

            Menu.CloseAll();

            // ReSharper disable once CanExtractXamlLocalizableStringCSharp
            inputContext = ClientInputContext.Start("Respawn menu - intercept all other input")
                           .HandleAll(
                () =>
            {
                if (ClientInputManager.IsButtonDown(GameButton.CancelOrClose))
                {
                    MainMenuOverlay.Toggle();
                }

                ClientInputManager.ConsumeAllButtons();
            });
        }
コード例 #2
0
        public static void Open()
        {
            if (!isClosed)
            {
                return;
            }

            isClosed = false;
            var menu = new MenuCharacterCreation();

            instance = menu;

            Api.Client.UI.LayoutRootChildren.Add(instance);

            Menu.CloseAll();

            // ReSharper disable once CanExtractXamlLocalizableStringCSharp
            inputContext = ClientInputContext.Start("Character creation menu - intercept all other input")
                           .HandleAll(
                () =>
            {
                if (ClientInputManager.IsButtonDown(GameButton.CancelOrClose))
                {
                    MainMenuOverlay.Toggle();
                }

                ClientInputManager.ConsumeAllButtons();
            });
        }
コード例 #3
0
        private void InputCallback()
        {
            var keyDown = Client.Input
                          .GetAllKeysDown(evenIfHandled: true)
                          .FirstOrDefault();

            if (keyDown != InputKey.None)
            {
                this.HandleKeyDown(keyDown);
            }

            ClientInputManager.ConsumeAllButtons();
        }
コード例 #4
0
        protected override void WindowOpening()
        {
            this.suppressInputContext = ClientInputContext
                                        .Start("Window items browser - intercept all other input")
                                        .HandleAll(() =>
            {
                if (ClientInputManager.IsButtonDown(GameButton.CancelOrClose))
                {
                    this.CloseWindow();
                }

                ClientInputManager.ConsumeAllButtons();
            });

            this.DataContext = this.viewModel = new ViewModelWindowEditorItemsBrowser(
                closeCallback: () => this.CloseWindow());
        }
コード例 #5
0
        public ViewModelFeaturesSlideshow()
        {
            this.inputContext = ClientInputContext
                                .Start(nameof(ViewModelFeaturesSlideshow))
                                .HandleAll(
                () =>
            {
                if (ClientInputManager.IsButtonDown(GameButton.CancelOrClose) &&
                    (this.IsCloseButtonVisible
                     // for debug purposes allow to skip the slideshow
                     // in a debug build or when the Shift key is held
                     || Api.Shared.IsDebug ||
                     Api.Client.Input.IsKeyHeld(InputKey.Shift)))
                {
                    this.ExecuteCommandClose();
                }

                ClientInputManager.ConsumeAllButtons();
            });

            this.Entries = FeaturesSlideshowEntries
                           .Entries
                           .Select(e => new ViewModelFeaturesSlideshowEntry(
                                       e.Title,
                                       e.Description,
                                       new TextureResource(e.TextureImagePath)))
                           .ToArray();

            this.IsCloseButtonVisible = FeaturesSlideshow.IsSlideShowFinishedAtLeastOnce;

            if (this.IsCloseButtonVisible)
            {
                this.maxDisplayedEntryIndex = this.Entries.Count - 1;
            }
            else
            {
                this.maxDisplayedEntryIndex = -1;
            }

            this.RefreshNavigationButtons();
        }