Migrate to System.Lazy.
This commit is contained in:
@@ -24,12 +24,12 @@ namespace OpenRA
|
||||
|
||||
public readonly World World;
|
||||
public readonly uint ActorID;
|
||||
public OpenRA.FileFormats.Lazy<Rectangle> Bounds;
|
||||
public Lazy<Rectangle> Bounds;
|
||||
|
||||
OpenRA.FileFormats.Lazy<IOccupySpace> occupySpace;
|
||||
OpenRA.FileFormats.Lazy<IFacing> facing;
|
||||
OpenRA.FileFormats.Lazy<Health> health;
|
||||
OpenRA.FileFormats.Lazy<IEffectiveOwner> effectiveOwner;
|
||||
Lazy<IOccupySpace> occupySpace;
|
||||
Lazy<IFacing> facing;
|
||||
Lazy<Health> health;
|
||||
Lazy<IEffectiveOwner> effectiveOwner;
|
||||
|
||||
public IOccupySpace OccupiesSpace { get { return occupySpace.Value; } }
|
||||
public IEffectiveOwner EffectiveOwner { get { return effectiveOwner.Value; } }
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA
|
||||
if (initDict.Contains<OwnerInit>())
|
||||
Owner = init.Get<OwnerInit, Player>();
|
||||
|
||||
occupySpace = Lazy.New(() => TraitOrDefault<IOccupySpace>());
|
||||
occupySpace = Exts.Lazy(() => TraitOrDefault<IOccupySpace>());
|
||||
|
||||
if (name != null)
|
||||
{
|
||||
@@ -74,14 +74,14 @@ namespace OpenRA
|
||||
AddTrait(trait.Create(init));
|
||||
}
|
||||
|
||||
facing = Lazy.New(() => TraitOrDefault<IFacing>());
|
||||
health = Lazy.New(() => TraitOrDefault<Health>());
|
||||
effectiveOwner = Lazy.New(() => TraitOrDefault<IEffectiveOwner>());
|
||||
facing = Exts.Lazy(() => TraitOrDefault<IFacing>());
|
||||
health = Exts.Lazy(() => TraitOrDefault<Health>());
|
||||
effectiveOwner = Exts.Lazy(() => TraitOrDefault<IEffectiveOwner>());
|
||||
|
||||
applyIRender = (x, wr) => x.Render(this, wr);
|
||||
applyRenderModifier = (m, p, wr) => p.ModifyRender(this, wr, m);
|
||||
|
||||
Bounds = Lazy.New(() =>
|
||||
Bounds = Exts.Lazy(() =>
|
||||
{
|
||||
var si = Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
var size = (si != null && si.Bounds != null) ? new int2(si.Bounds[0], si.Bounds[1]) :
|
||||
|
||||
Reference in New Issue
Block a user