update player list in lobby gracefully for better user experience

This commit is contained in:
Sascha Biedermann
2013-03-18 22:25:31 +01:00
parent 1fb2796ada
commit 770d79da0b
4 changed files with 69 additions and 11 deletions

View File

@@ -41,6 +41,11 @@ namespace OpenRA.Widgets
widget.ContentHeight = Math.Max(widget.ContentHeight, pos.Y + widget.ItemSpacing + w.Bounds.Height);
}
public void AdjustChildren()
{
}
}
}

View File

@@ -24,5 +24,16 @@ namespace OpenRA.Widgets
w.Bounds.Y += widget.ContentHeight;
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
}
public void AdjustChildren()
{
widget.ContentHeight = widget.ItemSpacing;
foreach (var w in widget.Children)
{
w.Bounds.Y = widget.ContentHeight;
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
}
}
}
}

View File

@@ -14,7 +14,7 @@ using OpenRA.Graphics;
namespace OpenRA.Widgets
{
public interface ILayout { void AdjustChild(Widget w); }
public interface ILayout { void AdjustChild(Widget w); void AdjustChildren(); }
public class ScrollPanelWidget : Widget
{
@@ -95,6 +95,8 @@ namespace OpenRA.Widgets
Game.Renderer.EnableScissor(backgroundRect.X + 1, backgroundRect.Y + 1, backgroundRect.Width - 2, backgroundRect.Height - 2);
Layout.AdjustChildren();
foreach (var child in Children)
child.DrawOuter();