Simplify collection initialization
This commit is contained in:
committed by
atlimit8
parent
cae43808d9
commit
aa998a46d9
@@ -181,9 +181,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
continue;
|
||||
|
||||
var actor = a.Actor;
|
||||
var td = new TypeDictionary();
|
||||
td.Add(new OwnerInit(selectedOwner.Name));
|
||||
td.Add(new FactionInit(selectedOwner.Faction));
|
||||
var td = new TypeDictionary
|
||||
{
|
||||
new OwnerInit(selectedOwner.Name),
|
||||
new FactionInit(selectedOwner.Faction)
|
||||
};
|
||||
foreach (var api in actor.TraitInfos<IActorPreviewInitInfo>())
|
||||
foreach (var o in api.ActorPreviewInits(actor, ActorPreviewType.MapEditorSidebar))
|
||||
td.Add(o);
|
||||
|
||||
@@ -418,13 +418,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
? new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height)
|
||||
: w.Parent.Bounds;
|
||||
|
||||
var substitutions = new Dictionary<string, int>();
|
||||
substitutions.Add("WINDOW_RIGHT", Game.Renderer.Resolution.Width);
|
||||
substitutions.Add("WINDOW_BOTTOM", Game.Renderer.Resolution.Height);
|
||||
substitutions.Add("PARENT_RIGHT", parentBounds.Width);
|
||||
substitutions.Add("PARENT_LEFT", parentBounds.Left);
|
||||
substitutions.Add("PARENT_TOP", parentBounds.Top);
|
||||
substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
|
||||
var substitutions = new Dictionary<string, int>
|
||||
{
|
||||
{ "WINDOW_RIGHT", Game.Renderer.Resolution.Width },
|
||||
{ "WINDOW_BOTTOM", Game.Renderer.Resolution.Height },
|
||||
{ "PARENT_RIGHT", parentBounds.Width },
|
||||
{ "PARENT_LEFT", parentBounds.Left },
|
||||
{ "PARENT_TOP", parentBounds.Top },
|
||||
{ "PARENT_BOTTOM", parentBounds.Height }
|
||||
};
|
||||
|
||||
var width = Evaluator.Evaluate(w.Width, substitutions);
|
||||
var height = Evaluator.Evaluate(w.Height, substitutions);
|
||||
|
||||
Reference in New Issue
Block a user