Beispiel #1
0
 public AssetViewContext(Game game, ImGuiGamePanel gamePanel, ImGuiRenderer imGuiRenderer, FileSystemEntry entry)
 {
     Game           = game;
     GamePanel      = gamePanel;
     GraphicsDevice = game.GraphicsDevice;
     ImGuiRenderer  = imGuiRenderer;
     Entry          = entry;
 }
Beispiel #2
0
        private void ChangeInstallation(GameInstallation installation)
        {
            _selectedInstallation = installation;

            _imGuiRenderer.ClearCachedImageResources();

            RemoveAndDispose(ref _contentView);
            _files = null;
            RemoveAndDispose(ref _game);
            RemoveAndDispose(ref _gamePanel);
            RemoveAndDispose(ref _fileSystem);
            RemoveAndDispose(ref _launcherImage);

            if (installation == null)
            {
                _files = new List <FileSystemEntry>();
                return;
            }

            _fileSystem = AddDisposable(installation.CreateFileSystem());

            var launcherImagePath = installation.Game.LauncherImagePath;

            if (launcherImagePath != null)
            {
                var prefixLang = installation.Game.LauncherImagePrefixLang;
                if (prefixLang)
                {
                    var lang = LanguageUtility.ReadCurrentLanguage(installation.Game, _fileSystem.RootDirectory);
                    launcherImagePath = lang + launcherImagePath;
                }

                var launcherImageEntry = _fileSystem.GetFile(launcherImagePath);

                if (launcherImageEntry != null)
                {
                    _launcherImage = AddDisposable(new ImageSharpTexture(launcherImageEntry.Open()).CreateDeviceTexture(
                                                       _gameWindow.GraphicsDevice, _gameWindow.GraphicsDevice.ResourceFactory));
                }
            }

            _files = _fileSystem.Files.OrderBy(x => x.FilePath).ToList();

            _currentFile = -1;

            _gamePanel = AddDisposable(new ImGuiGamePanel(_gameWindow));
            _gamePanel.EnsureFrame(new Mathematics.Rectangle(0, 0, 100, 100));

            _game = AddDisposable(GameFactory.CreateGame(
                                      installation,
                                      _fileSystem,
                                      _gamePanel));

            //InstallationChanged?.Invoke(this, new InstallationChangedEventArgs(installation, _fileSystem));
        }
Beispiel #3
0
        private void ChangeInstallation(GameInstallation installation)
        {
            _selectedInstallation = installation;

            _imGuiRenderer.ClearCachedImageResources();

            RemoveAndDispose(ref _contentView);
            _files = null;
            RemoveAndDispose(ref _game);
            RemoveAndDispose(ref _gamePanel);
            RemoveAndDispose(ref _fileSystem);
            RemoveAndDispose(ref _launcherImage);

            if (installation == null)
            {
                _files = new List <FileSystemEntry>();
                return;
            }

            var launcherImagePath = installation.Game.LauncherImagePath;

            if (launcherImagePath != null)
            {
                var fullImagePath = Path.Combine(installation.Path, launcherImagePath);
                if (File.Exists(fullImagePath))
                {
                    _launcherImage = AddDisposable(new ImageSharpTexture(fullImagePath).CreateDeviceTexture(
                                                       _gameWindow.GraphicsDevice, _gameWindow.GraphicsDevice.ResourceFactory));
                }
            }

            _fileSystem = AddDisposable(installation.CreateFileSystem());

            _files = _fileSystem.Files.OrderBy(x => x.FilePath).ToList();

            _currentFile = -1;

            _gamePanel = AddDisposable(new ImGuiGamePanel(_gameWindow));
            _gamePanel.EnsureFrame(new Mathematics.Rectangle(0, 0, 100, 100));

            _game = AddDisposable(GameFactory.CreateGame(
                                      installation,
                                      _fileSystem,
                                      _gamePanel));

            //InstallationChanged?.Invoke(this, new InstallationChangedEventArgs(installation, _fileSystem));
        }