public GameEditorWindow( IAssetManager assetManager, ILoadedGame loadedGame, I2DRenderUtilities renderUtilities, IProjectManager projectManager) { _assetManager = assetManager; _loadedGame = loadedGame; _projectManager = projectManager; Title = "Game"; Icon = _assetManager.Get <TextureAsset>("texture.IconDirectionalPad"); _rawTextureContainer = new RawTextureContainer(renderUtilities); _rawTextureContainer.TextureFit = "ratio"; SetChild(_rawTextureContainer); }
public override void Render(IRenderContext context, ISkinLayout skinLayout, ISkinDelegator skinDelegator, Rectangle layout) { if (_recentProjectsTask == null) { _recentProjectsTask = _coroutine.Run(() => _recentProjects.GetRecentProjects(context)); } if (_recentProjectsTask.IsCompleted && !_hasAppliedRecentProjects) { foreach (var recentProject in _recentProjectsTask.Result) { var horizontalContainer = new ClickableHorizontalContainer(); if (recentProject.Thumbnail != null) { var textureContainer = new RawTextureContainer(_renderUtilities); textureContainer.Texture = recentProject.Thumbnail; textureContainer.TextureFit = "stretch"; horizontalContainer.AddChild(textureContainer, "60"); } else { horizontalContainer.AddChild(new EmptyContainer(), "60"); } var verticalContainer = new VerticalContainer(); verticalContainer.AddChild(new EmptyContainer(), "*"); verticalContainer.AddChild(new Label { Text = recentProject.Name, HorizontalAlignment = HorizontalAlignment.Left }, "16"); verticalContainer.AddChild(new EmptyContainer(), "*"); verticalContainer.AddChild(new Label { Text = recentProject.Path, HorizontalAlignment = HorizontalAlignment.Left, TextColor = new Color(63, 63, 63, 255) }, "16"); verticalContainer.AddChild(new EmptyContainer(), "*"); var button = new Button { Text = "Load", }; button.Click += (sender, e) => { _projectManager.LoadProject(recentProject.Path); }; horizontalContainer.Click += (sender, e) => { _projectManager.LoadProject(recentProject.Path); }; horizontalContainer.AddChild(new EmptyContainer(), "16"); horizontalContainer.AddChild(verticalContainer, "*"); horizontalContainer.AddChild(new EmptyContainer(), "16"); horizontalContainer.AddChild(button, "60"); _recentProjectsContainer.AddChild(horizontalContainer, "60"); _recentProjectsContainer.AddChild(new EmptyContainer(), "10"); } _hasAppliedRecentProjects = true; } base.Render(context, skinLayout, skinDelegator, layout); }