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); }
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); }
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); }
public void CanReadWndFiles() { InstalledFilesTestData.ReadFiles(".wnd", _output, entry => { var wndFile = WndFile.FromFileSystemEntry(entry); Assert.NotNull(wndFile); }); }
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); }
private static Control CreateRootControl( WndFile wndFile, ContentManager contentManager, AssetStore assetStore, WndCallbackResolver wndCallbackResolver) { return(CreateRecursive( wndFile.RootWindow, contentManager, assetStore, wndCallbackResolver, wndFile.RootWindow.ScreenRect.UpperLeft)); }
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) }); }
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); }
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); }
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); }