Theater definitions in yaml

This commit is contained in:
Paul Chote
2010-03-04 18:26:43 +13:00
parent 1914a8adbe
commit 724928cf56
10 changed files with 82 additions and 16 deletions

View File

@@ -339,7 +339,9 @@ namespace OpenRA
DrawCentered("Size: {0}x{1}".F(currentMap.Map.Width, currentMap.Map.Height),
new int2(mapRect.Left + mapRect.Width / 2, y), Color.White);
y += 20;
DrawCentered("Theater: {0}".F(currentMap.Map.Theater, currentMap.Map.Height),
TheaterInfo theaterInfo = Game.world.WorldActor.Info.Traits.WithInterface<TheaterInfo>().Where(t => t.Theater == currentMap.Map.Theater).FirstOrDefault();
DrawCentered("Theater: {0}".F(theaterInfo.Name, currentMap.Map.Height),
new int2(mapRect.Left + mapRect.Width / 2, y), Color.White);
y += 20;
DrawCentered("Spawnpoints: {0}".F(currentMap.Map.SpawnPoints.Count()),

View File

@@ -269,6 +269,7 @@
<Compile Include="Traits\Player\EvaAlerts.cs" />
<Compile Include="Traits\World\ScreenShaker.cs" />
<Compile Include="Traits\LineBuild.cs" />
<Compile Include="Traits\World\Theater.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,32 @@
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
*
* OpenRA is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenRA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
namespace OpenRA.Traits
{
class TheaterInfo : StatelessTraitInfo<Theater>
{
public readonly string Name = null;
public readonly string Theater = null;
public readonly string Suffix = null;
public readonly string Tileset = null;
public readonly string Templates = null;
}
class Theater {}
}

View File

@@ -59,8 +59,7 @@ namespace OpenRA
Game.IssueOrder(Order.Chat("/name " + Game.Settings.PlayerName));
}
public readonly Actor WorldActor;
public readonly Actor WorldActor;
public readonly PathFinder PathFinder;
public readonly Map Map;
@@ -75,9 +74,13 @@ namespace OpenRA
public World()
{
Timer.Time( "----World.ctor" );
Map = new Map( Game.LobbyInfo.GlobalSettings.Map );
Timer.Time( "new Map: {0}" );
TileSet = new TileSet( Map.TileSuffix );
TheaterInfo theaterInfo = Rules.Info["world"].Traits.WithInterface<TheaterInfo>().Where(t => t.Theater == Map.Theater).FirstOrDefault();
TileSet = new TileSet(theaterInfo.Tileset, theaterInfo.Templates, theaterInfo.Suffix);
SpriteSheetBuilder.Initialize( Map );
Timer.Time( "Tileset: {0}" );