Beispiel #1
0
        private void PushNextVideo()
        {
            if (Queue.IsEmpty())
            {
                CurrentlyPlaying = null;
                return;
            }

            //1. Get the next video from the queue
            Video next = Queue.GiveNextVideo();

            //2. Set the path relative to the current running instance
            if (next.BasePath != null)
            {
                next.BasePath = Path.Combine(ResourcePath, next.BasePath);
            }
            if (next.OnScreenEndingPath != null)
            {
                next.OnScreenEndingPath = Path.Combine(ResourcePath, next.OnScreenEndingPath);
            }
            if (next.OffScreenEndingPath != null)
            {
                next.OffScreenEndingPath = Path.Combine(ResourcePath, next.OffScreenEndingPath);
            }

            //3. Check if the video is valid
            if (File.Exists(next.BasePath))
            {
                //4. Replace the field and order the screen to play
                CurrentlyPlaying = PlayingVideo.MakeFromVideo(next);
                CurrentlyPlaying.SetBase();
                Screen.PlayVideo(new Uri(next.BasePath));
            }
        }
Beispiel #2
0
        void PlayVideo(VideoPlayerWidget 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();
            }
        }
Beispiel #3
0
		void StopVideo(WsaPlayerWidget player)
		{
			if (playingVideo == PlayingVideo.None)
				return;

			UnMuteSounds();
			player.Stop();
			playingVideo = PlayingVideo.None;
		}
Beispiel #4
0
        void StopVideo(VideoPlayerWidget player)
        {
            if (playingVideo == PlayingVideo.None)
            {
                return;
            }

            UnMuteSounds();
            player.Stop();
            playingVideo = PlayingVideo.None;
        }
Beispiel #5
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();
        }
Beispiel #6
0
        public bool OnQueueClearRequest(bool force)
        {
            //1. Clear the queue
            bool success = Queue.ClearQueue();

            if (force)
            {
                //2. Delete the currentlyplayingobject
                CurrentlyPlaying = null;

                //3. Interrupt the visual
                Screen.StopVideo();
                Screen.ClearVideo();
            }

            return(success);
        }
		void StopVideo(VqaPlayerWidget player)
		{
			if (playingVideo == PlayingVideo.None)
				return;

			UnMuteSounds();
			player.Stop();
			playingVideo = PlayingVideo.None;
		}
		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();
		}
        public NewMissionBrowserLogic(Widget widget, ModData modData, World world, Action onStart, Action onExit)
        {
            playingVideo = PlayingVideo.Briefing;

            this.modData          = modData;
            this.onStart          = onStart;
            Game.BeforeGameStart += OnGameStart;

            missionList = widget.Get <ScrollPanelWidget>("MISSION_LIST");

            headerTemplate = widget.Get <ScrollItemWidget>("HEADER");
            template       = widget.Get <ScrollItemWidget>("TEMPLATE");

            var title = widget.GetOrNull <LabelWidget>("MISSIONBROWSER_TITLE");

            if (title != null)
            {
                title.GetText = () => playingVideo != PlayingVideo.None ? selectedMap.Title : title.Text;
            }

            widget.Get("MISSION_INFO").IsVisible = () => selectedMap != null;

            var previewWidget = widget.Get <MapPreviewWidget>("MISSION_PREVIEW");

            previewWidget.Preview   = () => selectedMap;
            previewWidget.IsVisible = () => playingVideo == PlayingVideo.None;

            descriptionPanel = widget.Get <ScrollPanelWidget>("MISSION_DESCRIPTION_PANEL");

            description     = descriptionPanel.Get <LabelWidget>("MISSION_DESCRIPTION");
            descriptionFont = Game.Renderer.Fonts[description.Font];

            difficultyButton = widget.Get <DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
            gameSpeedButton  = widget.GetOrNull <DropDownButtonWidget>("GAMESPEED_DROPDOWNBUTTON");

            var allPreviews = new List <MapPreview>();

            missionList.RemoveChildren();

            // Add a group for each campaign
            if (modData.Manifest.Missions.Any())
            {
                var yaml = MiniYaml.Merge(modData.Manifest.Missions.Select(
                                              m => MiniYaml.FromStream(modData.DefaultFileSystem.Open(m), m)));

                foreach (var kv in yaml)
                {
                    var missionMapPaths = kv.Value.Nodes.Select(n => n.Key).ToList();

                    var previews = modData.MapCache
                                   .Where(p => p.Class == MapClassification.System && p.Status == MapStatus.Available)
                                   .Select(p => new
                    {
                        Preview = p,
                        Index   = missionMapPaths.IndexOf(Path.GetFileName(p.Package.Name))
                    })
                                   .Where(x => x.Index != -1)
                                   .OrderBy(x => x.Index)
                                   .Select(x => x.Preview);

                    if (previews.Any())
                    {
                        CreateMissionGroup(kv.Key, previews);
                        allPreviews.AddRange(previews);
                    }
                }
            }

            // Add an additional group for loose missions
            var loosePreviews = modData.MapCache
                                .Where(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector) && !allPreviews.Any(a => a.Uid == p.Uid));

            if (loosePreviews.Any())
            {
                CreateMissionGroup("Missions", loosePreviews);
                allPreviews.AddRange(loosePreviews);
            }

            if (allPreviews.Any())
            {
                SelectMap(allPreviews.First());
            }

            // Preload map preview and rules to reduce jank
            new Thread(() =>
            {
                foreach (var p in allPreviews)
                {
                    p.GetMinimap();
                    p.PreloadRules();
                }
            }).Start();

            var startButton = widget.Get <ButtonWidget>("STARTGAME_BUTTON");

            startButton.OnClick    = StartMissionClicked;
            startButton.IsDisabled = () => selectedMap == null || selectedMap.InvalidCustomRules;

            widget.Get <ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                Game.Disconnect();
                Ui.CloseWindow();
                onExit();
            };
        }
Beispiel #10
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);
                    if (onComplete != null)
                        onComplete();
                });

                // Mute other distracting sounds
                MuteSounds();
            }
        }