Пример #1
0
        protected override WndTopLevelWindow LoadEntry(FileSystemEntry entry, ContentManager contentManager, Game game, LoadOptions loadOptions)
        {
            var wndFile = WndFile.FromFileSystemEntry(entry);

            var result = CreateElementRecursive(
                wndFile.RootWindow,
                contentManager,
                _wndCallbackResolver);

            var window = new WndTopLevelWindow(wndFile, result, _wndCallbackResolver);

            void setWindowRecursive(WndWindow element)
            {
                element.Window = window;

                foreach (var child in element.Children)
                {
                    setWindowRecursive(child);
                }
            }

            setWindowRecursive(result);

            return(window);
        }
Пример #2
0
        public void CanReadWndFiles()
        {
            InstalledFilesTestData.ReadFiles(".wnd", _output, entry =>
            {
                var wndFile = WndFile.FromFileSystemEntry(entry);

                Assert.NotNull(wndFile);
            });
        }
Пример #3
0
        protected override Window LoadEntry(FileSystemEntry entry, ContentManager contentManager, Game game, LoadOptions loadOptions)
        {
            var wndFile = WndFile.FromFileSystemEntry(entry);

            var rootControl = CreateElementRecursive(
                wndFile.RootWindow,
                contentManager,
                _wndCallbackResolver,
                wndFile.RootWindow.ScreenRect.ToRectangle().Location);

            return(new Window(wndFile.RootWindow.ScreenRect.CreationResolution, rootControl, contentManager)
            {
                LayoutInit = _wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutInit),
                LayoutUpdate = _wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutUpdate),
                LayoutShutdown = _wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutShutdown)
            });
        }
Пример #4
0
        public WndFileContentViewModel(FileSystemEntry file)
            : base(file)
        {
            _fileSystem = file.FileSystem;

            _csfFile = CsfFile.FromFileSystemEntry(_fileSystem.GetFile(@"Data\English\generals.csf"));

            var iniDataContext = new IniDataContext(_fileSystem);

            iniDataContext.LoadIniFiles(@"Data\INI\MappedImages\HandCreated\");
            iniDataContext.LoadIniFiles(@"Data\INI\MappedImages\TextureSize_512\");
            _mappedImages = iniDataContext.MappedImages;

            var wndFile = WndFile.FromFileSystemEntry(file);

            ContainerView = new NonInheritingCanvas
            {
                Width  = wndFile.RootWindow.ScreenRect.CreationResolution.Width,
                Height = wndFile.RootWindow.ScreenRect.CreationResolution.Height,
            };
            AddWindow(wndFile.RootWindow);
        }