remove use of Tuple in chat
This commit is contained in:
@@ -29,7 +29,7 @@ namespace OpenRA
|
||||
{
|
||||
const int logLength = 10;
|
||||
|
||||
public List<Tuple<Color, string, string>> recentLines = new List<Tuple<Color, string, string>>();
|
||||
public List<ChatLine> recentLines = new List<ChatLine>();
|
||||
public string typing = "";
|
||||
public bool isChatting = true;
|
||||
|
||||
@@ -68,10 +68,12 @@ namespace OpenRA
|
||||
|
||||
public void AddLine(Color c, string from, string text)
|
||||
{
|
||||
recentLines.Add(Tuple.New(c, from, text));
|
||||
recentLines.Add(new ChatLine { Color = c, Owner = from, Text = text });
|
||||
var eva = Rules.Info["world"].Traits.Get<EvaAlertsInfo>();
|
||||
Sound.Play(eva.ChatBeep);
|
||||
while (recentLines.Count > logLength) recentLines.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
class ChatLine { public Color Color = Color.White; public string Owner, Text; }
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace OpenRA
|
||||
|
||||
renderer.Device.EnableScissor(typingArea.Left, typingArea.Top, typingArea.Width, typingArea.Height);
|
||||
if (Game.chat.isChatting)
|
||||
RenderChatLine(Tuple.New(Color.White, "Chat:", Game.chat.typing),
|
||||
RenderChatLine(new ChatLine { Owner = "Chat:", Text = Game.chat.typing },
|
||||
new int2(typingArea.X + 10, typingArea.Y + 6));
|
||||
|
||||
rgbaRenderer.Flush();
|
||||
@@ -209,11 +209,11 @@ namespace OpenRA
|
||||
renderer.Device.DisableScissor();
|
||||
}
|
||||
|
||||
void RenderChatLine(Tuple<Color, string, string> line, int2 p)
|
||||
void RenderChatLine(ChatLine line, int2 p)
|
||||
{
|
||||
var size = renderer.RegularFont.Measure(line.b);
|
||||
renderer.RegularFont.DrawText(line.b, p, line.a);
|
||||
renderer.RegularFont.DrawText(line.c, p + new int2(size.X + 10, 0), Color.White);
|
||||
var size = renderer.RegularFont.Measure(line.Owner);
|
||||
renderer.RegularFont.DrawText(line.Owner, p, line.Color);
|
||||
renderer.RegularFont.DrawText(line.Text, p + new int2(size.X + 10, 0), Color.White);
|
||||
}
|
||||
|
||||
public int ticksSinceLastMove = 0;
|
||||
|
||||
Reference in New Issue
Block a user