@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
foreach (var p in world.Players.Where(a => !a.NonCombatant))
|
||||
{
|
||||
Player pp = p;
|
||||
var pp = p;
|
||||
var item = itemTemplate.Clone();
|
||||
var nameLabel = item.Get<LabelWidget>("NAME");
|
||||
nameLabel.GetText = () => pp.WinState == WinState.Lost ? pp.PlayerName + " (Dead)" : pp.PlayerName;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
@@ -30,7 +31,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
[ObjectCreator.UseCtor]
|
||||
public IngameChatLogic(Widget widget, OrderManager orderManager, World world)
|
||||
{
|
||||
teamChat = world.LocalPlayer != null;
|
||||
var players = world.Players.Where(p => p != world.LocalPlayer && !p.NonCombatant && !p.IsBot);
|
||||
var disableTeamChat = world.LocalPlayer == null || world.LobbyInfo.IsSinglePlayer || !players.Any(p => p.IsAlliedWith(world.LocalPlayer));
|
||||
teamChat = !disableTeamChat;
|
||||
|
||||
var chatPanel = (ContainerWidget)widget;
|
||||
chatOverlay = chatPanel.Get<ContainerWidget>("CHAT_OVERLAY");
|
||||
@@ -43,13 +46,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var chatMode = chatChrome.Get<ButtonWidget>("CHAT_MODE");
|
||||
chatMode.GetText = () => teamChat ? "Team" : "All";
|
||||
chatMode.OnClick = () => teamChat ^= true;
|
||||
chatMode.IsDisabled = () => world.LocalPlayer == null;
|
||||
chatMode.IsDisabled = () => disableTeamChat;
|
||||
|
||||
chatText = chatChrome.Get<TextFieldWidget>("CHAT_TEXTFIELD");
|
||||
chatText.OnTabKey = () => { teamChat ^= true; return true; };
|
||||
chatText.OnTabKey = () =>
|
||||
{
|
||||
if (!disableTeamChat)
|
||||
teamChat ^= true;
|
||||
return true;
|
||||
};
|
||||
chatText.OnEnterKey = () =>
|
||||
{
|
||||
var team = teamChat && world.LocalPlayer != null;
|
||||
var team = teamChat && !disableTeamChat;
|
||||
if (chatText.Text != "")
|
||||
orderManager.IssueOrder(Order.Chat(team, chatText.Text.Trim()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user