OpenRA.Mods.Common.Traits.EditorActorLayer.WorldLoaded C# (CSharp) Method

WorldLoaded() public method

public WorldLoaded ( World world, WorldRenderer wr ) : void
world World
wr OpenRA.Graphics.WorldRenderer
return void
        public void WorldLoaded(World world, WorldRenderer wr)
        {
            if (world.Type != WorldType.Editor)
                return;

            worldRenderer = wr;

            foreach (var pr in Players.Players.Values)
                wr.UpdatePalettesForPlayer(pr.Name, pr.Color, false);

            var ts = world.Map.Grid.TileSize;
            var width = world.Map.MapSize.X * ts.Width;
            var height = world.Map.MapSize.Y * ts.Height;
            screenMap = new SpatiallyPartitioned<EditorActorPreview>(width, height, info.BinSize);

            foreach (var kv in world.Map.ActorDefinitions)
                Add(kv.Key, new ActorReference(kv.Value.Value, kv.Value.ToDictionary()), true);

            // Update neighbours in one pass
            foreach (var p in previews)
                UpdateNeighbours(p.Footprint);
        }