示例#1
0
        public static void Create(MainWindow WND_Owner, GameType GameType)
        {
            Owner           = WND_Owner;
            RandomGenerator = new Random();

            gameType = GameType;

            CreateSettingsWindow();
            mediaContainer = new GameMediaContainer();

            Owner.DataContext = new MainWindowVM((SettingsWindowVM)SettingsWindow.DataContext);

            Player Snd = new PlayerWpf("PlayerSound", mediaContainer, Owner.MediaElementSound);
            Player Msc = new PlayerWpf("PlayerMusic", mediaContainer, Owner.MediaElementSound);

            Sound = new GameSound(ref Snd);
            Music = new GameMusic(ref Msc);


            Music.MediaGUI.Add(Owner.MusicVolumeSlider);
            Game.Owner.MusicVolumeSlider.DataContext = Music.volume;
            Music.MediaGUI.UIMediaHide();


            if (Settings.GetInstance().VideoPlayerType == VideoPlayerType.wpf)
            {
                Player Vdowpf = new PlayerWpf("PlayerVideoWpf", mediaContainer, Owner.MediaElementVideo);
                VideoWpf = new GameVideo(ref Vdowpf);
                CurVideo = new GameVideo(ref Vdowpf);
                VideoPlayerSet(VideoWpf);
            }
        }
示例#2
0
        private void PlayVideo(GameVideo gameVideo)
        {
            var vlcExecutable = VlcUtilities.GetVlcExecutablePath();
            var cmdArgs       = gameVideo.GetVlcCmdArguments();

            Process.Start(vlcExecutable, cmdArgs);
        }
示例#3
0
    public static GameVideo GetInstance()
    {
        if (m_Instance == null)
        {
            m_Instance = GameMain.Instance.gameObject.AddComponent <GameVideo>();
        }

        return(m_Instance);
    }
示例#4
0
        public void CanValidateApps(string appPath, string appCmd, bool expectedResult)
        {
            var app = new AdditionalApplicationMock {
                ApplicationPath = appPath, CommandLine = appCmd
            };

            var isValid = GameVideo.IsAppCorrectlySetup(app);

            Assert.Equal(expectedResult, isValid);
        }
示例#5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public LoadingMenu(Texture2D[] panels, Texture2D[] backgroundAssets, GameVideo loadingVideo)
     : base(panels, backgroundAssets)
 {
     _loadingVideo = loadingVideo;
     LoadingMenu.Selected += (object sender, EventArgs args) =>
         {
             this.CurrentState = State.Shown;
             this._delay = 0;
             StartLoadingEvent();
             _loadingVideo.StartVideo();
         };
 }
示例#6
0
        public static void VideoPlayerSet(GameVideo gameVideo)
        {
            if (CurVideo == null)
            {
                return;
            }
            if (CurVideo.IsPlaying || CurVideo.IsPaused)
            {
                MessageBox.Show("Cannt change videoplayer while it play");
                return;
            }
            gameVideo.MediaGUI.Clear();

            CurVideo = gameVideo;
            CurVideo.MediaGUI.UIMediaHide();
        }
示例#7
0
        public VideoManagerForm(IGame game)
        {
            InitializeComponent();
            _game = game;

            this.Text = "Manage videos for: " + game.Title;

            var videoAppList = _game.GetAllAdditionalApplications()
                               .Where(x => x.Name.StartsWith(GameVideo.TitlePrefix))
                               .ToList();

            foreach (var app in videoAppList)
            {
                var gameVideo = new GameVideo(app);
                _gameVideos.Add(gameVideo);
            }
        }
示例#8
0
    void LoadVideoSettings()
    {
        FileInfo fileInf = new FileInfo(videoSettingsFilePath);

        if (!fileInf.Exists)
        {
            GameVideo.SetDefaultSettings();
            return;
        }
        XmlDocument xDoc = new XmlDocument();

        AES.DecryptFile(videoSettingsFilePath, true);
        xDoc.Load(videoSettingsFilePath);
        AES.EncryptFile(videoSettingsFilePath, true);
        XmlElement xRoot = xDoc.DocumentElement;

        foreach (XmlNode xData in xRoot)
        {
            switch (xData.Name)
            {
            case "Resolution":
                int width  = int.Parse(xData.Attributes.GetNamedItem("Width").Value);
                int height = int.Parse(xData.Attributes.GetNamedItem("Height").Value);
                Screen.SetResolution(width, height, true);
                GameVideo.screenResolution = Screen.currentResolution;
                break;

            case "Anisotropic":
                bool filtering = bool.Parse(xData.Attributes.GetNamedItem("Value").Value);
                GameVideo.SetAnisotropicFiltering(filtering);
                break;

            case "AntiAliasing":
                int aliasing = int.Parse(xData.Attributes.GetNamedItem("Value").Value);
                GameVideo.SetAntiAliasing(aliasing);
                break;

            default:
                throw new ArgumentException("Wrong data in file");
            }
        }
    }
示例#9
0
        public void CanImportAndExportAppDetails()
        {
            var additionalAppDummy = new AdditionalApplicationMock
            {
                ApplicationPath = VlcUtilities.GetVlcExecutablePath(),
                Name            = "Video: Presentation",
                CommandLine     = "-f --start-time=337 --stop-time=387 https://youtu.be/q_7KUC6CY6Q"
            };

            var gameMock = Substitute.For <IGame>();

            gameMock.AddNewAdditionalApplication().Returns(new AdditionalApplicationMock());

            var video = new GameVideo(additionalAppDummy);

            var exportedApp = video.AddVideoToGame(gameMock);

            Assert.Equal(additionalAppDummy.ApplicationPath, exportedApp.ApplicationPath);
            Assert.Equal(additionalAppDummy.Name, exportedApp.Name);
            Assert.Equal("-f --play-and-exit --start-time=337 --stop-time=387 https://youtu.be/q_7KUC6CY6Q",
                         exportedApp.CommandLine);
        }
示例#10
0
        /// <summary>
        /// Builds a new video model.
        /// </summary>
        /// <param name="addToList">If true, it will add it to the loaded game's additional apps list.</param>
        /// <returns>The game video model.</returns>
        private GameVideo BuildNewVideo(bool addToList)
        {
            var title = txtVideoTitle.Text.Trim();
            var path  = txtVideoPath.Text.Trim();

            if (!string.IsNullOrEmpty(title) && !string.IsNullOrEmpty(path))
            {
                if (_gameVideos.Any(x => x.Title.Equals(title, StringComparison.CurrentCultureIgnoreCase)))
                {
                    MessageBox.Show("A video with that title already exists for this game.");
                }
                else
                {
                    var newVideo = new GameVideo
                    {
                        Title     = txtVideoTitle.Text,
                        VideoPath = txtVideoPath.Text,
                        StartTime = ParseSecondsFromTextbox(txtStartTime.Text),
                        StopTime  = ParseSecondsFromTextbox(txtStopTime.Text)
                    };

                    if (addToList)
                    {
                        _gameVideos.Add(newVideo);
                        ResetNewVideoFields();
                    }

                    return(newVideo);
                }
            }
            else
            {
                MessageBox.Show("Please fill in all the required fields first.");
            }

            return(null);
        }
示例#11
0
        public void OnEventRaised(string eventType)
        {
            // On startup, we want to check if Launchbox's VLC distribution has the latest YouTube addon.
            if (eventType == SystemEventTypes.LaunchBoxStartupCompleted ||
                eventType == SystemEventTypes.BigBoxStartupCompleted)
            {
                VlcUtilities.VerifyYoutubeAddon();
            }
            else if (eventType == SystemEventTypes.SelectionChanged)
            {
                // When a game is selected, I want to check that the additional apps
                // for launching our videos are set up correctly.
                // This ensures that video link apps are always up to date with
                // the latest VLC path and command-line arguments.
                var selectedGames = PluginHelper.StateManager.GetAllSelectedGames();
                if (selectedGames.Length == 1)
                {
                    var game          = selectedGames[0];
                    var videoLinkApps = game.GetAllAdditionalApplications()
                                        .Where(x => x.Name.StartsWith(GameVideo.TitlePrefix))
                                        .ToList();

                    if (videoLinkApps.Count != 0)
                    {
                        foreach (var app in videoLinkApps)
                        {
                            if (!GameVideo.IsAppCorrectlySetup(app))
                            {
                                var gameVideo = new GameVideo(app);
                                gameVideo.UpdateExistingApp(app);
                            }
                        }
                    }
                }
            }
        }
示例#12
0
 public void ChangeAnisotropicFiltering()
 {
     GameVideo.SetAnisotropicFiltering(m_Anisotropic.isOn);
 }
示例#13
0
 public void ChangeAntiAliasing()
 {
     GameVideo.SetAntiAliasing(m_AntiAliasing.value * 2);
 }
示例#14
0
 public void ChangeCurrentResolution()
 {
     GameVideo.SetResolution(awailableResolution[m_Resolution.value].width, awailableResolution[m_Resolution.value].height);
 }