remove plenty of redundant junk

This commit is contained in:
Chris Forbes
2010-07-14 19:00:03 +12:00
parent 17bf4610f1
commit fed33fdb00
32 changed files with 1184 additions and 1178 deletions

View File

@@ -16,69 +16,68 @@
* You should have received a copy of the GNU General Public License
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
using OpenRA.FileFormats;
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System;
namespace OpenRA.Widgets
{
class ChatDisplayWidget : Widget
{
const int logLength = 10;
public string Notification = "";
public List<ChatLine> recentLines = new List<ChatLine>();
public ChatDisplayWidget()
: base() {}
public ChatDisplayWidget(Widget widget)
:base(widget) {}
public override void DrawInner(World world)
{
var pos = RenderOrigin;
var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height);
var chatpos = new int2(chatLogArea.X + 10, chatLogArea.Bottom - 6);
WidgetUtils.DrawPanel("dialog3", chatLogArea);
var renderer = Game.chrome.renderer;
var font = renderer.RegularFont;
renderer.Device.EnableScissor(chatLogArea.Left, chatLogArea.Top, chatLogArea.Width, chatLogArea.Height);
foreach (var line in recentLines.AsEnumerable().Reverse())
{
chatpos.Y -= 20;
var owner = line.Owner + ":";
var inset = font.Measure(owner).X + 10;
font.DrawText(owner, chatpos, line.Color);
font.DrawText(line.Text, chatpos + new int2(inset, 0), Color.White);
}
renderer.RgbaSpriteRenderer.Flush();
renderer.Device.DisableScissor();
}
public void AddLine(Color c, string from, string text)
{
recentLines.Add(new ChatLine { Color = c, Owner = from, Text = text });
if (Notification != null)
Sound.Play(Notification);
while (recentLines.Count > logLength) recentLines.RemoveAt(0);
}
public override Widget Clone()
{
return new ChatDisplayWidget(this);
}
}
class ChatLine { public Color Color = Color.White; public string Owner, Text; public bool wrapped = false; }
using System.Linq;
namespace OpenRA.Widgets
{
class ChatDisplayWidget : Widget
{
const int logLength = 10;
public string Notification = "";
public List<ChatLine> recentLines = new List<ChatLine>();
public ChatDisplayWidget()
: base() { }
protected ChatDisplayWidget(Widget widget)
: base(widget) { }
public override void DrawInner(World world)
{
var pos = RenderOrigin;
var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height);
var chatpos = new int2(chatLogArea.X + 10, chatLogArea.Bottom - 6);
WidgetUtils.DrawPanel("dialog3", chatLogArea);
var renderer = Game.chrome.renderer;
var font = renderer.RegularFont;
renderer.Device.EnableScissor(chatLogArea.Left, chatLogArea.Top, chatLogArea.Width, chatLogArea.Height);
foreach (var line in recentLines.AsEnumerable().Reverse())
{
chatpos.Y -= 20;
var owner = line.Owner + ":";
var inset = font.Measure(owner).X + 10;
font.DrawText(owner, chatpos, line.Color);
font.DrawText(line.Text, chatpos + new int2(inset, 0), Color.White);
}
renderer.RgbaSpriteRenderer.Flush();
renderer.Device.DisableScissor();
}
public void AddLine(Color c, string from, string text)
{
recentLines.Add(new ChatLine { Color = c, Owner = from, Text = text });
if (Notification != null)
Sound.Play(Notification);
while (recentLines.Count > logLength) recentLines.RemoveAt(0);
}
public override Widget Clone() { return new ChatDisplayWidget(this); }
}
class ChatLine
{
public Color Color = Color.White;
public string Owner, Text;
public bool wrapped = false;
}
}