コード例 #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
        internal WndTopLevelWindow(WndFile wndFile, WndWindow root, WndCallbackResolver callbackResolver)
        {
            Root = root;

            LayoutInit     = callbackResolver.GetGuiWindowCallback(wndFile.LayoutBlock.LayoutInit);
            LayoutUpdate   = callbackResolver.GetGuiWindowCallback(wndFile.LayoutBlock.LayoutUpdate);
            LayoutShutdown = callbackResolver.GetGuiWindowCallback(wndFile.LayoutBlock.LayoutShutdown);
        }
コード例 #3
0
        internal WndTopLevelWindow(WndFile wndFile, WndWindow root)
        {
            Root = root;

            LayoutInit     = CallbackUtility.GetGuiWindowCallback(wndFile.LayoutBlock.LayoutInit);
            LayoutUpdate   = CallbackUtility.GetGuiWindowCallback(wndFile.LayoutBlock.LayoutUpdate);
            LayoutShutdown = CallbackUtility.GetGuiWindowCallback(wndFile.LayoutBlock.LayoutShutdown);
        }
コード例 #4
0
ファイル: WndFileTests.cs プロジェクト: ybwsfl/OpenSAGE
        public void CanReadWndFiles()
        {
            InstalledFilesTestData.ReadFiles(".wnd", _output, entry =>
            {
                var wndFile = WndFile.FromFileSystemEntry(entry);

                Assert.NotNull(wndFile);
            });
        }
コード例 #5
0
ファイル: Window.cs プロジェクト: hcll123456/OpenSAGE
 public Window(WndFile wndFile, Game game, WndCallbackResolver wndCallbackResolver)
     : this(wndFile.RootWindow.ScreenRect.CreationResolution, CreateRootControl(wndFile, game.ContentManager, game.AssetStore, wndCallbackResolver), game.ContentManager)
 {
     Game           = game;
     Bounds         = wndFile.RootWindow.ScreenRect.ToRectangle();
     LayoutInit     = wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutInit);
     LayoutUpdate   = wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutUpdate);
     LayoutShutdown = wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutShutdown);
 }
コード例 #6
0
ファイル: Window.cs プロジェクト: hcll123456/OpenSAGE
 private static Control CreateRootControl(
     WndFile wndFile,
     ContentManager contentManager,
     AssetStore assetStore,
     WndCallbackResolver wndCallbackResolver)
 {
     return(CreateRecursive(
                wndFile.RootWindow,
                contentManager,
                assetStore,
                wndCallbackResolver,
                wndFile.RootWindow.ScreenRect.UpperLeft));
 }
コード例 #7
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)
            });
        }
コード例 #8
0
        public Window(WndFile wndFile, Game game, WndCallbackResolver wndCallbackResolver)
            : this(wndFile.RootWindow.ScreenRect.CreationResolution, game.GraphicsLoadContext)
        {
            Game           = game;
            Bounds         = wndFile.RootWindow.ScreenRect.ToRectangle();
            LayoutInit     = wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutInit);
            LayoutUpdate   = wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutUpdate);
            LayoutShutdown = wndCallbackResolver.GetWindowCallback(wndFile.LayoutBlock.LayoutShutdown);

            Root = CreateRecursive(
                wndFile.RootWindow,
                ImageLoader,
                game.ContentManager,
                game.AssetStore,
                wndCallbackResolver,
                wndFile.RootWindow.ScreenRect.UpperLeft);
            Controls.Add(Root);
        }
コード例 #9
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);
        }
コード例 #10
0
        public WndFile ParseFile()
        {
            var result = new WndFile();

            while (Current.TokenType != WndTokenType.EndOfFile)
            {
                switch (Current.TokenType)
                {
                case WndTokenType.Identifier:
                    switch (Current.StringValue)
                    {
                    case "FILE_VERSION":
                        result.FileVersion = ParseProperty(NextIntegerLiteralTokenValue);
                        break;

                    case "STARTLAYOUTBLOCK":
                        result.LayoutBlock = ParseLayoutBlock();
                        break;

                    case "WINDOW":
                        result.RootWindow = ParseWindow();
                        break;

                    default:
                        UnexpectedToken(Current);
                        break;
                    }
                    break;

                default:
                    UnexpectedToken(Current);
                    break;
                }
            }

            return(result);
        }