add a World type
This commit is contained in:
@@ -135,7 +135,7 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
public static event Action BeforeGameStart = () => { };
|
||||
internal static void StartGame(string mapUID, bool isShellmap)
|
||||
internal static void StartGame(string mapUID, WorldType type)
|
||||
{
|
||||
Cursor.SetCursor(null);
|
||||
BeforeGameStart();
|
||||
@@ -146,12 +146,13 @@ namespace OpenRA
|
||||
map = ModData.PrepareMap(mapUID);
|
||||
using (new PerfTimer("NewWorld"))
|
||||
{
|
||||
OrderManager.World = new World(map, OrderManager, isShellmap);
|
||||
OrderManager.World = new World(map, OrderManager, type);
|
||||
OrderManager.World.Timestep = Timestep;
|
||||
}
|
||||
|
||||
if (worldRenderer != null)
|
||||
worldRenderer.Dispose();
|
||||
|
||||
worldRenderer = new WorldRenderer(OrderManager.World);
|
||||
|
||||
using (new PerfTimer("LoadComplete"))
|
||||
@@ -375,7 +376,7 @@ namespace OpenRA
|
||||
var shellmap = ChooseShellmap();
|
||||
|
||||
using (new PerfTimer("StartGame"))
|
||||
StartGame(shellmap, true);
|
||||
StartGame(shellmap, WorldType.Shellmap);
|
||||
}
|
||||
|
||||
static string ChooseShellmap()
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
RefreshPalette();
|
||||
|
||||
if (World.IsShellmap && !Game.Settings.Game.ShowShellmap)
|
||||
if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap)
|
||||
return;
|
||||
|
||||
var renderables = GenerateRenderables();
|
||||
@@ -156,7 +156,7 @@ namespace OpenRA.Graphics
|
||||
foreach (var r in g)
|
||||
r.RenderDebugGeometry(this);
|
||||
|
||||
if (!World.IsShellmap && Game.Settings.Game.AlwaysShowStatusBars)
|
||||
if (World.Type == WorldType.Regular && Game.Settings.Game.AlwaysShowStatusBars)
|
||||
{
|
||||
foreach (var g in World.Actors.Where(a => !a.Destroyed
|
||||
&& a.HasTrait<Selectable>()
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Network
|
||||
}
|
||||
|
||||
Game.AddChatLine(Color.White, "Server", "The game has started.");
|
||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, false);
|
||||
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, WorldType.Regular);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public enum WorldType { Regular, Shellmap }
|
||||
|
||||
public class World
|
||||
{
|
||||
static readonly Func<int, int, bool> FalsePredicate = (u, v) => false;
|
||||
@@ -109,6 +111,8 @@ namespace OpenRA
|
||||
public readonly TileSet TileSet;
|
||||
public readonly ActorMap ActorMap;
|
||||
public readonly ScreenMap ScreenMap;
|
||||
public readonly WorldType Type;
|
||||
|
||||
readonly GameInformation gameInfo;
|
||||
|
||||
public void IssueOrder(Order o) { OrderManager.IssueOrder(o); } /* avoid exposing the OM to mod code */
|
||||
@@ -146,9 +150,9 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
internal World(Map map, OrderManager orderManager, bool isShellmap)
|
||||
internal World(Map map, OrderManager orderManager, WorldType type)
|
||||
{
|
||||
IsShellmap = isShellmap;
|
||||
Type = type;
|
||||
OrderManager = orderManager;
|
||||
orderGenerator = new UnitOrderGenerator();
|
||||
Map = map;
|
||||
@@ -242,7 +246,7 @@ namespace OpenRA
|
||||
public bool Paused { get; internal set; }
|
||||
public bool PredictedPaused { get; internal set; }
|
||||
public bool PauseStateLocked { get; set; }
|
||||
public bool IsShellmap = false;
|
||||
|
||||
public int WorldTick { get; private set; }
|
||||
|
||||
public void SetPauseState(bool paused)
|
||||
@@ -261,7 +265,7 @@ namespace OpenRA
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
if (!Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap))
|
||||
if (!Paused && (Type != WorldType.Shellmap || Game.Settings.Game.ShowShellmap))
|
||||
{
|
||||
WorldTick++;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var installButton = widget.GetOrNull<ButtonWidget>("INSTALL_BUTTON");
|
||||
if (installButton != null)
|
||||
{
|
||||
installButton.IsDisabled = () => world == null || !world.IsShellmap;
|
||||
installButton.IsDisabled = () => world == null || world.Type != WorldType.Shellmap;
|
||||
var args = new string[] { "Install.Music=true" };
|
||||
installButton.OnClick = () =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user