Exemple #1
0
        void PlayVideo(VqaPlayerWidget player, string video, PlayingVideo pv, Action onComplete = null)
        {
            if (!modData.DefaultFileSystem.Exists(video))
            {
                ConfirmationDialogs.ButtonPrompt(
                    title: "Video not installed",
                    text: "The game videos can be installed from the\n\"Manage Content\" menu in the mod chooser.",
                    cancelText: "Back",
                    onCancel: () => { });
            }
            else
            {
                StopVideo(player);

                playingVideo = pv;
                player.Load(video);

                // video playback runs asynchronously
                player.PlayThen(() =>
                {
                    StopVideo(player);
                    onComplete?.Invoke();
                });

                // Mute other distracting sounds
                MuteSounds();
            }
        }
Exemple #2
0
        void SelectMap(Map map)
        {
            StopVideo();

            selectedMapPreview = Game.modData.MapCache[map.Uid];

            // Cache the rules on a background thread to avoid jank
            new Thread(selectedMapPreview.CacheRules).Start();

            var video         = selectedMapPreview.Map.PreviewVideo;
            var videoVisible  = video != null;
            var videoDisabled = !(videoVisible && GlobalFileSystem.Exists(video));

            startVideoButton.IsVisible  = () => videoVisible && !showVideoPlayer;
            startVideoButton.IsDisabled = () => videoDisabled;
            startVideoButton.OnClick    = () =>
            {
                showVideoPlayer = true;
                videoPlayer.Load(video);
                videoPlayer.PlayThen(StopVideo);

                // Mute other distracting sounds
                cachedSoundVolume = Sound.SoundVolume;
                cachedMusicVolume = Sound.MusicVolume;
                Sound.SoundVolume = Sound.MusicVolume = 0;
            };

            var text = map.Description != null?map.Description.Replace("\\n", "\n") : "";

            text                      = WidgetUtils.WrapText(text, description.Bounds.Width, descriptionFont);
            description.Text          = text;
            description.Bounds.Height = descriptionFont.Measure(text).Y;
            descriptionPanel.ScrollToTop();
            descriptionPanel.Layout.AdjustChildren();
        }
Exemple #3
0
        void PlayVideo(VqaPlayerWidget player, string video, PlayingVideo pv, Action onComplete)
        {
            StopVideo(player);

            playingVideo = pv;
            player.Load(video);

            // video playback runs asynchronously
            player.PlayThen(onComplete);

            // Mute other distracting sounds
            MuteSounds();
        }