Asynchronous loading of map previews in the map chooser dialog
This commit is contained in:
@@ -26,7 +26,7 @@ namespace OpenRA.Widgets
|
||||
public bool IgnoreMouseInput = false;
|
||||
public bool ShowSpawnPoints = true;
|
||||
|
||||
static Cache<Map,Bitmap> PreviewCache = new Cache<Map, Bitmap>(stub => Minimap.RenderMapPreview( new Map( stub.Path )));
|
||||
static readonly Cache<Map,Bitmap> PreviewCache = new Cache<Map, Bitmap>(stub => Minimap.RenderMapPreview( new Map( stub.Path )));
|
||||
|
||||
public MapPreviewWidget() : base() { }
|
||||
|
||||
@@ -118,5 +118,16 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forces loading the preview into the map cache.
|
||||
/// </summary>
|
||||
public Bitmap LoadMapPreview()
|
||||
{
|
||||
var map = Map();
|
||||
if( map == null ) return null;
|
||||
|
||||
return PreviewCache[map];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user