Merge pull request #2879 from bidifx/chat
closes #2874: improved ingame chat
This commit is contained in:
@@ -210,7 +210,7 @@ namespace OpenRA
|
||||
|
||||
var map = modData.PrepareMap(mapUID);
|
||||
viewport = new Viewport(new int2(Renderer.Resolution), map.Bounds, Renderer);
|
||||
orderManager.world = new World(modData.Manifest, map, orderManager) { IsShellmap = isShellmap };
|
||||
orderManager.world = new World(modData.Manifest, map, orderManager, isShellmap);
|
||||
worldRenderer = new WorldRenderer(orderManager.world);
|
||||
|
||||
if (orderManager.GameStarted) return;
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace OpenRA.Network
|
||||
public string Bot; // Bot type, null for real clients
|
||||
public bool IsAdmin;
|
||||
public bool IsReady { get { return State == ClientState.Ready; } }
|
||||
public bool IsObserver { get { return Slot == null; } }
|
||||
}
|
||||
|
||||
public class Slot
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace OpenRA.Network
|
||||
{
|
||||
var player = world != null ? world.FindPlayerByClient(client) : null;
|
||||
var suffix = (player != null && player.WinState == WinState.Lost) ? " (Dead)" : "";
|
||||
suffix = client.IsObserver ? " (Spectator)" : suffix;
|
||||
Game.AddChatLine(client.ColorRamp.GetColor(0), client.Name + suffix, order.TargetString);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public Func<bool> OnEnterKey = () => false;
|
||||
public Func<bool> OnTabKey = () => false;
|
||||
public Func<bool> OnEscKey = () => false;
|
||||
public Action OnLoseFocus = () => { };
|
||||
public int CursorPosition { get; protected set; }
|
||||
|
||||
@@ -121,6 +122,9 @@ namespace OpenRA.Widgets
|
||||
if (e.KeyName == "tab" && OnTabKey())
|
||||
return true;
|
||||
|
||||
if (e.KeyName == "escape" && OnEscKey())
|
||||
return true;
|
||||
|
||||
if (e.KeyName == "left")
|
||||
{
|
||||
if (CursorPosition > 0)
|
||||
|
||||
@@ -403,6 +403,8 @@ namespace OpenRA.Widgets
|
||||
|
||||
public override string GetCursor(int2 pos) { return null; }
|
||||
public override Widget Clone() { return new ContainerWidget(this); }
|
||||
public Func<KeyInput, bool> OnKeyPress = _ => false;
|
||||
public override bool HandleKeyPress(KeyInput e) { return OnKeyPress(e); }
|
||||
}
|
||||
|
||||
public class WidgetArgs : Dictionary<string, object>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA
|
||||
public void AddPlayer(Player p) { Players.Add(p); }
|
||||
public Player LocalPlayer { get; private set; }
|
||||
public readonly Shroud LocalShroud;
|
||||
|
||||
public bool Observer { get { return LocalPlayer == null; } }
|
||||
public Player RenderedPlayer;
|
||||
public Shroud RenderedShroud { get { return RenderedPlayer != null ? RenderedPlayer.Shroud : LocalShroud; } }
|
||||
|
||||
@@ -90,8 +90,9 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
internal World(Manifest manifest, Map map, OrderManager orderManager)
|
||||
internal World(Manifest manifest, Map map, OrderManager orderManager, bool isShellmap)
|
||||
{
|
||||
IsShellmap = isShellmap;
|
||||
this.orderManager = orderManager;
|
||||
orderGenerator_ = new UnitOrderGenerator();
|
||||
Map = map;
|
||||
|
||||
Reference in New Issue
Block a user