hack in team chat support
This commit is contained in:
@@ -32,11 +32,12 @@ namespace OpenRA
|
|||||||
public List<ChatLine> recentLines = new List<ChatLine>();
|
public List<ChatLine> recentLines = new List<ChatLine>();
|
||||||
public string typing = "";
|
public string typing = "";
|
||||||
public bool isChatting = true;
|
public bool isChatting = true;
|
||||||
|
public bool isTeamChat = false;
|
||||||
|
|
||||||
public void Toggle()
|
public void Toggle()
|
||||||
{
|
{
|
||||||
if( isChatting && typing.Length > 0 )
|
if( isChatting && typing.Length > 0 )
|
||||||
Game.IssueOrder( Order.Chat( typing ) );
|
Game.IssueOrder( isTeamChat ? Order.TeamChat( typing ) : Order.Chat( typing ) );
|
||||||
|
|
||||||
typing = "";
|
typing = "";
|
||||||
if( Game.orderManager.GameStarted )
|
if( Game.orderManager.GameStarted )
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
renderer.Device.EnableScissor(typingArea.Left, typingArea.Top, typingArea.Width, typingArea.Height);
|
renderer.Device.EnableScissor(typingArea.Left, typingArea.Top, typingArea.Width, typingArea.Height);
|
||||||
if (Game.chat.isChatting)
|
if (Game.chat.isChatting)
|
||||||
RenderChatLine(new ChatLine { Owner = "Chat:", Text = Game.chat.typing },
|
RenderChatLine(new ChatLine { Owner = Game.chat.isTeamChat ? "TeamChat:" : "Chat:", Text = Game.chat.typing },
|
||||||
new int2(typingArea.X + 10, typingArea.Y + 6));
|
new int2(typingArea.X + 10, typingArea.Y + 6));
|
||||||
|
|
||||||
rgbaRenderer.Flush();
|
rgbaRenderer.Flush();
|
||||||
|
|||||||
@@ -495,7 +495,10 @@ namespace OpenRA
|
|||||||
int sync = world.SyncHash();
|
int sync = world.SyncHash();
|
||||||
|
|
||||||
if (e.KeyChar == '\r')
|
if (e.KeyChar == '\r')
|
||||||
|
{
|
||||||
chat.Toggle();
|
chat.Toggle();
|
||||||
|
chat.isTeamChat = modifiers.HasModifier(Modifiers.Shift);
|
||||||
|
}
|
||||||
else if (Game.chat.isChatting)
|
else if (Game.chat.isChatting)
|
||||||
chat.TypeChar(e.KeyChar);
|
chat.TypeChar(e.KeyChar);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -171,6 +171,11 @@ namespace OpenRA
|
|||||||
return new Order("Chat", null, text) { IsImmediate = true };
|
return new Order("Chat", null, text) { IsImmediate = true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Order TeamChat(string text)
|
||||||
|
{
|
||||||
|
return new Order("TeamChat", null, text) { IsImmediate = true };
|
||||||
|
}
|
||||||
|
|
||||||
public static Order StartProduction(Player subject, string item, int count)
|
public static Order StartProduction(Player subject, string item, int count)
|
||||||
{
|
{
|
||||||
return new Order("StartProduction", subject.PlayerActor, new int2( count, 0 ), item );
|
return new Order("StartProduction", subject.PlayerActor, new int2( count, 0 ), item );
|
||||||
|
|||||||
@@ -37,6 +37,20 @@ namespace OpenRA.Network
|
|||||||
Game.chat.AddLine(client, order.TargetString);
|
Game.chat.AddLine(client, order.TargetString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "TeamChat":
|
||||||
|
{
|
||||||
|
var client = Game.LobbyInfo.Clients.FirstOrDefault(c => c.Index == clientId);
|
||||||
|
if (client != null)
|
||||||
|
{
|
||||||
|
var player = Game.world.players.Values.FirstOrDefault(p => p.Index == client.Index);
|
||||||
|
var isAlly = player != null && Game.world.LocalPlayer != null
|
||||||
|
&& player.Stances[Game.world.LocalPlayer] == Stance.Ally;
|
||||||
|
|
||||||
|
if (isAlly)
|
||||||
|
Game.chat.AddLine(client, "(Team) " + order.TargetString);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "StartGame":
|
case "StartGame":
|
||||||
{
|
{
|
||||||
Game.chat.AddLine(Color.White, "Server", "The game has started.");
|
Game.chat.AddLine(Color.White, "Server", "The game has started.");
|
||||||
|
|||||||
Reference in New Issue
Block a user