Add WorldRenderer parameter to WorldLoaded.

This commit is contained in:
Paul Chote
2013-09-27 15:20:49 +12:00
parent c26a0cb222
commit cad46e43c5
28 changed files with 67 additions and 38 deletions

View File

@@ -213,8 +213,11 @@ namespace OpenRA
viewport = new Viewport(new int2(Renderer.Resolution), map.Bounds, Renderer);
orderManager.world = new World(modData.Manifest, map, orderManager, isShellmap);
worldRenderer = new WorldRenderer(orderManager.world);
orderManager.world.LoadComplete(worldRenderer);
if (orderManager.GameStarted)
return;
if (orderManager.GameStarted) return;
Ui.MouseFocusWidget = null;
Ui.KeyboardFocusWidget = null;

View File

@@ -174,7 +174,7 @@ namespace OpenRA.Traits
public interface UsesInit<T> where T : IActorInit { }
public interface INotifySelection { void SelectionChanged(); }
public interface IWorldLoaded { void WorldLoaded(World w); }
public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); }
public interface ICreatePlayers { void CreatePlayers(World w); }
public interface IBotInfo { string Name { get; } }

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Traits
}
}
public void WorldLoaded(World w)
public void WorldLoaded(World w, WorldRenderer wr)
{
this.world = w;
content = new CellContents[w.Map.MapSize.X, w.Map.MapSize.Y];

View File

@@ -135,8 +135,12 @@ namespace OpenRA
p.Stances[q] = Stance.Neutral;
Sound.SoundVolumeModifier = 1.0f;
}
public void LoadComplete(WorldRenderer wr)
{
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
wlh.WorldLoaded(this);
wlh.WorldLoaded(this, wr);
}
public Actor CreateActor( string name, TypeDictionary initDict )