Renormalize line endings and fix copyright headers again.

This commit is contained in:
Paul Chote
2011-04-07 21:15:42 +12:00
parent 1a49b46af1
commit b0425aff3b
144 changed files with 8076 additions and 7746 deletions

View File

@@ -1,5 +1,15 @@
using System; #region Copyright & License Information
using System.IO; /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.IO;
using OpenRA.FileFormats; using OpenRA.FileFormats;
namespace FileExtractor namespace FileExtractor
@@ -17,7 +27,7 @@ namespace FileExtractor
} }
var mods = args[0].Split(','); var mods = args[0].Split(',');
var manifest = new Manifest(mods); var manifest = new Manifest(mods);
FileSystem.LoadFromManifest( manifest ); FileSystem.LoadFromManifest( manifest );
try try

View File

@@ -1,3 +1,13 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System; using System;
namespace FileExtractor namespace FileExtractor

View File

@@ -1,90 +1,100 @@
namespace OpenRA.Editor #region Copyright & License Information
{ /*
partial class ErrorListDialog * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
{ * This file is part of OpenRA, which is free software. It is made
/// <summary> * available to you under the terms of the GNU General Public License
/// Required designer variable. * as published by the Free Software Foundation. For more information,
/// </summary> * see COPYING.
private System.ComponentModel.IContainer components = null; */
#endregion
/// <summary>
/// Clean up any resources being used. namespace OpenRA.Editor
/// </summary> {
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> partial class ErrorListDialog
protected override void Dispose(bool disposing) {
{ /// <summary>
if (disposing && (components != null)) /// Required designer variable.
{ /// </summary>
components.Dispose(); private System.ComponentModel.IContainer components = null;
}
base.Dispose(disposing); /// <summary>
} /// Clean up any resources being used.
/// </summary>
#region Windows Form Designer generated code /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
/// <summary> {
/// Required method for Designer support - do not modify if (disposing && (components != null))
/// the contents of this method with the code editor. {
/// </summary> components.Dispose();
private void InitializeComponent() }
{ base.Dispose(disposing);
this.label1 = new System.Windows.Forms.Label(); }
this.listBox1 = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button(); #region Windows Form Designer generated code
this.SuspendLayout();
// /// <summary>
// label1 /// Required method for Designer support - do not modify
// /// the contents of this method with the code editor.
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) /// </summary>
| System.Windows.Forms.AnchorStyles.Right))); private void InitializeComponent()
this.label1.Location = new System.Drawing.Point(10, 9); {
this.label1.Name = "label1"; this.label1 = new System.Windows.Forms.Label();
this.label1.Size = new System.Drawing.Size(610, 23); this.listBox1 = new System.Windows.Forms.ListBox();
this.label1.TabIndex = 0; this.button1 = new System.Windows.Forms.Button();
this.label1.Text = "Your map import completed, but with errors:"; this.SuspendLayout();
// //
// listBox1 // label1
// //
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(10, 9);
this.listBox1.FormattingEnabled = true; this.label1.Name = "label1";
this.listBox1.Location = new System.Drawing.Point(13, 30); this.label1.Size = new System.Drawing.Size(610, 23);
this.listBox1.Name = "listBox1"; this.label1.TabIndex = 0;
this.listBox1.Size = new System.Drawing.Size(607, 316); this.label1.Text = "Your map import completed, but with errors:";
this.listBox1.TabIndex = 1; //
// // listBox1
// button1 //
// this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Left)
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(545, 359); this.listBox1.FormattingEnabled = true;
this.button1.Name = "button1"; this.listBox1.Location = new System.Drawing.Point(13, 30);
this.button1.Size = new System.Drawing.Size(75, 23); this.listBox1.Name = "listBox1";
this.button1.TabIndex = 2; this.listBox1.Size = new System.Drawing.Size(607, 316);
this.button1.Text = "Close"; this.listBox1.TabIndex = 1;
this.button1.UseVisualStyleBackColor = true; //
// // button1
// ErrorListDialog //
// this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.button1.Location = new System.Drawing.Point(545, 359);
this.ClientSize = new System.Drawing.Size(632, 394); this.button1.Name = "button1";
this.Controls.Add(this.button1); this.button1.Size = new System.Drawing.Size(75, 23);
this.Controls.Add(this.listBox1); this.button1.TabIndex = 2;
this.Controls.Add(this.label1); this.button1.Text = "Close";
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.button1.UseVisualStyleBackColor = true;
this.Name = "ErrorListDialog"; //
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; // ErrorListDialog
this.Text = "Map Import Errors"; //
this.ResumeLayout(false); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
} this.ClientSize = new System.Drawing.Size(632, 394);
this.Controls.Add(this.button1);
#endregion this.Controls.Add(this.listBox1);
this.Controls.Add(this.label1);
private System.Windows.Forms.Label label1; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
private System.Windows.Forms.ListBox listBox1; this.Name = "ErrorListDialog";
private System.Windows.Forms.Button button1; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
} this.Text = "Map Import Errors";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button button1;
}
} }

View File

@@ -1,25 +1,25 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
namespace OpenRA.Editor namespace OpenRA.Editor
{ {
public partial class ErrorListDialog : Form public partial class ErrorListDialog : Form
{ {
public ErrorListDialog( IEnumerable<string> errors ) public ErrorListDialog( IEnumerable<string> errors )
{ {
InitializeComponent(); InitializeComponent();
foreach (var e in errors) foreach (var e in errors)
listBox1.Items.Add(e); listBox1.Items.Add(e);
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -386,14 +386,14 @@ namespace OpenRA.Editor
* but something's not right internally in it, unless loaded via the real maploader */ * but something's not right internally in it, unless loaded via the real maploader */
var savePath = Path.Combine(Path.GetTempPath(), "OpenRA.Import"); var savePath = Path.Combine(Path.GetTempPath(), "OpenRA.Import");
Directory.CreateDirectory(savePath); Directory.CreateDirectory(savePath);
var errors = new List<string>(); var errors = new List<string>();
var map = LegacyMapImporter.Import(ofd.FileName, a => errors.Add(a)); var map = LegacyMapImporter.Import(ofd.FileName, a => errors.Add(a));
if (errors.Count > 0) if (errors.Count > 0)
using (var eld = new ErrorListDialog(errors)) using (var eld = new ErrorListDialog(errors))
eld.ShowDialog(); eld.ShowDialog();
if (!map.Players.ContainsKey("Neutral")) if (!map.Players.ContainsKey("Neutral"))
@@ -441,12 +441,12 @@ namespace OpenRA.Editor
if (DialogResult.OK == saveFileDialog.ShowDialog()) if (DialogResult.OK == saveFileDialog.ShowDialog())
pmMiniMap.Image.Save(saveFileDialog.FileName); pmMiniMap.Image.Save(saveFileDialog.FileName);
} }
void ShowActorNamesClicked(object sender, EventArgs e) void ShowActorNamesClicked(object sender, EventArgs e)
{ {
showActorNamesToolStripMenuItem.Checked ^= true; showActorNamesToolStripMenuItem.Checked ^= true;
surface1.ShowActorNames = showActorNamesToolStripMenuItem.Checked; surface1.ShowActorNames = showActorNamesToolStripMenuItem.Checked;
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -100,17 +100,17 @@ namespace OpenRA.Editor
int MapSize; int MapSize;
int ActorCount = 0; int ActorCount = 0;
Map Map = new Map(); Map Map = new Map();
List<string> Players = new List<string>(); List<string> Players = new List<string>();
Action<string> errorHandler; Action<string> errorHandler;
LegacyMapImporter(string filename, Action<string> errorHandler) LegacyMapImporter(string filename, Action<string> errorHandler)
{ {
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
ConvertIniMap(filename); ConvertIniMap(filename);
} }
public static Map Import(string filename, Action<string> errorHandler) public static Map Import(string filename, Action<string> errorHandler)
{ {
var converter = new LegacyMapImporter(filename, errorHandler); var converter = new LegacyMapImporter(filename, errorHandler);
return converter.Map; return converter.Map;
} }
@@ -364,45 +364,45 @@ namespace OpenRA.Editor
{ {
//Structures: num=owner,type,health,location,turret-facing,trigger //Structures: num=owner,type,health,location,turret-facing,trigger
//Units: num=owner,type,health,location,facing,action,trigger //Units: num=owner,type,health,location,facing,action,trigger
//Infantry: num=owner,type,health,location,subcell,action,facing,trigger //Infantry: num=owner,type,health,location,subcell,action,facing,trigger
try try
{ {
var parts = s.Value.Split(','); var parts = s.Value.Split(',');
var loc = int.Parse(parts[3]); var loc = int.Parse(parts[3]);
if (parts[0] == "") if (parts[0] == "")
parts[0] = "Neutral"; parts[0] = "Neutral";
if (!Players.Contains(parts[0])) if (!Players.Contains(parts[0]))
Players.Add(parts[0]); Players.Add(parts[0]);
var stance = ActorStance.Stance.None; var stance = ActorStance.Stance.None;
switch (parts[5]) switch (parts[5])
{ {
case "Area Guard": case "Area Guard":
case "Guard": case "Guard":
stance = ActorStance.Stance.Guard; stance = ActorStance.Stance.Guard;
break; break;
case "Defend Base": case "Defend Base":
stance = ActorStance.Stance.Defend; stance = ActorStance.Stance.Defend;
break; break;
case "Hunt": case "Hunt":
case "Rampage": case "Rampage":
case "Attack Base": case "Attack Base":
case "Attack Units": case "Attack Units":
case "Attack Civil.": case "Attack Civil.":
case "Attack Tarcom": case "Attack Tarcom":
stance = ActorStance.Stance.Hunt; stance = ActorStance.Stance.Hunt;
break; break;
case "Retreat": case "Retreat":
case "Return": case "Return":
stance = ActorStance.Stance.Retreat; stance = ActorStance.Stance.Retreat;
break; break;
// do we care about `Harvest' and `Sticky'? // do we care about `Harvest' and `Sticky'?
} }
var actor = new ActorReference(parts[1].ToLowerInvariant()) var actor = new ActorReference(parts[1].ToLowerInvariant())
{ {
new LocationInit(new int2(loc % MapSize, loc / MapSize)), new LocationInit(new int2(loc % MapSize, loc / MapSize)),
@@ -410,19 +410,19 @@ namespace OpenRA.Editor
new HealthInit(float.Parse(parts[2], NumberFormatInfo.InvariantInfo)/256), new HealthInit(float.Parse(parts[2], NumberFormatInfo.InvariantInfo)/256),
new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])), new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])),
new ActorStanceInit(stance), new ActorStanceInit(stance),
}; };
if (section == "INFANTRY") if (section == "INFANTRY")
actor.Add(new SubCellInit(int.Parse(parts[4]))); actor.Add(new SubCellInit(int.Parse(parts[4])));
if (!Rules.Info.ContainsKey(parts[1].ToLowerInvariant())) if (!Rules.Info.ContainsKey(parts[1].ToLowerInvariant()))
errorHandler("Ignoring unknown actor type: `{0}`".F(parts[1].ToLowerInvariant())); errorHandler("Ignoring unknown actor type: `{0}`".F(parts[1].ToLowerInvariant()));
else else
Map.Actors.Value.Add("Actor" + ActorCount++, actor); Map.Actors.Value.Add("Actor" + ActorCount++, actor);
} }
catch (Exception) catch (Exception)
{ {
errorHandler("Malformed actor definition: `{0}`".F(s)); errorHandler("Malformed actor definition: `{0}`".F(s));
} }
} }
} }

View File

@@ -1,375 +1,385 @@
namespace OpenRA.Editor #region Copyright & License Information
{ /*
partial class MapSelect * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
{ * This file is part of OpenRA, which is free software. It is made
/// <summary> * available to you under the terms of the GNU General Public License
/// TODO * as published by the Free Software Foundation. For more information,
/// </summary> * see COPYING.
private System.ComponentModel.IContainer components = null; */
#endregion
/// <summary>
/// TODO namespace OpenRA.Editor
/// </summary> {
/// <param name="disposing">TODO</param> partial class MapSelect
protected override void Dispose(bool disposing) {
{ /// <summary>
if (disposing && (components != null)) /// TODO
{ /// </summary>
components.Dispose(); private System.ComponentModel.IContainer components = null;
}
base.Dispose(disposing); /// <summary>
} /// TODO
/// </summary>
#region Код, автоматически созданный конструктором форм Windows /// <param name="disposing">TODO</param>
protected override void Dispose(bool disposing)
/// <summary> {
/// TODO if (disposing && (components != null))
/// </summary> {
private void InitializeComponent() components.Dispose();
{ }
this.components = new System.ComponentModel.Container(); base.Dispose(disposing);
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapSelect)); }
this.MapList = new System.Windows.Forms.ListView();
this.colMapName = new System.Windows.Forms.ColumnHeader("(отсутствует)"); #region Код, автоматически созданный конструктором форм Windows
this.MapIconsList = new System.Windows.Forms.ImageList(this.components);
this.btnCancel = new System.Windows.Forms.Button(); /// <summary>
this.btnOk = new System.Windows.Forms.Button(); /// TODO
this.lblNew = new System.Windows.Forms.Label(); /// </summary>
this.txtNew = new System.Windows.Forms.TextBox(); private void InitializeComponent()
this.pbMinimap = new System.Windows.Forms.PictureBox(); {
this.pnlBottom = new System.Windows.Forms.Panel(); this.components = new System.ComponentModel.Container();
this.txtPathOut = new System.Windows.Forms.TextBox(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapSelect));
this.lblPathOut = new System.Windows.Forms.Label(); this.MapList = new System.Windows.Forms.ListView();
this.lblPath = new System.Windows.Forms.Label(); this.colMapName = new System.Windows.Forms.ColumnHeader("(отсутствует)");
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.MapIconsList = new System.Windows.Forms.ImageList(this.components);
this.lblMapList = new System.Windows.Forms.Label(); this.btnCancel = new System.Windows.Forms.Button();
this.txtDesc = new System.Windows.Forms.TextBox(); this.btnOk = new System.Windows.Forms.Button();
this.lblDesc = new System.Windows.Forms.Label(); this.lblNew = new System.Windows.Forms.Label();
this.txtTheater = new System.Windows.Forms.TextBox(); this.txtNew = new System.Windows.Forms.TextBox();
this.lblTheater = new System.Windows.Forms.Label(); this.pbMinimap = new System.Windows.Forms.PictureBox();
this.txtAuthor = new System.Windows.Forms.TextBox(); this.pnlBottom = new System.Windows.Forms.Panel();
this.lblAuthor = new System.Windows.Forms.Label(); this.txtPathOut = new System.Windows.Forms.TextBox();
this.txtTitle = new System.Windows.Forms.TextBox(); this.lblPathOut = new System.Windows.Forms.Label();
this.lblMapName = new System.Windows.Forms.Label(); this.lblPath = new System.Windows.Forms.Label();
this.lblMinimap = new System.Windows.Forms.Label(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.lblMapList = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pbMinimap)).BeginInit(); this.txtDesc = new System.Windows.Forms.TextBox();
this.pnlBottom.SuspendLayout(); this.lblDesc = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout(); this.txtTheater = new System.Windows.Forms.TextBox();
this.splitContainer1.Panel2.SuspendLayout(); this.lblTheater = new System.Windows.Forms.Label();
this.splitContainer1.SuspendLayout(); this.txtAuthor = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.lblAuthor = new System.Windows.Forms.Label();
this.SuspendLayout(); this.txtTitle = new System.Windows.Forms.TextBox();
// this.lblMapName = new System.Windows.Forms.Label();
// MapList this.lblMinimap = new System.Windows.Forms.Label();
// this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.MapList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; ((System.ComponentModel.ISupportInitialize)(this.pbMinimap)).BeginInit();
this.MapList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.pnlBottom.SuspendLayout();
this.colMapName}); this.splitContainer1.Panel1.SuspendLayout();
this.MapList.FullRowSelect = true; this.splitContainer1.Panel2.SuspendLayout();
this.MapList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.splitContainer1.SuspendLayout();
this.MapList.LargeImageList = this.MapIconsList; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.MapList.Location = new System.Drawing.Point(15, 25); this.SuspendLayout();
this.MapList.MultiSelect = false; //
this.MapList.Name = "MapList"; // MapList
this.MapList.Size = new System.Drawing.Size(273, 294); //
this.MapList.SmallImageList = this.MapIconsList; this.MapList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.MapList.StateImageList = this.MapIconsList; this.MapList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.MapList.TabIndex = 0; this.colMapName});
this.MapList.UseCompatibleStateImageBehavior = false; this.MapList.FullRowSelect = true;
this.MapList.View = System.Windows.Forms.View.Details; this.MapList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.MapList.SelectedIndexChanged += new System.EventHandler(this.MapList_SelectedIndexChanged); this.MapList.LargeImageList = this.MapIconsList;
// this.MapList.Location = new System.Drawing.Point(15, 25);
// colMapName this.MapList.MultiSelect = false;
// this.MapList.Name = "MapList";
this.colMapName.Text = "Map name"; this.MapList.Size = new System.Drawing.Size(273, 294);
this.colMapName.Width = 240; this.MapList.SmallImageList = this.MapIconsList;
// this.MapList.StateImageList = this.MapIconsList;
// MapIconsList this.MapList.TabIndex = 0;
// this.MapList.UseCompatibleStateImageBehavior = false;
this.MapIconsList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; this.MapList.View = System.Windows.Forms.View.Details;
this.MapIconsList.ImageSize = new System.Drawing.Size(24, 24); this.MapList.SelectedIndexChanged += new System.EventHandler(this.MapList_SelectedIndexChanged);
this.MapIconsList.TransparentColor = System.Drawing.Color.Transparent; //
// // colMapName
// btnCancel //
// this.colMapName.Text = "Map name";
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.colMapName.Width = 240;
this.btnCancel.Location = new System.Drawing.Point(407, 35); //
this.btnCancel.Name = "btnCancel"; // MapIconsList
this.btnCancel.Size = new System.Drawing.Size(75, 23); //
this.btnCancel.TabIndex = 3; this.MapIconsList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
this.btnCancel.Text = "Cancel"; this.MapIconsList.ImageSize = new System.Drawing.Size(24, 24);
this.btnCancel.UseVisualStyleBackColor = true; this.MapIconsList.TransparentColor = System.Drawing.Color.Transparent;
// //
// btnOk // btnCancel
// //
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnOk.Location = new System.Drawing.Point(326, 35); this.btnCancel.Location = new System.Drawing.Point(407, 35);
this.btnOk.Name = "btnOk"; this.btnCancel.Name = "btnCancel";
this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 2; this.btnCancel.TabIndex = 3;
this.btnOk.Text = "Open"; this.btnCancel.Text = "Cancel";
this.btnOk.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
// //
// lblNew // btnOk
// //
this.lblNew.AutoSize = true; this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.lblNew.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.btnOk.Location = new System.Drawing.Point(326, 35);
this.lblNew.Location = new System.Drawing.Point(12, 40); this.btnOk.Name = "btnOk";
this.lblNew.Name = "lblNew"; this.btnOk.Size = new System.Drawing.Size(75, 23);
this.lblNew.Size = new System.Drawing.Size(69, 13); this.btnOk.TabIndex = 2;
this.lblNew.TabIndex = 3; this.btnOk.Text = "Open";
this.lblNew.Text = "Map name:"; this.btnOk.UseVisualStyleBackColor = true;
// //
// txtNew // lblNew
// //
this.txtNew.BackColor = System.Drawing.SystemColors.Window; this.lblNew.AutoSize = true;
this.txtNew.Location = new System.Drawing.Point(88, 37); this.lblNew.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txtNew.Name = "txtNew"; this.lblNew.Location = new System.Drawing.Point(12, 40);
this.txtNew.ReadOnly = true; this.lblNew.Name = "lblNew";
this.txtNew.Size = new System.Drawing.Size(232, 20); this.lblNew.Size = new System.Drawing.Size(69, 13);
this.txtNew.TabIndex = 1; this.lblNew.TabIndex = 3;
// this.lblNew.Text = "Map name:";
// pbMinimap //
// // txtNew
this.pbMinimap.BackColor = System.Drawing.Color.Black; //
this.pbMinimap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.txtNew.BackColor = System.Drawing.SystemColors.Window;
this.pbMinimap.Location = new System.Drawing.Point(32, 25); this.txtNew.Location = new System.Drawing.Point(88, 37);
this.pbMinimap.Name = "pbMinimap"; this.txtNew.Name = "txtNew";
this.pbMinimap.Size = new System.Drawing.Size(124, 124); this.txtNew.ReadOnly = true;
this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.txtNew.Size = new System.Drawing.Size(232, 20);
this.pbMinimap.TabIndex = 5; this.txtNew.TabIndex = 1;
this.pbMinimap.TabStop = false; //
// // pbMinimap
// pnlBottom //
// this.pbMinimap.BackColor = System.Drawing.Color.Black;
this.pnlBottom.Controls.Add(this.pictureBox1); this.pbMinimap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pnlBottom.Controls.Add(this.txtPathOut); this.pbMinimap.Location = new System.Drawing.Point(32, 25);
this.pnlBottom.Controls.Add(this.lblPathOut); this.pbMinimap.Name = "pbMinimap";
this.pnlBottom.Controls.Add(this.lblPath); this.pbMinimap.Size = new System.Drawing.Size(124, 124);
this.pnlBottom.Controls.Add(this.btnCancel); this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pnlBottom.Controls.Add(this.btnOk); this.pbMinimap.TabIndex = 5;
this.pnlBottom.Controls.Add(this.txtNew); this.pbMinimap.TabStop = false;
this.pnlBottom.Controls.Add(this.lblNew); //
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; // pnlBottom
this.pnlBottom.Location = new System.Drawing.Point(0, 332); //
this.pnlBottom.MaximumSize = new System.Drawing.Size(0, 70); this.pnlBottom.Controls.Add(this.pictureBox1);
this.pnlBottom.Name = "pnlBottom"; this.pnlBottom.Controls.Add(this.txtPathOut);
this.pnlBottom.Size = new System.Drawing.Size(494, 70); this.pnlBottom.Controls.Add(this.lblPathOut);
this.pnlBottom.TabIndex = 6; this.pnlBottom.Controls.Add(this.lblPath);
// this.pnlBottom.Controls.Add(this.btnCancel);
// txtPathOut this.pnlBottom.Controls.Add(this.btnOk);
// this.pnlBottom.Controls.Add(this.txtNew);
this.txtPathOut.BackColor = System.Drawing.SystemColors.Window; this.pnlBottom.Controls.Add(this.lblNew);
this.txtPathOut.Location = new System.Drawing.Point(55, 10); this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.txtPathOut.Name = "txtPathOut"; this.pnlBottom.Location = new System.Drawing.Point(0, 332);
this.txtPathOut.ReadOnly = true; this.pnlBottom.MaximumSize = new System.Drawing.Size(0, 70);
this.txtPathOut.Size = new System.Drawing.Size(265, 20); this.pnlBottom.Name = "pnlBottom";
this.txtPathOut.TabIndex = 0; this.pnlBottom.Size = new System.Drawing.Size(494, 70);
this.txtPathOut.TextChanged += new System.EventHandler(this.txtPathOut_TextChanged); this.pnlBottom.TabIndex = 6;
// //
// lblPathOut // txtPathOut
// //
this.lblPathOut.AutoSize = true; this.txtPathOut.BackColor = System.Drawing.SystemColors.Window;
this.lblPathOut.Location = new System.Drawing.Point(55, 13); this.txtPathOut.Location = new System.Drawing.Point(55, 10);
this.lblPathOut.Name = "lblPathOut"; this.txtPathOut.Name = "txtPathOut";
this.lblPathOut.Size = new System.Drawing.Size(0, 13); this.txtPathOut.ReadOnly = true;
this.lblPathOut.TabIndex = 6; this.txtPathOut.Size = new System.Drawing.Size(265, 20);
// this.txtPathOut.TabIndex = 0;
// lblPath this.txtPathOut.TextChanged += new System.EventHandler(this.txtPathOut_TextChanged);
// //
this.lblPath.AutoSize = true; // lblPathOut
this.lblPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); //
this.lblPath.Location = new System.Drawing.Point(12, 13); this.lblPathOut.AutoSize = true;
this.lblPath.Name = "lblPath"; this.lblPathOut.Location = new System.Drawing.Point(55, 13);
this.lblPath.Size = new System.Drawing.Size(37, 13); this.lblPathOut.Name = "lblPathOut";
this.lblPath.TabIndex = 5; this.lblPathOut.Size = new System.Drawing.Size(0, 13);
this.lblPath.Text = "Path:"; this.lblPathOut.TabIndex = 6;
// //
// splitContainer1 // lblPath
// //
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.lblPath.AutoSize = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.lblPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.splitContainer1.Name = "splitContainer1"; this.lblPath.Location = new System.Drawing.Point(12, 13);
// this.lblPath.Name = "lblPath";
// splitContainer1.Panel1 this.lblPath.Size = new System.Drawing.Size(37, 13);
// this.lblPath.TabIndex = 5;
this.splitContainer1.Panel1.Controls.Add(this.lblMapList); this.lblPath.Text = "Path:";
this.splitContainer1.Panel1.Controls.Add(this.MapList); //
// // splitContainer1
// splitContainer1.Panel2 //
// this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Panel2.Controls.Add(this.txtDesc); this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Panel2.Controls.Add(this.lblDesc); this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Panel2.Controls.Add(this.txtTheater); //
this.splitContainer1.Panel2.Controls.Add(this.lblTheater); // splitContainer1.Panel1
this.splitContainer1.Panel2.Controls.Add(this.txtAuthor); //
this.splitContainer1.Panel2.Controls.Add(this.lblAuthor); this.splitContainer1.Panel1.Controls.Add(this.lblMapList);
this.splitContainer1.Panel2.Controls.Add(this.txtTitle); this.splitContainer1.Panel1.Controls.Add(this.MapList);
this.splitContainer1.Panel2.Controls.Add(this.lblMapName); //
this.splitContainer1.Panel2.Controls.Add(this.lblMinimap); // splitContainer1.Panel2
this.splitContainer1.Panel2.Controls.Add(this.pbMinimap); //
this.splitContainer1.Size = new System.Drawing.Size(494, 332); this.splitContainer1.Panel2.Controls.Add(this.txtDesc);
this.splitContainer1.SplitterDistance = 300; this.splitContainer1.Panel2.Controls.Add(this.lblDesc);
this.splitContainer1.TabIndex = 7; this.splitContainer1.Panel2.Controls.Add(this.txtTheater);
// this.splitContainer1.Panel2.Controls.Add(this.lblTheater);
// lblMapList this.splitContainer1.Panel2.Controls.Add(this.txtAuthor);
// this.splitContainer1.Panel2.Controls.Add(this.lblAuthor);
this.lblMapList.AutoSize = true; this.splitContainer1.Panel2.Controls.Add(this.txtTitle);
this.lblMapList.Location = new System.Drawing.Point(12, 9); this.splitContainer1.Panel2.Controls.Add(this.lblMapName);
this.lblMapList.Name = "lblMapList"; this.splitContainer1.Panel2.Controls.Add(this.lblMinimap);
this.lblMapList.Size = new System.Drawing.Size(81, 13); this.splitContainer1.Panel2.Controls.Add(this.pbMinimap);
this.lblMapList.TabIndex = 1; this.splitContainer1.Size = new System.Drawing.Size(494, 332);
this.lblMapList.Text = "Available maps:"; this.splitContainer1.SplitterDistance = 300;
// this.splitContainer1.TabIndex = 7;
// txtDesc //
// // lblMapList
this.txtDesc.BackColor = System.Drawing.SystemColors.ButtonFace; //
this.txtDesc.Location = new System.Drawing.Point(16, 289); this.lblMapList.AutoSize = true;
this.txtDesc.Name = "txtDesc"; this.lblMapList.Location = new System.Drawing.Point(12, 9);
this.txtDesc.ReadOnly = true; this.lblMapList.Name = "lblMapList";
this.txtDesc.Size = new System.Drawing.Size(162, 20); this.lblMapList.Size = new System.Drawing.Size(81, 13);
this.txtDesc.TabIndex = 14; this.lblMapList.TabIndex = 1;
// this.lblMapList.Text = "Available maps:";
// lblDesc //
// // txtDesc
this.lblDesc.AutoSize = true; //
this.lblDesc.Location = new System.Drawing.Point(13, 273); this.txtDesc.BackColor = System.Drawing.SystemColors.ButtonFace;
this.lblDesc.Name = "lblDesc"; this.txtDesc.Location = new System.Drawing.Point(16, 289);
this.lblDesc.Size = new System.Drawing.Size(63, 13); this.txtDesc.Name = "txtDesc";
this.lblDesc.TabIndex = 13; this.txtDesc.ReadOnly = true;
this.lblDesc.Text = "Description:"; this.txtDesc.Size = new System.Drawing.Size(162, 20);
// this.txtDesc.TabIndex = 14;
// txtTheater //
// // lblDesc
this.txtTheater.BackColor = System.Drawing.SystemColors.ButtonFace; //
this.txtTheater.Location = new System.Drawing.Point(16, 252); this.lblDesc.AutoSize = true;
this.txtTheater.Name = "txtTheater"; this.lblDesc.Location = new System.Drawing.Point(13, 273);
this.txtTheater.ReadOnly = true; this.lblDesc.Name = "lblDesc";
this.txtTheater.Size = new System.Drawing.Size(162, 20); this.lblDesc.Size = new System.Drawing.Size(63, 13);
this.txtTheater.TabIndex = 12; this.lblDesc.TabIndex = 13;
// this.lblDesc.Text = "Description:";
// lblTheater //
// // txtTheater
this.lblTheater.AutoSize = true; //
this.lblTheater.Location = new System.Drawing.Point(13, 236); this.txtTheater.BackColor = System.Drawing.SystemColors.ButtonFace;
this.lblTheater.Name = "lblTheater"; this.txtTheater.Location = new System.Drawing.Point(16, 252);
this.lblTheater.Size = new System.Drawing.Size(47, 13); this.txtTheater.Name = "txtTheater";
this.lblTheater.TabIndex = 11; this.txtTheater.ReadOnly = true;
this.lblTheater.Text = "Tileset:"; this.txtTheater.Size = new System.Drawing.Size(162, 20);
// this.txtTheater.TabIndex = 12;
// txtAuthor //
// // lblTheater
this.txtAuthor.BackColor = System.Drawing.SystemColors.ButtonFace; //
this.txtAuthor.Location = new System.Drawing.Point(16, 214); this.lblTheater.AutoSize = true;
this.txtAuthor.Name = "txtAuthor"; this.lblTheater.Location = new System.Drawing.Point(13, 236);
this.txtAuthor.ReadOnly = true; this.lblTheater.Name = "lblTheater";
this.txtAuthor.Size = new System.Drawing.Size(162, 20); this.lblTheater.Size = new System.Drawing.Size(47, 13);
this.txtAuthor.TabIndex = 10; this.lblTheater.TabIndex = 11;
// this.lblTheater.Text = "Tileset:";
// lblAuthor //
// // txtAuthor
this.lblAuthor.AutoSize = true; //
this.lblAuthor.Location = new System.Drawing.Point(13, 198); this.txtAuthor.BackColor = System.Drawing.SystemColors.ButtonFace;
this.lblAuthor.Name = "lblAuthor"; this.txtAuthor.Location = new System.Drawing.Point(16, 214);
this.lblAuthor.Size = new System.Drawing.Size(41, 13); this.txtAuthor.Name = "txtAuthor";
this.lblAuthor.TabIndex = 9; this.txtAuthor.ReadOnly = true;
this.lblAuthor.Text = "Author:"; this.txtAuthor.Size = new System.Drawing.Size(162, 20);
// this.txtAuthor.TabIndex = 10;
// txtTitle //
// // lblAuthor
this.txtTitle.BackColor = System.Drawing.SystemColors.ButtonFace; //
this.txtTitle.Location = new System.Drawing.Point(16, 177); this.lblAuthor.AutoSize = true;
this.txtTitle.Name = "txtTitle"; this.lblAuthor.Location = new System.Drawing.Point(13, 198);
this.txtTitle.ReadOnly = true; this.lblAuthor.Name = "lblAuthor";
this.txtTitle.Size = new System.Drawing.Size(162, 20); this.lblAuthor.Size = new System.Drawing.Size(41, 13);
this.txtTitle.TabIndex = 8; this.lblAuthor.TabIndex = 9;
// this.lblAuthor.Text = "Author:";
// lblMapName //
// // txtTitle
this.lblMapName.AutoSize = true; //
this.lblMapName.Location = new System.Drawing.Point(13, 161); this.txtTitle.BackColor = System.Drawing.SystemColors.ButtonFace;
this.lblMapName.Name = "lblMapName"; this.txtTitle.Location = new System.Drawing.Point(16, 177);
this.lblMapName.Size = new System.Drawing.Size(30, 13); this.txtTitle.Name = "txtTitle";
this.lblMapName.TabIndex = 7; this.txtTitle.ReadOnly = true;
this.lblMapName.Text = "Title:"; this.txtTitle.Size = new System.Drawing.Size(162, 20);
// this.txtTitle.TabIndex = 8;
// lblMinimap //
// // lblMapName
this.lblMinimap.AutoSize = true; //
this.lblMinimap.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.lblMapName.AutoSize = true;
this.lblMinimap.Location = new System.Drawing.Point(29, 9); this.lblMapName.Location = new System.Drawing.Point(13, 161);
this.lblMinimap.Name = "lblMinimap"; this.lblMapName.Name = "lblMapName";
this.lblMinimap.Size = new System.Drawing.Size(71, 13); this.lblMapName.Size = new System.Drawing.Size(30, 13);
this.lblMinimap.TabIndex = 6; this.lblMapName.TabIndex = 7;
this.lblMinimap.Text = "Map preview:"; this.lblMapName.Text = "Title:";
// //
// pictureBox1 // lblMinimap
// //
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.lblMinimap.AutoSize = true;
this.pictureBox1.Location = new System.Drawing.Point(336, -9); this.lblMinimap.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.pictureBox1.Name = "pictureBox1"; this.lblMinimap.Location = new System.Drawing.Point(29, 9);
this.pictureBox1.Size = new System.Drawing.Size(54, 35); this.lblMinimap.Name = "lblMinimap";
this.pictureBox1.TabIndex = 7; this.lblMinimap.Size = new System.Drawing.Size(71, 13);
this.pictureBox1.TabStop = false; this.lblMinimap.TabIndex = 6;
this.pictureBox1.Visible = false; this.lblMinimap.Text = "Map preview:";
// //
// MapSelect // pictureBox1
// //
this.AcceptButton = this.btnOk; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.pictureBox1.Location = new System.Drawing.Point(336, -9);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.pictureBox1.Name = "pictureBox1";
this.CancelButton = this.btnCancel; this.pictureBox1.Size = new System.Drawing.Size(54, 35);
this.ClientSize = new System.Drawing.Size(494, 402); this.pictureBox1.TabIndex = 7;
this.Controls.Add(this.splitContainer1); this.pictureBox1.TabStop = false;
this.Controls.Add(this.pnlBottom); this.pictureBox1.Visible = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; //
this.MaximizeBox = false; // MapSelect
this.MinimizeBox = false; //
this.Name = "MapSelect"; this.AcceptButton = this.btnOk;
this.ShowIcon = false; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.ShowInTaskbar = false; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.CancelButton = this.btnCancel;
this.Text = "Select map"; this.ClientSize = new System.Drawing.Size(494, 402);
this.Load += new System.EventHandler(this.MapSelect_Load); this.Controls.Add(this.splitContainer1);
((System.ComponentModel.ISupportInitialize)(this.pbMinimap)).EndInit(); this.Controls.Add(this.pnlBottom);
this.pnlBottom.ResumeLayout(false); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.pnlBottom.PerformLayout(); this.MaximizeBox = false;
this.splitContainer1.Panel1.ResumeLayout(false); this.MinimizeBox = false;
this.splitContainer1.Panel1.PerformLayout(); this.Name = "MapSelect";
this.splitContainer1.Panel2.ResumeLayout(false); this.ShowIcon = false;
this.splitContainer1.Panel2.PerformLayout(); this.ShowInTaskbar = false;
this.splitContainer1.ResumeLayout(false); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.Text = "Select map";
this.ResumeLayout(false); this.Load += new System.EventHandler(this.MapSelect_Load);
((System.ComponentModel.ISupportInitialize)(this.pbMinimap)).EndInit();
} this.pnlBottom.ResumeLayout(false);
this.pnlBottom.PerformLayout();
#endregion this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
public System.Windows.Forms.ListView MapList; this.splitContainer1.Panel2.ResumeLayout(false);
public System.Windows.Forms.Button btnCancel; this.splitContainer1.Panel2.PerformLayout();
public System.Windows.Forms.Button btnOk; this.splitContainer1.ResumeLayout(false);
public System.Windows.Forms.Label lblNew; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
public System.Windows.Forms.TextBox txtNew; this.ResumeLayout(false);
public System.Windows.Forms.ColumnHeader colMapName;
public System.Windows.Forms.ImageList MapIconsList; }
public System.Windows.Forms.PictureBox pbMinimap;
public System.Windows.Forms.Panel pnlBottom; #endregion
public System.Windows.Forms.SplitContainer splitContainer1;
public System.Windows.Forms.Label lblMinimap; public System.Windows.Forms.ListView MapList;
public System.Windows.Forms.TextBox txtTheater; public System.Windows.Forms.Button btnCancel;
public System.Windows.Forms.Label lblTheater; public System.Windows.Forms.Button btnOk;
public System.Windows.Forms.TextBox txtAuthor; public System.Windows.Forms.Label lblNew;
public System.Windows.Forms.Label lblAuthor; public System.Windows.Forms.TextBox txtNew;
public System.Windows.Forms.TextBox txtTitle; public System.Windows.Forms.ColumnHeader colMapName;
public System.Windows.Forms.Label lblMapName; public System.Windows.Forms.ImageList MapIconsList;
public System.Windows.Forms.TextBox txtDesc; public System.Windows.Forms.PictureBox pbMinimap;
public System.Windows.Forms.Label lblDesc; public System.Windows.Forms.Panel pnlBottom;
public System.Windows.Forms.Label lblMapList; public System.Windows.Forms.SplitContainer splitContainer1;
public System.Windows.Forms.Label lblPathOut; public System.Windows.Forms.Label lblMinimap;
public System.Windows.Forms.Label lblPath; public System.Windows.Forms.TextBox txtTheater;
public System.Windows.Forms.TextBox txtPathOut; public System.Windows.Forms.Label lblTheater;
private System.Windows.Forms.PictureBox pictureBox1; public System.Windows.Forms.TextBox txtAuthor;
} public System.Windows.Forms.Label lblAuthor;
public System.Windows.Forms.TextBox txtTitle;
public System.Windows.Forms.Label lblMapName;
public System.Windows.Forms.TextBox txtDesc;
public System.Windows.Forms.Label lblDesc;
public System.Windows.Forms.Label lblMapList;
public System.Windows.Forms.Label lblPathOut;
public System.Windows.Forms.Label lblPath;
public System.Windows.Forms.TextBox txtPathOut;
private System.Windows.Forms.PictureBox pictureBox1;
}
} }

View File

@@ -1,74 +1,84 @@
using System; #region Copyright & License Information
using System.IO; /*
using System.Windows.Forms; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
using OpenRA.FileFormats; * This file is part of OpenRA, which is free software. It is made
using OpenRA.Graphics; * available to you under the terms of the GNU General Public License
using System.Linq; * as published by the Free Software Foundation. For more information,
* see COPYING.
namespace OpenRA.Editor */
{ #endregion
public partial class MapSelect : Form
{ using System;
public string MapFolderPath; using System.IO;
using System.Windows.Forms;
public MapSelect(string currentMod) using OpenRA.FileFormats;
{ using OpenRA.Graphics;
MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" } using System.Linq;
.Aggregate(Path.Combine);
namespace OpenRA.Editor
InitializeComponent(); {
MapIconsList.Images.Add(pictureBox1.Image); public partial class MapSelect : Form
} {
public string MapFolderPath;
void MapSelect_Load(object sender, EventArgs e)
{ public MapSelect(string currentMod)
MapList.Items.Clear(); {
txtPathOut.Text = MapFolderPath; MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
.Aggregate(Path.Combine);
foreach (var map in ModData.FindMapsIn(MapFolderPath))
{ InitializeComponent();
ListViewItem map1 = new ListViewItem(); MapIconsList.Images.Add(pictureBox1.Image);
map1.Tag = map; }
map1.Text = Path.GetFileNameWithoutExtension(map);
map1.ImageIndex = 0; void MapSelect_Load(object sender, EventArgs e)
MapList.Items.Add(map1); {
} MapList.Items.Clear();
txtPathOut.Text = MapFolderPath;
// hack
if (txtNew.Text != "unnamed") foreach (var map in ModData.FindMapsIn(MapFolderPath))
MapList.Items[0].Selected = true; {
} ListViewItem map1 = new ListViewItem();
map1.Tag = map;
void MapList_SelectedIndexChanged(object sender, EventArgs e) map1.Text = Path.GetFileNameWithoutExtension(map);
{ map1.ImageIndex = 0;
if (MapList.SelectedItems.Count == 1) MapList.Items.Add(map1);
{ }
txtNew.Text = MapList.SelectedItems[0].Text;
txtNew.Tag = MapList.SelectedItems[0].Tag; // hack
if (txtNew.Text != "unnamed")
var map = new Map(txtNew.Tag as string); MapList.Items[0].Selected = true;
txtTitle.Text = map.Title; }
txtAuthor.Text = map.Author;
txtTheater.Text = map.Tileset; void MapList_SelectedIndexChanged(object sender, EventArgs e)
txtDesc.Text = map.Description; {
pbMinimap.Image = null; if (MapList.SelectedItems.Count == 1)
{
try txtNew.Text = MapList.SelectedItems[0].Text;
{ txtNew.Tag = MapList.SelectedItems[0].Tag;
pbMinimap.Image = Minimap.AddStaticResources(map, Minimap.TerrainBitmap(map, true));
} var map = new Map(txtNew.Tag as string);
catch (Exception ed) txtTitle.Text = map.Title;
{ txtAuthor.Text = map.Author;
Console.WriteLine("No map preview image found: {0}", ed.ToString()); txtTheater.Text = map.Tileset;
} txtDesc.Text = map.Description;
finally { } pbMinimap.Image = null;
}
} try
{
void txtPathOut_TextChanged(object sender, EventArgs e) pbMinimap.Image = Minimap.AddStaticResources(map, Minimap.TerrainBitmap(map, true));
{ }
MapFolderPath = txtPathOut.Text; catch (Exception ed)
} {
Console.WriteLine("No map preview image found: {0}", ed.ToString());
} }
} finally { }
}
}
void txtPathOut_TextChanged(object sender, EventArgs e)
{
MapFolderPath = txtPathOut.Text;
}
}
}

View File

@@ -1,177 +1,177 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="MapIconsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="MapIconsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAArjSURBVFhHrVcJUFRXFmVpkE0Wg0ZEMoIBl8RodGSMmVES YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAArjSURBVFhHrVcJUFRXFmVpkE0Wg0ZEMoIBl8RodGSMmVES
R0NiChVxCyIIAmFfhe6maeh9AZodZHFpUFQWcQmKisiuLKLEKFFEcIuljtZMYmI5Uc/c14EZYyapmpq8 R0NiChVxCyIIAmFfhe6maeh9AZodZHFpUFQWcQmKisiuLKLEKFFEcIuljtZMYmI5Uc/c14EZYyapmpq8
qlP/9/+/373v3HPu+19P7/cf+jSlEWHCOEuzZfNn2Yvo3Pj3D/PTjCwYAwtgyeFwFk163Tos2tvtWJZw qlP/9/+/373v3HPu+19P7/cf+jSlEWHCOEuzZfNn2Yvo3Pj3D/PTjCwYAwtgyeFwFk163Tos2tvtWJZw
zeUjmYFP6vL9fhw31vRPI8/9LnmMrtCWZhtPcJ7hbC/W8DwfnS0LR0t5NKoFazHcqsaprE3YGbMQLrYW zeUjmYFP6vL9fhw31vRPI8/9LnmMrtCWZhtPcJ7hbC/W8DwfnS0LR0t5NKoFazHcqsaprE3YGbMQLrYW
W/7fBAxogjGEd5wcXuPK4jxa60qD75VrfIbKMrYMD7VlPX/Ul49rp8RoyPbFIaEnhpuU6NRGoVa2HKuX W/7fBAxogjGEd5wcXuPK4jxa60qD75VrfIbKMrYMD7VlPX/Ul49rp8RoyPbFIaEnhpuU6NRGoVa2HKuX
zEj/X8vAVmlIsDY2Nna2sjBd+ee5b7Yq4tfgfm8a7pxNw60OFa6e4uFmhxr/uFSIexfz0VsZh7PaIJzb zEj/X8vAVmlIsDY2Nna2sjBd+ee5b7Yq4tfgfm8a7pxNw60OFa6e4uFmhxr/uFSIexfz0VsZh7PaIJzb
F42u8hAcV2/ANz3KF8Hub52kucb+Fv+jAccbm5quWOfxYX5y6Mcnq/IDh1oreX/vOcx9drdbjTudUgye F42u8hAcV2/ANz3KF8Hub52kucb+Fv+jAccbm5quWOfxYX5y6Mcnq/IDh1oreX/vOcx9drdbjTudUgye
Tsb1piT0H4/DACUw0JiEh33ZePhlFi7UxOCLtI1o2x6IW2cUqM/egLtdediV9MnjSTYm60bE+Ys8rMzN Tsb1piT0H4/DACUw0JiEh33ZePhlFi7UxOCLtI1o2x6IW2cUqM/egLtdediV9MnjSTYm60bE+Ys8rMzN
zd1c3/vLgVRV3lN1XjkqyzNoNaEUjIvrLXwMtQsw1JqEy/UxuHg0DJcp+KXj8bh0IobOucSGDA8vpqE6 zd1c3/vLgVRV3lN1XjkqyzNoNaEUjIvrLXwMtQsw1JqEy/UxuHg0DJcp+KXj8bh0IobOucSGDA8vpqE6
+VNINixBU0kQbp5JJ8jxDSXdeyAE5arlAxTZ/BfRra2tS8Tqwh9L9tQhq6gSabm7odLkoP8oF90V/rjR +VNINixBU0kQbp5JJ8jxDSXdeyAE5arlAxTZ/BfRra2tS8Tqwh9L9tQhq6gSabm7odLkoP8oF90V/rjR
LsRgExc32oS40ZFCiQgw2Mgj+gW42pBI4OPSsUh6Jgn1mX4ojXJH865IXDzCx50uDe6fV+P8oQQ4Tx6r LsRgExc32oS40ZFCiQgw2Mgj+gW42pBI4OPSsUh6Jgn1mX4ojXJH865IXDzCx50uDe6fV+P8oQQ4Tx6r
pOATmVteKgdjXu/Mhk1h328rO4TMwn3gp2YhmquEX7gAfYfjcb4qGH0HQ3D5WAiunU7ApfpofH0ymhIS pOATmVteKgdjXu/Mhk1h328rO4TMwn3gp2YhmquEX7gAfYfjcb4qGH0HQ3D5WAiunU7ApfpofH0ymhIS
UwkSqQRb6VoYvm6IZvXG7W4VBVbjwQU1/tanIQZkGDqtwOmSjzHXxXaLsZnZpy85QpdAnfunax/mllRD UwkSqQRb6VoYvm6IZvXG7W4VBVbjwQU1/tanIQZkGDqtwOmSjzHXxXaLsZnZpy85QpdAnfunax/mllRD
ma2FQJyHxORMJAqzwBVpUJgtRLF8E7bxlqKjzA991QEYaIijgFwMt6VggJK60hCFr46F4sqprbjbLaf6 ma2FQJyHxORMJAqzwBVpUJgtRLF8E7bxlqKjzA991QEYaIijgFwMt6VggJK60hCFr46F4sqprbjbLaf6
S0icIh1rwy1i3OvNQff+GEgj3r87/c1JLIGfjX1LP/F6KJDlIy1vN4SyQohVRdAU7IVIXQxuSiZ8/OOw S0icIh1rwy1i3OvNQff+GEgj3r87/c1JLIGfjX1LP/F6KJDlIy1vN4SyQohVRdAU7IVIXQxuSiZ8/OOw
JYyP8EiqfV04Lh2JoHIwMSbiwoFgtO1ah97aTSTMKGIjDl/WhONWl5jKlYrbZ9OJGRWVIg/+axf8SK5a JYyP8EiqfV04Lh2JoHIwMSbiwoFgtO1ah97aTSTMKGIjDl/WhONWl5jKlYrbZ9OJGRWVIg/+axf8SK5a
8WoC5fPm//l2qqIIOaVVECm3QZG5C7L0HZCklYJLTCQKNUiWFYAnykJYRDRaywNxrTGRyhKNKyciiIEY 8WoC5fPm//l2qqIIOaVVECm3QZG5C7L0HZCklYJLTCQKNUiWFYAnykJYRDRaywNxrTGRyhKNKyciiIEY
dFd743z1ZioT6eJkHK41kXDbRFSKbHzTpcJwsxoHc71fTLGzyBix+L/zUFlaWX+VTcFZ4NzSamQXV1Lw dFd743z1ZioT6eJkHK41kXDbRFSKbHzTpcJwsxoHc71fTLGzyBix+L/zUFlaWX+VTcFZ4NzSamQXV1Lw
EggkeeBRAsnSfKgyy6DKKcNnxEahIgRfHg5B/7EoDDYn4ma7FD0VAThfG4Cemi3EDI90IKWVq3GbHHKz EggkeeBRAsnSfKgyy6DKKcNnxEahIgRfHg5B/7EoDDYn4ma7FD0VAThfG4Cemi3EDI90IKWVq3GbHHKz
nUpCbrh6QokEr5mPTEw4773MQij9aPZY5fNYrC6hEhRAnrkTjJEkcS5ieWokS/IhUZdCrtlJbGQiIjQQ nUpCbrh6QokEr5mPTEw4773MQij9aPZY5fNYrC6hEhRAnrkTjJEkcS5ieWokS/IhUZdCrtlJbGQiIjQQ
/YeD0VMVhoTVbmgs8iVBctG11xtdlUHkDGpQpIN7velUAhmG2+W43spclI6K9JWY6TyxlGKOGxWjG53s /YeD0VMVhoTVbmgs8iVBctG11xtdlUHkDGpQpIN7velUAhmG2+W43spclI6K9JWY6TyxlGKOGxWjG53s
5HBMBpZ7+iI6UY44vhoiVTH4ohxCLoTyArqu1OlBll6CZHE20mI9EOjuis3L5uFCbTh6D4Wgu8offYeC 5HBMBpZ7+iI6UY44vhoiVTH4ohxCLoTyArqu1OlBll6CZHE20mI9EOjuis3L5uFCbTh6D4Wgu8offYeC
qSRccgcPD/qyMEiBb55VYahFgSuNckhjlr2YaGMqH2ntOiKmEAQGBgbnNviGPg2LFSM4UoiAUD78ghLo qSRccgcPD/qyMEiBb55VYahFgSuNckhjlr2YaGMqH2ntOiKmEAQGBgbnNviGPg2LFSM4UoiAUD78ghLo
yEVojBhRiQqEx0nAI5sKiBH/z+OgVfuic7c/Lh+NwZndfughDfQdCtL1hKFmEW51ymn1EjpSAh1ytFCL yEVojBhRiQqEx0nAI5sKiBH/z+OgVfuic7c/Lh+NwZndfughDfQdCtL1hKFmEW51ymn1EjpSAh1ytFCL
Pl+nhKebY8XLTYn16DWEgzY2ttdzyI6yjB06+uP4acRANokvhzRRjBR5oe4aN4WupeYgNCIWZ2vj0b17 Pl+nhKebY8XLTYn16DWEgzY2ttdzyI6yjB06+uP4acRANokvhzRRjBR5oe4aN4WupeYgNCIWZ2vj0b17
I/UKf3Tt34jOis9otTyyILmkORUDTRKyqxj9DSI07Y0k26Yhes38Roo3YVQH7OVhGiGR0K7O0epEqCRB I/UKf3Tt34jOis9otTyyILmkORUDTRKyqxj9DSI07Y0k26Yhes38Roo3YVQH7OVhGiGR0K7O0epEqCRB
shKwRIQkQrZqMelAIM6ncihII9uQSCXZEi2HSMjDXvVqXKSGdTLbg6z6OVkwGcfLQvHB4jkYbJMS/UL0 shKwRIQkQrZqMelAIM6ncihII9uQSCXZEi2HSMjDXvVqXKSGdTLbg6z6OVkwGcfLQvHB4jkYbJMS/UL0
1aeSM6So1Hg/oljTR93AupEVYSXhGE+soZa8X+cIlgALzFhg5/HJ6YhIzACXVs9EKiHRMmckSfMQGx0G 1aeSM6So1Hg/oljTR93AupEVYSXhGE+soZa8X+cIlgALzFhg5/HJ6YhIzACXVs9EKiHRMmckSfMQGx0G
rXIldU4/dJSvJx3EoSDZC7OszHByTxTOfZGEq00y9B3lo70iElamhp4Ujy1eN8wIrEOd0BRW6DpiWEwq rXIldU4/dJSvJx3EoSDZC7OszHByTxTOfZGEq00y9B3lo70iElamhp4Ujy1eN8wIrEOd0BRW6DpiWEwq
giKSdYiIl5IOUskRKh39AmKECZNP7Mg0O6Ci59Pzd4O/NQK7FBvQULyGOmMUpBsX4KqjGTL5qzHQIqJy giKSdYiIl5IOUskRKh39AmKECZNP7Mg0O6Ci59Pzd4O/NQK7FBvQULyGOmMUpBsX4KqjGTL5qzHQIqJy
iNG6Px5dtYlY7jqhmeKxvUE32C7FGKiP58uf5W6v0ekgPkmNrYIMor4YqcoinQBFdGQrl2ZsB4/cwBJR iNG6Px5dtYlY7jqhmeKxvUE32C7FGKiP58uf5W6v0ekgPkmNrYIMor4YqcoinQBFdGQrl2ZsB4/cwBJR
Zml/+k0sxcQnQZzgDWHIIni9NQHSHU5IS15EPSEN11ok6G9UQs1dh/lvv/GdkZHR3NEETOhkIUE7zvb1 Zml/+k0sxcQnQZzgDWHIIni9NQHSHU5IS15EPSEN11ok6G9UQs1dh/lvv/GdkZHR3NEETOhkIUE7zvb1
wRRFwYv0vD3UBTORJCEdSHMhydgFCXVHVnuWEGvZrDewjqmzKbHDNjHmFl5KBlasWokiFwtop5nhyL6p wRRFwYv0vD3UBTORJCEdSHMhydgFCXVHVnuWEGvZrDewjqmzKbHDNjHmFl5KBlasWokiFwtop5nhyL6p
2JO/CN2HBdSgMpHJ88GH82c8s7b4T1vmUPA3CFxCp19QzBPdtpxdRqon2kkDKRSYXeOJcyBUFMI7IJ70 2JO/CN2HBdSgMpHJ88GH82c8s7b4T1vmUPA3CFxCp19QzBPdtpxdRqon2kkDKRSYXeOJcyBUFMI7IJ70
kYsEgRLTXGbgrzNnwmWqC2Y4OsLZZjx43El4ggXI1zohy24MAFd4u9tj8YLpmD71DTiMtwGHY1A7ygB7 kYsEgRLTXGbgrzNnwmWqC2Y4OsLZZjx43El4ggXI1zohy24MAFd4u9tj8YLpmD71DTiMtwGHY1A7ygB7
52N29CLULV7qeT+HnFCoPairu87/RC9rTjE8JYJoY/p4lR8lVQAp7Rc+/pHY7OKE61NN8a21MbQpfwC+ 52N29CLULV7qeT+HnFCoPairu87/RC9rTjE8JYJoY/p4lR8lVQAp7Rc+/pHY7OKE61NN8a21MbQpfwC+
m4fbQ7MQNdcCfWMMsTPWDi2yyRgyNkDhOGPYGhpeo97jP5oAcwJjYQ4hk3DOyzvwn9v3HtUJjHXAzSFc m4fbQ7MQNdcCfWMMsTPWDi2yyRgyNkDhOGPYGhpeo97jP5oAcwJjYQ4hk3DOyzvwn9v3HtUJjHXAzSFc
RHHlCAznIyAsCZa2k56u3xT2gtHPmGHCdXtnHh47mKBqjS1K5Q7ITrCjlf8RqXPM0bDUCr3bp2C9nj70 RHHlCAznIyAsCZa2k56u3xT2gtHPmGHCdXtnHh47mKBqjS1K5Q7ITrCjlf8RqXPM0bDUCr3bp2C9nj70
DDinKMYSwmujCbAjY4G9ZrN3tyMLP/D4IT1vP/J21CBeoKaa55MTUhAeK8J7i91v0DMdxqZmgw7Oc74N DDinKMYSwmujCbAjY4G9ZrN3tyMLP/D4IT1vP/J21CBeoKaa55MTUhAeK8J7i91v0DMdxqZmgw7Oc74N
iFQ8T5YX6ZzisWI9Uiebo8rKCOcsjLAv1Z72BydUxE5ElcTuKf2P9RunEeGzmD8bTIzsI0I7wc7xdgyf iFQ8T5YX6ZzisWI9Uiebo8rKCOcsjLAv1Z72BydUxE5ElcTuKf2P9RunEeGzmD8bTIzsI0I7wc7xdgyf
NiayWVoueZ1qz7zPT8l5McnBqZieYZsYO/a4zF7yaKWP4HlASMKLj9xX4WrXWzhdMxUFlkaI1tPDAZE9 NiayWVoueZ1qz7zPT8l5McnBqZieYZsYO/a4zF7yaKWP4HlASMKLj9xX4WrXWzhdMxUFlkaI1tPDAZE9
Htc4wWuhOas5Y/oXgUezYDdZdmK2N6zzCfuB1V1GFkulNswT5cFllms73f+QMIWwjCDjGJnUW1rbfu2z Htc4wWuhOas5Y/oXgUezYDdZdmK2N6zzCfuB1V1GFkulNswT5cFllms73f+QMIWwjCDjGJnUW1rbfu2z
wvXJk85pUH5gieNJdugvd8QV7RSc0TjgiMwevkvH3np1xa/+ZplZE9jecNh14UcPmO8VmnLyfzGr/feU wvXJk85pUH5gieNJdugvd8QV7RSc0TjgiMwevkvH3np1xa/+ZplZE9jecNh14UcPmO8VmnLyfzGr/feU
mB/dY7VjybItdSZhrb6+fvEYY6PuMWOMn7ZbGeILfQNYmnN+mO1o/OBdCw74HAMsMjR8NjL/r+Yx+p3H mB/dY7VjybItdSZhrb6+fvEYY6PuMWOMn7ZbGeILfQNYmnN+mO1o/OBdCw74HAMsMjR8NjL/r+Yx+p3H
XhjKZs93uxMZr4Z/uOb54qWf3bGf4pw3EpC1UPYsS3g0EU9K4uBsI86zYHPOY3MOp4zuRRLyDfT1O941 XhjKZs93uxMZr4Z/uOb54qWf3bGf4pw3EpC1UPYsS3g0EU9K4uBsI86zYHPOY3MOp4zuRRLyDfT1O941
Mrzvb86Bob4h+0r6zcEmdiFICA2vvT55kLFBYOJhnYt9or06TOmCJ7HTbGxgADpndmaJMU29QxAQKvTo Mrzvb86Bob4h+0r6zcEmdiFICA2vvT55kLFBYOJhnYt9or06TOmCJ7HTbGxgADpndmaJMU29QxAQKvTo
vhnHkN1nX12/OlgCNoT3CZsIvgRWc9ao2IT/bTD3+BID7N1/zisBWCKOBB/CagKf8PboJP8CoUmu3yhA vhnHkN1nX12/OlgCNoT3CZsIvgRWc9ao2IT/bTD3+BID7N1/zisBWCKOBB/CagKf8PboJP8CoUmu3yhA
ga8AAAAASUVORK5CYII= ga8AAAAASUVORK5CYII=
</value> </value>
</data> </data>
</root> </root>

View File

@@ -1,286 +1,296 @@
namespace OpenRA.Editor #region Copyright & License Information
{ /*
partial class NewMapDialog * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
{ * This file is part of OpenRA, which is free software. It is made
/// <summary> * available to you under the terms of the GNU General Public License
/// Required designer variable. * as published by the Free Software Foundation. For more information,
/// </summary> * see COPYING.
private System.ComponentModel.IContainer components = null; */
#endregion
/// <summary>
/// Clean up any resources being used. namespace OpenRA.Editor
/// </summary> {
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> partial class NewMapDialog
protected override void Dispose(bool disposing) {
{ /// <summary>
if (disposing && (components != null)) /// Required designer variable.
{ /// </summary>
components.Dispose(); private System.ComponentModel.IContainer components = null;
}
base.Dispose(disposing); /// <summary>
} /// Clean up any resources being used.
/// </summary>
#region Windows Form Designer generated code /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
/// <summary> {
/// Required method for Designer support - do not modify if (disposing && (components != null))
/// the contents of this method with the code editor. {
/// </summary> components.Dispose();
private void InitializeComponent() }
{ base.Dispose(disposing);
this.button2 = new System.Windows.Forms.Button(); }
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); #region Windows Form Designer generated code
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); /// <summary>
this.cordonBottom = new System.Windows.Forms.NumericUpDown(); /// Required method for Designer support - do not modify
this.cordonTop = new System.Windows.Forms.NumericUpDown(); /// the contents of this method with the code editor.
this.cordonRight = new System.Windows.Forms.NumericUpDown(); /// </summary>
this.cordonLeft = new System.Windows.Forms.NumericUpDown(); private void InitializeComponent()
this.height = new System.Windows.Forms.NumericUpDown(); {
this.width = new System.Windows.Forms.NumericUpDown(); this.button2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button();
this.theater = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit(); this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.cordonTop)).BeginInit(); this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.cordonRight)).BeginInit(); this.cordonBottom = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).BeginInit(); this.cordonTop = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit(); this.cordonRight = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit(); this.cordonLeft = new System.Windows.Forms.NumericUpDown();
this.SuspendLayout(); this.height = new System.Windows.Forms.NumericUpDown();
// this.width = new System.Windows.Forms.NumericUpDown();
// button2 this.label4 = new System.Windows.Forms.Label();
// this.theater = new System.Windows.Forms.ComboBox();
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK; ((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit();
this.button2.Location = new System.Drawing.Point(229, 160); ((System.ComponentModel.ISupportInitialize)(this.cordonTop)).BeginInit();
this.button2.Name = "button2"; ((System.ComponentModel.ISupportInitialize)(this.cordonRight)).BeginInit();
this.button2.Size = new System.Drawing.Size(75, 23); ((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).BeginInit();
this.button2.TabIndex = 7; ((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit();
this.button2.Text = "OK"; ((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit();
this.button2.UseVisualStyleBackColor = true; this.SuspendLayout();
// //
// button1 // button2
// //
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(310, 160); this.button2.Location = new System.Drawing.Point(229, 160);
this.button1.Name = "button1"; this.button2.Name = "button2";
this.button1.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 8; this.button2.TabIndex = 7;
this.button1.Text = "Cancel"; this.button2.Text = "OK";
this.button1.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
// //
// label3 // button1
// //
this.label3.AutoSize = true; this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.label3.Location = new System.Drawing.Point(31, 77); this.button1.Location = new System.Drawing.Point(310, 160);
this.label3.Name = "label3"; this.button1.Name = "button1";
this.label3.Size = new System.Drawing.Size(107, 13); this.button1.Size = new System.Drawing.Size(75, 23);
this.label3.TabIndex = 9; this.button1.TabIndex = 8;
this.label3.Text = "Cordon Right/Bottom"; this.button1.Text = "Cancel";
// this.button1.UseVisualStyleBackColor = true;
// label2 //
// // label3
this.label2.AutoSize = true; //
this.label2.Location = new System.Drawing.Point(31, 51); this.label3.AutoSize = true;
this.label2.Name = "label2"; this.label3.Location = new System.Drawing.Point(31, 77);
this.label2.Size = new System.Drawing.Size(86, 13); this.label3.Name = "label3";
this.label2.TabIndex = 11; this.label3.Size = new System.Drawing.Size(107, 13);
this.label2.Text = "Cordon Left/Top"; this.label3.TabIndex = 9;
// this.label3.Text = "Cordon Right/Bottom";
// label1 //
// // label2
this.label1.AutoSize = true; //
this.label1.Location = new System.Drawing.Point(31, 25); this.label2.AutoSize = true;
this.label1.Name = "label1"; this.label2.Location = new System.Drawing.Point(31, 51);
this.label1.Size = new System.Drawing.Size(27, 13); this.label2.Name = "label2";
this.label1.TabIndex = 10; this.label2.Size = new System.Drawing.Size(86, 13);
this.label1.Text = "Size"; this.label2.TabIndex = 11;
// this.label2.Text = "Cordon Left/Top";
// cordonBottom //
// // label1
this.cordonBottom.Location = new System.Drawing.Point(280, 75); //
this.cordonBottom.Maximum = new decimal(new int[] { this.label1.AutoSize = true;
2048, this.label1.Location = new System.Drawing.Point(31, 25);
0, this.label1.Name = "label1";
0, this.label1.Size = new System.Drawing.Size(27, 13);
0}); this.label1.TabIndex = 10;
this.cordonBottom.Name = "cordonBottom"; this.label1.Text = "Size";
this.cordonBottom.Size = new System.Drawing.Size(105, 20); //
this.cordonBottom.TabIndex = 5; // cordonBottom
this.cordonBottom.Value = new decimal(new int[] { //
112, this.cordonBottom.Location = new System.Drawing.Point(280, 75);
0, this.cordonBottom.Maximum = new decimal(new int[] {
0, 2048,
0}); 0,
this.cordonBottom.Enter += new System.EventHandler(this.SelectText); 0,
// 0});
// cordonTop this.cordonBottom.Name = "cordonBottom";
// this.cordonBottom.Size = new System.Drawing.Size(105, 20);
this.cordonTop.Location = new System.Drawing.Point(280, 49); this.cordonBottom.TabIndex = 5;
this.cordonTop.Maximum = new decimal(new int[] { this.cordonBottom.Value = new decimal(new int[] {
2048, 112,
0, 0,
0, 0,
0}); 0});
this.cordonTop.Name = "cordonTop"; this.cordonBottom.Enter += new System.EventHandler(this.SelectText);
this.cordonTop.Size = new System.Drawing.Size(105, 20); //
this.cordonTop.TabIndex = 3; // cordonTop
this.cordonTop.Value = new decimal(new int[] { //
16, this.cordonTop.Location = new System.Drawing.Point(280, 49);
0, this.cordonTop.Maximum = new decimal(new int[] {
0, 2048,
0}); 0,
this.cordonTop.Enter += new System.EventHandler(this.SelectText); 0,
// 0});
// cordonRight this.cordonTop.Name = "cordonTop";
// this.cordonTop.Size = new System.Drawing.Size(105, 20);
this.cordonRight.Location = new System.Drawing.Point(169, 75); this.cordonTop.TabIndex = 3;
this.cordonRight.Maximum = new decimal(new int[] { this.cordonTop.Value = new decimal(new int[] {
2048, 16,
0, 0,
0, 0,
0}); 0});
this.cordonRight.Name = "cordonRight"; this.cordonTop.Enter += new System.EventHandler(this.SelectText);
this.cordonRight.Size = new System.Drawing.Size(105, 20); //
this.cordonRight.TabIndex = 4; // cordonRight
this.cordonRight.Value = new decimal(new int[] { //
112, this.cordonRight.Location = new System.Drawing.Point(169, 75);
0, this.cordonRight.Maximum = new decimal(new int[] {
0, 2048,
0}); 0,
this.cordonRight.Enter += new System.EventHandler(this.SelectText); 0,
// 0});
// cordonLeft this.cordonRight.Name = "cordonRight";
// this.cordonRight.Size = new System.Drawing.Size(105, 20);
this.cordonLeft.Location = new System.Drawing.Point(169, 49); this.cordonRight.TabIndex = 4;
this.cordonLeft.Maximum = new decimal(new int[] { this.cordonRight.Value = new decimal(new int[] {
2048, 112,
0, 0,
0, 0,
0}); 0});
this.cordonLeft.Name = "cordonLeft"; this.cordonRight.Enter += new System.EventHandler(this.SelectText);
this.cordonLeft.Size = new System.Drawing.Size(105, 20); //
this.cordonLeft.TabIndex = 2; // cordonLeft
this.cordonLeft.Value = new decimal(new int[] { //
16, this.cordonLeft.Location = new System.Drawing.Point(169, 49);
0, this.cordonLeft.Maximum = new decimal(new int[] {
0, 2048,
0}); 0,
this.cordonLeft.Enter += new System.EventHandler(this.SelectText); 0,
// 0});
// height this.cordonLeft.Name = "cordonLeft";
// this.cordonLeft.Size = new System.Drawing.Size(105, 20);
this.height.Increment = new decimal(new int[] { this.cordonLeft.TabIndex = 2;
8, this.cordonLeft.Value = new decimal(new int[] {
0, 16,
0, 0,
0}); 0,
this.height.Location = new System.Drawing.Point(280, 23); 0});
this.height.Maximum = new decimal(new int[] { this.cordonLeft.Enter += new System.EventHandler(this.SelectText);
2048, //
0, // height
0, //
0}); this.height.Increment = new decimal(new int[] {
this.height.Name = "height"; 8,
this.height.Size = new System.Drawing.Size(105, 20); 0,
this.height.TabIndex = 1; 0,
this.height.Value = new decimal(new int[] { 0});
128, this.height.Location = new System.Drawing.Point(280, 23);
0, this.height.Maximum = new decimal(new int[] {
0, 2048,
0}); 0,
this.height.Enter += new System.EventHandler(this.SelectText); 0,
// 0});
// width this.height.Name = "height";
// this.height.Size = new System.Drawing.Size(105, 20);
this.width.Increment = new decimal(new int[] { this.height.TabIndex = 1;
8, this.height.Value = new decimal(new int[] {
0, 128,
0, 0,
0}); 0,
this.width.Location = new System.Drawing.Point(169, 23); 0});
this.width.Maximum = new decimal(new int[] { this.height.Enter += new System.EventHandler(this.SelectText);
2048, //
0, // width
0, //
0}); this.width.Increment = new decimal(new int[] {
this.width.Name = "width"; 8,
this.width.Size = new System.Drawing.Size(105, 20); 0,
this.width.TabIndex = 0; 0,
this.width.Value = new decimal(new int[] { 0});
128, this.width.Location = new System.Drawing.Point(169, 23);
0, this.width.Maximum = new decimal(new int[] {
0, 2048,
0}); 0,
this.width.Enter += new System.EventHandler(this.SelectText); 0,
// 0});
// label4 this.width.Name = "width";
// this.width.Size = new System.Drawing.Size(105, 20);
this.label4.AutoSize = true; this.width.TabIndex = 0;
this.label4.Location = new System.Drawing.Point(31, 124); this.width.Value = new decimal(new int[] {
this.label4.Name = "label4"; 128,
this.label4.Size = new System.Drawing.Size(44, 13); 0,
this.label4.TabIndex = 14; 0,
this.label4.Text = "Tileset"; 0});
// this.width.Enter += new System.EventHandler(this.SelectText);
// theater //
// // label4
this.theater.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; //
this.theater.FormattingEnabled = true; this.label4.AutoSize = true;
this.theater.Location = new System.Drawing.Point(169, 121); this.label4.Location = new System.Drawing.Point(31, 124);
this.theater.Name = "theater"; this.label4.Name = "label4";
this.theater.Size = new System.Drawing.Size(216, 21); this.label4.Size = new System.Drawing.Size(44, 13);
this.theater.TabIndex = 6; this.label4.TabIndex = 14;
// this.label4.Text = "Tileset";
// NewMapDialog //
// // theater
this.AcceptButton = this.button2; //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.theater.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.theater.FormattingEnabled = true;
this.CancelButton = this.button1; this.theater.Location = new System.Drawing.Point(169, 121);
this.ClientSize = new System.Drawing.Size(418, 210); this.theater.Name = "theater";
this.Controls.Add(this.theater); this.theater.Size = new System.Drawing.Size(216, 21);
this.Controls.Add(this.label4); this.theater.TabIndex = 6;
this.Controls.Add(this.button2); //
this.Controls.Add(this.button1); // NewMapDialog
this.Controls.Add(this.label3); //
this.Controls.Add(this.label2); this.AcceptButton = this.button2;
this.Controls.Add(this.label1); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Controls.Add(this.cordonBottom); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cordonTop); this.CancelButton = this.button1;
this.Controls.Add(this.cordonRight); this.ClientSize = new System.Drawing.Size(418, 210);
this.Controls.Add(this.cordonLeft); this.Controls.Add(this.theater);
this.Controls.Add(this.height); this.Controls.Add(this.label4);
this.Controls.Add(this.width); this.Controls.Add(this.button2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Controls.Add(this.button1);
this.Name = "NewMapDialog"; this.Controls.Add(this.label3);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Controls.Add(this.label2);
this.Text = "New Map"; this.Controls.Add(this.label1);
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).EndInit(); this.Controls.Add(this.cordonBottom);
((System.ComponentModel.ISupportInitialize)(this.cordonTop)).EndInit(); this.Controls.Add(this.cordonTop);
((System.ComponentModel.ISupportInitialize)(this.cordonRight)).EndInit(); this.Controls.Add(this.cordonRight);
((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).EndInit(); this.Controls.Add(this.cordonLeft);
((System.ComponentModel.ISupportInitialize)(this.height)).EndInit(); this.Controls.Add(this.height);
((System.ComponentModel.ISupportInitialize)(this.width)).EndInit(); this.Controls.Add(this.width);
this.ResumeLayout(false); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.PerformLayout(); this.Name = "NewMapDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
} this.Text = "New Map";
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).EndInit();
#endregion ((System.ComponentModel.ISupportInitialize)(this.cordonTop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cordonRight)).EndInit();
private System.Windows.Forms.Button button2; ((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).EndInit();
private System.Windows.Forms.Button button1; ((System.ComponentModel.ISupportInitialize)(this.height)).EndInit();
private System.Windows.Forms.Label label3; ((System.ComponentModel.ISupportInitialize)(this.width)).EndInit();
private System.Windows.Forms.Label label2; this.ResumeLayout(false);
private System.Windows.Forms.Label label1; this.PerformLayout();
public System.Windows.Forms.NumericUpDown cordonBottom;
public System.Windows.Forms.NumericUpDown cordonTop; }
public System.Windows.Forms.NumericUpDown cordonRight;
public System.Windows.Forms.NumericUpDown cordonLeft; #endregion
public System.Windows.Forms.NumericUpDown height;
public System.Windows.Forms.NumericUpDown width; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Button button1;
public System.Windows.Forms.ComboBox theater; private System.Windows.Forms.Label label3;
} private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
public System.Windows.Forms.NumericUpDown cordonBottom;
public System.Windows.Forms.NumericUpDown cordonTop;
public System.Windows.Forms.NumericUpDown cordonRight;
public System.Windows.Forms.NumericUpDown cordonLeft;
public System.Windows.Forms.NumericUpDown height;
public System.Windows.Forms.NumericUpDown width;
private System.Windows.Forms.Label label4;
public System.Windows.Forms.ComboBox theater;
}
} }

View File

@@ -1,120 +1,120 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
</root> </root>

View File

@@ -1,159 +1,159 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{00038B75-405B-44F5-8691-BD2546DBE224}</ProjectGuid> <ProjectGuid>{00038B75-405B-44F5-8691-BD2546DBE224}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenRA.Editor</RootNamespace> <RootNamespace>OpenRA.Editor</RootNamespace>
<AssemblyName>OpenRA.Editor</AssemblyName> <AssemblyName>OpenRA.Editor</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ApplicationIcon>OpenRA.Editor.Icon.ico</ApplicationIcon> <ApplicationIcon>OpenRA.Editor.Icon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\</OutputPath> <OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core"> <Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Xml.Linq"> <Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Data.DataSetExtensions"> <Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ActorTemplate.cs" /> <Compile Include="ActorTemplate.cs" />
<Compile Include="ActorTool.cs" /> <Compile Include="ActorTool.cs" />
<Compile Include="BrushTool.cs" /> <Compile Include="BrushTool.cs" />
<Compile Include="ErrorListDialog.cs"> <Compile Include="ErrorListDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="ErrorListDialog.Designer.cs"> <Compile Include="ErrorListDialog.Designer.cs">
<DependentUpon>ErrorListDialog.cs</DependentUpon> <DependentUpon>ErrorListDialog.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Form1.cs"> <Compile Include="Form1.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Form1.Designer.cs"> <Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="ITool.cs" /> <Compile Include="ITool.cs" />
<Compile Include="LegacyMapImporter.cs" /> <Compile Include="LegacyMapImporter.cs" />
<Compile Include="MapSelect.cs"> <Compile Include="MapSelect.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="MapSelect.Designer.cs"> <Compile Include="MapSelect.Designer.cs">
<DependentUpon>MapSelect.cs</DependentUpon> <DependentUpon>MapSelect.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="NewMapDialog.cs"> <Compile Include="NewMapDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="NewMapDialog.Designer.cs"> <Compile Include="NewMapDialog.Designer.cs">
<DependentUpon>NewMapDialog.cs</DependentUpon> <DependentUpon>NewMapDialog.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="PropertiesDialog.cs"> <Compile Include="PropertiesDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="PropertiesDialog.Designer.cs"> <Compile Include="PropertiesDialog.Designer.cs">
<DependentUpon>PropertiesDialog.cs</DependentUpon> <DependentUpon>PropertiesDialog.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="MapSelect.resx"> <EmbeddedResource Include="MapSelect.resx">
<DependentUpon>MapSelect.cs</DependentUpon> <DependentUpon>MapSelect.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="NewMapDialog.resx"> <EmbeddedResource Include="NewMapDialog.resx">
<DependentUpon>NewMapDialog.cs</DependentUpon> <DependentUpon>NewMapDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="PropertiesDialog.resx"> <EmbeddedResource Include="PropertiesDialog.resx">
<DependentUpon>PropertiesDialog.cs</DependentUpon> <DependentUpon>PropertiesDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="ResizeDialog.resx"> <EmbeddedResource Include="ResizeDialog.resx">
<DependentUpon>ResizeDialog.cs</DependentUpon> <DependentUpon>ResizeDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<Compile Include="Properties\Settings.Designer.cs"> <Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Include="RenderUtils.cs" /> <Compile Include="RenderUtils.cs" />
<Compile Include="ResizeDialog.cs"> <Compile Include="ResizeDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="ResizeDialog.Designer.cs"> <Compile Include="ResizeDialog.Designer.cs">
<DependentUpon>ResizeDialog.cs</DependentUpon> <DependentUpon>ResizeDialog.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="ResourceTool.cs" /> <Compile Include="ResourceTool.cs" />
<Compile Include="Surface.cs"> <Compile Include="Surface.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project> <Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
<Name>OpenRA.FileFormats</Name> <Name>OpenRA.FileFormats</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj"> <ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
<Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project> <Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project>
<Name>OpenRA.Game</Name> <Name>OpenRA.Game</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="OpenRA.Editor.Icon.ico" /> <Content Include="OpenRA.Editor.Icon.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
</Target> </Target>
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>

View File

@@ -6,13 +6,13 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using OpenRA.FileFormats; using OpenRA.FileFormats;
namespace OpenRA.Editor namespace OpenRA.Editor
@@ -46,10 +46,10 @@ namespace OpenRA.Editor
foreach (var path in ModData.FindMapsIn(MapFolderPath)) foreach (var path in ModData.FindMapsIn(MapFolderPath))
{ {
var map = new Map(path); var map = new Map(path);
// Touch the lazy bits to initialize them // Touch the lazy bits to initialize them
map.Actors.Force(); map.Actors.Force();
map.Smudges.Force(); map.Smudges.Force();
map.MapTiles.Force(); map.MapTiles.Force();
map.MapResources.Force(); map.MapResources.Force();
map.Save(path); map.Save(path);
} }

View File

@@ -1,36 +1,46 @@
using System.Reflection; #region Copyright & License Information
using System.Runtime.CompilerServices; /*
using System.Runtime.InteropServices; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
// General Information about an assembly is controlled through the following * available to you under the terms of the GNU General Public License
// set of attributes. Change these attribute values to modify the information * as published by the Free Software Foundation. For more information,
// associated with an assembly. * see COPYING.
[assembly: AssemblyTitle("OpenRA.Editor")] */
[assembly: AssemblyDescription("")] #endregion
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")] using System.Reflection;
[assembly: AssemblyProduct("OpenRA.Editor")] using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// Setting ComVisible to false makes the types in this assembly not visible // associated with an assembly.
// to COM components. If you need to access a type in this assembly from [assembly: AssemblyTitle("OpenRA.Editor")]
// COM, set the ComVisible attribute to true on that type. [assembly: AssemblyDescription("")]
[assembly: ComVisible(false)] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
// The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: AssemblyProduct("OpenRA.Editor")]
[assembly: Guid("e18ea68f-f344-46c9-b026-8bda76fa91f8")] [assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values: [assembly: AssemblyCulture("")]
//
// Major Version // Setting ComVisible to false makes the types in this assembly not visible
// Minor Version // to COM components. If you need to access a type in this assembly from
// Build Number // COM, set the ComVisible attribute to true on that type.
// Revision [assembly: ComVisible(false)]
//
// You can specify all the values or you can default the Build and Revision Numbers // The following GUID is for the ID of the typelib if this project is exposed to COM
// by using the '*' as shown below: [assembly: Guid("e18ea68f-f344-46c9-b026-8bda76fa91f8")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] // Version information for an assembly consists of the following four values:
[assembly: AssemblyFileVersion("1.0.0.0")] //
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,71 +1,71 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.4927 // Runtime Version:2.0.50727.4927
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OpenRA.Editor.Properties namespace OpenRA.Editor.Properties
{ {
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources
{ {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources()
{ {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager
{ {
get get
{ {
if ((resourceMan == null)) if ((resourceMan == null))
{ {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenRA.Editor.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenRA.Editor.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture
{ {
get get
{ {
return resourceCulture; return resourceCulture;
} }
set set
{ {
resourceCulture = value; resourceCulture = value;
} }
} }
} }
} }

View File

@@ -1,30 +1,30 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.4927 // Runtime Version:2.0.50727.4927
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OpenRA.Editor.Properties namespace OpenRA.Editor.Properties
{ {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{ {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default
{ {
get get
{ {
return defaultInstance; return defaultInstance;
} }
} }
} }
} }

View File

@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles> <Profiles>
<Profile Name="(Default)" /> <Profile Name="(Default)" />
</Profiles> </Profiles>
<Settings /> <Settings />
</SettingsFile> </SettingsFile>

View File

@@ -1,172 +1,182 @@
namespace OpenRA.Editor #region Copyright & License Information
{ /*
partial class PropertiesDialog * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
{ * This file is part of OpenRA, which is free software. It is made
/// <summary> * available to you under the terms of the GNU General Public License
/// Required designer variable. * as published by the Free Software Foundation. For more information,
/// </summary> * see COPYING.
private System.ComponentModel.IContainer components = null; */
#endregion
/// <summary>
/// Clean up any resources being used. namespace OpenRA.Editor
/// </summary> {
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> partial class PropertiesDialog
protected override void Dispose(bool disposing) {
{ /// <summary>
if (disposing && (components != null)) /// Required designer variable.
{ /// </summary>
components.Dispose(); private System.ComponentModel.IContainer components = null;
}
base.Dispose(disposing); /// <summary>
} /// Clean up any resources being used.
/// </summary>
#region Windows Form Designer generated code /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
/// <summary> {
/// Required method for Designer support - do not modify if (disposing && (components != null))
/// the contents of this method with the code editor. {
/// </summary> components.Dispose();
private void InitializeComponent() }
{ base.Dispose(disposing);
this.button2 = new System.Windows.Forms.Button(); }
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); #region Windows Form Designer generated code
this.title = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); /// <summary>
this.desc = new System.Windows.Forms.TextBox(); /// Required method for Designer support - do not modify
this.selectable = new System.Windows.Forms.CheckBox(); /// the contents of this method with the code editor.
this.label3 = new System.Windows.Forms.Label(); /// </summary>
this.author = new System.Windows.Forms.TextBox(); private void InitializeComponent()
this.useAsShellmap = new System.Windows.Forms.CheckBox(); {
this.SuspendLayout(); this.button2 = new System.Windows.Forms.Button();
// this.button1 = new System.Windows.Forms.Button();
// button2 this.label1 = new System.Windows.Forms.Label();
// this.title = new System.Windows.Forms.TextBox();
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.label2 = new System.Windows.Forms.Label();
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK; this.desc = new System.Windows.Forms.TextBox();
this.button2.Location = new System.Drawing.Point(196, 193); this.selectable = new System.Windows.Forms.CheckBox();
this.button2.Name = "button2"; this.label3 = new System.Windows.Forms.Label();
this.button2.Size = new System.Drawing.Size(75, 23); this.author = new System.Windows.Forms.TextBox();
this.button2.TabIndex = 14; this.useAsShellmap = new System.Windows.Forms.CheckBox();
this.button2.Text = "OK"; this.SuspendLayout();
this.button2.UseVisualStyleBackColor = true; //
// // button2
// button1 //
// this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button2.Location = new System.Drawing.Point(196, 193);
this.button1.Location = new System.Drawing.Point(277, 193); this.button2.Name = "button2";
this.button1.Name = "button1"; this.button2.Size = new System.Drawing.Size(75, 23);
this.button1.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 14;
this.button1.TabIndex = 15; this.button2.Text = "OK";
this.button1.Text = "Cancel"; this.button2.UseVisualStyleBackColor = true;
this.button1.UseVisualStyleBackColor = true; //
// // button1
// label1 //
// this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true; this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.label1.Location = new System.Drawing.Point(12, 50); this.button1.Location = new System.Drawing.Point(277, 193);
this.label1.Name = "label1"; this.button1.Name = "button1";
this.label1.Size = new System.Drawing.Size(27, 13); this.button1.Size = new System.Drawing.Size(75, 23);
this.label1.TabIndex = 16; this.button1.TabIndex = 15;
this.label1.Text = "Title"; this.button1.Text = "Cancel";
// this.button1.UseVisualStyleBackColor = true;
// title //
// // label1
this.title.Location = new System.Drawing.Point(66, 47); //
this.title.Name = "title"; this.label1.AutoSize = true;
this.title.Size = new System.Drawing.Size(286, 20); this.label1.Location = new System.Drawing.Point(12, 50);
this.title.TabIndex = 17; this.label1.Name = "label1";
// this.label1.Size = new System.Drawing.Size(27, 13);
// label2 this.label1.TabIndex = 16;
// this.label1.Text = "Title";
this.label2.AutoSize = true; //
this.label2.Location = new System.Drawing.Point(12, 76); // title
this.label2.Name = "label2"; //
this.label2.Size = new System.Drawing.Size(32, 13); this.title.Location = new System.Drawing.Point(66, 47);
this.label2.TabIndex = 16; this.title.Name = "title";
this.label2.Text = "Desc"; this.title.Size = new System.Drawing.Size(286, 20);
// this.title.TabIndex = 17;
// desc //
// // label2
this.desc.Location = new System.Drawing.Point(66, 73); //
this.desc.Name = "desc"; this.label2.AutoSize = true;
this.desc.Size = new System.Drawing.Size(286, 20); this.label2.Location = new System.Drawing.Point(12, 76);
this.desc.TabIndex = 17; this.label2.Name = "label2";
// this.label2.Size = new System.Drawing.Size(32, 13);
// selectable this.label2.TabIndex = 16;
// this.label2.Text = "Desc";
this.selectable.AutoSize = true; //
this.selectable.Location = new System.Drawing.Point(118, 138); // desc
this.selectable.Name = "selectable"; //
this.selectable.Size = new System.Drawing.Size(130, 17); this.desc.Location = new System.Drawing.Point(66, 73);
this.selectable.TabIndex = 18; this.desc.Name = "desc";
this.selectable.Text = "Show in Map Chooser"; this.desc.Size = new System.Drawing.Size(286, 20);
this.selectable.UseVisualStyleBackColor = true; this.desc.TabIndex = 17;
// //
// label3 // selectable
// //
this.label3.AutoSize = true; this.selectable.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 102); this.selectable.Location = new System.Drawing.Point(118, 138);
this.label3.Name = "label3"; this.selectable.Name = "selectable";
this.label3.Size = new System.Drawing.Size(38, 13); this.selectable.Size = new System.Drawing.Size(130, 17);
this.label3.TabIndex = 16; this.selectable.TabIndex = 18;
this.label3.Text = "Author"; this.selectable.Text = "Show in Map Chooser";
// this.selectable.UseVisualStyleBackColor = true;
// author //
// // label3
this.author.Location = new System.Drawing.Point(66, 99); //
this.author.Name = "author"; this.label3.AutoSize = true;
this.author.Size = new System.Drawing.Size(286, 20); this.label3.Location = new System.Drawing.Point(12, 102);
this.author.TabIndex = 17; this.label3.Name = "label3";
// this.label3.Size = new System.Drawing.Size(38, 13);
// checkBox1 this.label3.TabIndex = 16;
// this.label3.Text = "Author";
this.useAsShellmap.AutoSize = true; //
this.useAsShellmap.Location = new System.Drawing.Point(118, 161); // author
this.useAsShellmap.Name = "checkBox1"; //
this.useAsShellmap.Size = new System.Drawing.Size(105, 17); this.author.Location = new System.Drawing.Point(66, 99);
this.useAsShellmap.TabIndex = 18; this.author.Name = "author";
this.useAsShellmap.Text = "Use as Shellmap"; this.author.Size = new System.Drawing.Size(286, 20);
this.useAsShellmap.UseVisualStyleBackColor = true; this.author.TabIndex = 17;
// //
// PropertiesDialog // checkBox1
// //
this.AcceptButton = this.button2; this.useAsShellmap.AutoSize = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.useAsShellmap.Location = new System.Drawing.Point(118, 161);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.useAsShellmap.Name = "checkBox1";
this.CancelButton = this.button1; this.useAsShellmap.Size = new System.Drawing.Size(105, 17);
this.ClientSize = new System.Drawing.Size(370, 228); this.useAsShellmap.TabIndex = 18;
this.Controls.Add(this.useAsShellmap); this.useAsShellmap.Text = "Use as Shellmap";
this.Controls.Add(this.selectable); this.useAsShellmap.UseVisualStyleBackColor = true;
this.Controls.Add(this.author); //
this.Controls.Add(this.label3); // PropertiesDialog
this.Controls.Add(this.desc); //
this.Controls.Add(this.label2); this.AcceptButton = this.button2;
this.Controls.Add(this.title); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Controls.Add(this.label1); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.button2); this.CancelButton = this.button1;
this.Controls.Add(this.button1); this.ClientSize = new System.Drawing.Size(370, 228);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Controls.Add(this.useAsShellmap);
this.Name = "PropertiesDialog"; this.Controls.Add(this.selectable);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Controls.Add(this.author);
this.Text = "PropertiesDialog"; this.Controls.Add(this.label3);
this.ResumeLayout(false); this.Controls.Add(this.desc);
this.PerformLayout(); this.Controls.Add(this.label2);
this.Controls.Add(this.title);
} this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
#endregion this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
private System.Windows.Forms.Button button2; this.Name = "PropertiesDialog";
private System.Windows.Forms.Button button1; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
private System.Windows.Forms.Label label1; this.Text = "PropertiesDialog";
public System.Windows.Forms.TextBox title; this.ResumeLayout(false);
private System.Windows.Forms.Label label2; this.PerformLayout();
public System.Windows.Forms.TextBox desc;
public System.Windows.Forms.CheckBox selectable; }
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox author; #endregion
public System.Windows.Forms.CheckBox useAsShellmap;
} private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
public System.Windows.Forms.TextBox title;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.TextBox desc;
public System.Windows.Forms.CheckBox selectable;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox author;
public System.Windows.Forms.CheckBox useAsShellmap;
}
} }

View File

@@ -1,120 +1,120 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
</root> </root>

View File

@@ -1,226 +1,236 @@
namespace OpenRA.Editor #region Copyright & License Information
{ /*
partial class ResizeDialog * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
{ * This file is part of OpenRA, which is free software. It is made
/// <summary> * available to you under the terms of the GNU General Public License
/// Required designer variable. * as published by the Free Software Foundation. For more information,
/// </summary> * see COPYING.
private System.ComponentModel.IContainer components = null; */
#endregion
/// <summary>
/// Clean up any resources being used. namespace OpenRA.Editor
/// </summary> {
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> partial class ResizeDialog
protected override void Dispose(bool disposing) {
{ /// <summary>
if (disposing && (components != null)) /// Required designer variable.
{ /// </summary>
components.Dispose(); private System.ComponentModel.IContainer components = null;
}
base.Dispose(disposing); /// <summary>
} /// Clean up any resources being used.
/// </summary>
#region Windows Form Designer generated code /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
/// <summary> {
/// Required method for Designer support - do not modify if (disposing && (components != null))
/// the contents of this method with the code editor. {
/// </summary> components.Dispose();
private void InitializeComponent() }
{ base.Dispose(disposing);
this.width = new System.Windows.Forms.NumericUpDown(); }
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); #region Windows Form Designer generated code
this.cordonLeft = new System.Windows.Forms.NumericUpDown();
this.cordonTop = new System.Windows.Forms.NumericUpDown(); /// <summary>
this.cordonRight = new System.Windows.Forms.NumericUpDown(); /// Required method for Designer support - do not modify
this.cordonBottom = new System.Windows.Forms.NumericUpDown(); /// the contents of this method with the code editor.
this.label3 = new System.Windows.Forms.Label(); /// </summary>
this.button1 = new System.Windows.Forms.Button(); private void InitializeComponent()
this.button2 = new System.Windows.Forms.Button(); {
this.height = new System.Windows.Forms.NumericUpDown(); this.width = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit(); this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).BeginInit(); this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.cordonTop)).BeginInit(); this.cordonLeft = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.cordonRight)).BeginInit(); this.cordonTop = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit(); this.cordonRight = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit(); this.cordonBottom = new System.Windows.Forms.NumericUpDown();
this.SuspendLayout(); this.label3 = new System.Windows.Forms.Label();
// this.button1 = new System.Windows.Forms.Button();
// width this.button2 = new System.Windows.Forms.Button();
// this.height = new System.Windows.Forms.NumericUpDown();
this.width.Increment = new decimal(new int[] { ((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit();
8, ((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).BeginInit();
0, ((System.ComponentModel.ISupportInitialize)(this.cordonTop)).BeginInit();
0, ((System.ComponentModel.ISupportInitialize)(this.cordonRight)).BeginInit();
0}); ((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit();
this.width.Location = new System.Drawing.Point(161, 18); ((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit();
this.width.Maximum = new decimal(new int[] { this.SuspendLayout();
2048, //
0, // width
0, //
0}); this.width.Increment = new decimal(new int[] {
this.width.Name = "width"; 8,
this.width.Size = new System.Drawing.Size(105, 20); 0,
this.width.TabIndex = 0; 0,
// 0});
// label1 this.width.Location = new System.Drawing.Point(161, 18);
// this.width.Maximum = new decimal(new int[] {
this.label1.AutoSize = true; 2048,
this.label1.Location = new System.Drawing.Point(23, 20); 0,
this.label1.Name = "label1"; 0,
this.label1.Size = new System.Drawing.Size(27, 13); 0});
this.label1.TabIndex = 1; this.width.Name = "width";
this.label1.Text = "Size"; this.width.Size = new System.Drawing.Size(105, 20);
// this.width.TabIndex = 0;
// label2 //
// // label1
this.label2.AutoSize = true; //
this.label2.Location = new System.Drawing.Point(23, 46); this.label1.AutoSize = true;
this.label2.Name = "label2"; this.label1.Location = new System.Drawing.Point(23, 20);
this.label2.Size = new System.Drawing.Size(86, 13); this.label1.Name = "label1";
this.label2.TabIndex = 1; this.label1.Size = new System.Drawing.Size(27, 13);
this.label2.Text = "Cordon Left/Top"; this.label1.TabIndex = 1;
// this.label1.Text = "Size";
// cordonLeft //
// // label2
this.cordonLeft.Location = new System.Drawing.Point(161, 44); //
this.cordonLeft.Maximum = new decimal(new int[] { this.label2.AutoSize = true;
2048, this.label2.Location = new System.Drawing.Point(23, 46);
0, this.label2.Name = "label2";
0, this.label2.Size = new System.Drawing.Size(86, 13);
0}); this.label2.TabIndex = 1;
this.cordonLeft.Name = "cordonLeft"; this.label2.Text = "Cordon Left/Top";
this.cordonLeft.Size = new System.Drawing.Size(105, 20); //
this.cordonLeft.TabIndex = 0; // cordonLeft
// //
// cordonTop this.cordonLeft.Location = new System.Drawing.Point(161, 44);
// this.cordonLeft.Maximum = new decimal(new int[] {
this.cordonTop.Location = new System.Drawing.Point(272, 44); 2048,
this.cordonTop.Maximum = new decimal(new int[] { 0,
2048, 0,
0, 0});
0, this.cordonLeft.Name = "cordonLeft";
0}); this.cordonLeft.Size = new System.Drawing.Size(105, 20);
this.cordonTop.Name = "cordonTop"; this.cordonLeft.TabIndex = 0;
this.cordonTop.Size = new System.Drawing.Size(105, 20); //
this.cordonTop.TabIndex = 0; // cordonTop
// //
// cordonRight this.cordonTop.Location = new System.Drawing.Point(272, 44);
// this.cordonTop.Maximum = new decimal(new int[] {
this.cordonRight.Location = new System.Drawing.Point(161, 70); 2048,
this.cordonRight.Maximum = new decimal(new int[] { 0,
2048, 0,
0, 0});
0, this.cordonTop.Name = "cordonTop";
0}); this.cordonTop.Size = new System.Drawing.Size(105, 20);
this.cordonRight.Name = "cordonRight"; this.cordonTop.TabIndex = 0;
this.cordonRight.Size = new System.Drawing.Size(105, 20); //
this.cordonRight.TabIndex = 0; // cordonRight
// //
// cordonBottom this.cordonRight.Location = new System.Drawing.Point(161, 70);
// this.cordonRight.Maximum = new decimal(new int[] {
this.cordonBottom.Location = new System.Drawing.Point(272, 70); 2048,
this.cordonBottom.Maximum = new decimal(new int[] { 0,
2048, 0,
0, 0});
0, this.cordonRight.Name = "cordonRight";
0}); this.cordonRight.Size = new System.Drawing.Size(105, 20);
this.cordonBottom.Name = "cordonBottom"; this.cordonRight.TabIndex = 0;
this.cordonBottom.Size = new System.Drawing.Size(105, 20); //
this.cordonBottom.TabIndex = 0; // cordonBottom
// //
// label3 this.cordonBottom.Location = new System.Drawing.Point(272, 70);
// this.cordonBottom.Maximum = new decimal(new int[] {
this.label3.AutoSize = true; 2048,
this.label3.Location = new System.Drawing.Point(23, 72); 0,
this.label3.Name = "label3"; 0,
this.label3.Size = new System.Drawing.Size(107, 13); 0});
this.label3.TabIndex = 1; this.cordonBottom.Name = "cordonBottom";
this.label3.Text = "Cordon Right/Bottom"; this.cordonBottom.Size = new System.Drawing.Size(105, 20);
// this.cordonBottom.TabIndex = 0;
// button1 //
// // label3
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; //
this.button1.Location = new System.Drawing.Point(302, 111); this.label3.AutoSize = true;
this.button1.Name = "button1"; this.label3.Location = new System.Drawing.Point(23, 72);
this.button1.Size = new System.Drawing.Size(75, 23); this.label3.Name = "label3";
this.button1.TabIndex = 2; this.label3.Size = new System.Drawing.Size(107, 13);
this.button1.Text = "Cancel"; this.label3.TabIndex = 1;
this.button1.UseVisualStyleBackColor = true; this.label3.Text = "Cordon Right/Bottom";
// //
// button2 // button1
// //
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK; this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(221, 111); this.button1.Location = new System.Drawing.Point(302, 111);
this.button2.Name = "button2"; this.button1.Name = "button1";
this.button2.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2; this.button1.TabIndex = 2;
this.button2.Text = "OK"; this.button1.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
// //
// height // button2
// //
this.height.Increment = new decimal(new int[] { this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
8, this.button2.Location = new System.Drawing.Point(221, 111);
0, this.button2.Name = "button2";
0, this.button2.Size = new System.Drawing.Size(75, 23);
0}); this.button2.TabIndex = 2;
this.height.Location = new System.Drawing.Point(272, 18); this.button2.Text = "OK";
this.height.Maximum = new decimal(new int[] { this.button2.UseVisualStyleBackColor = true;
2048, //
0, // height
0, //
0}); this.height.Increment = new decimal(new int[] {
this.height.Name = "height"; 8,
this.height.Size = new System.Drawing.Size(105, 20); 0,
this.height.TabIndex = 0; 0,
// 0});
// ResizeDialog this.height.Location = new System.Drawing.Point(272, 18);
// this.height.Maximum = new decimal(new int[] {
this.AcceptButton = this.button2; 2048,
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 0,
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 0,
this.CancelButton = this.button1; 0});
this.ClientSize = new System.Drawing.Size(409, 146); this.height.Name = "height";
this.Controls.Add(this.button2); this.height.Size = new System.Drawing.Size(105, 20);
this.Controls.Add(this.button1); this.height.TabIndex = 0;
this.Controls.Add(this.label3); //
this.Controls.Add(this.label2); // ResizeDialog
this.Controls.Add(this.label1); //
this.Controls.Add(this.cordonBottom); this.AcceptButton = this.button2;
this.Controls.Add(this.cordonTop); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Controls.Add(this.cordonRight); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cordonLeft); this.CancelButton = this.button1;
this.Controls.Add(this.height); this.ClientSize = new System.Drawing.Size(409, 146);
this.Controls.Add(this.width); this.Controls.Add(this.button2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Controls.Add(this.button1);
this.Name = "ResizeDialog"; this.Controls.Add(this.label3);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Controls.Add(this.label2);
this.Text = "Resize Map"; this.Controls.Add(this.label1);
((System.ComponentModel.ISupportInitialize)(this.width)).EndInit(); this.Controls.Add(this.cordonBottom);
((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).EndInit(); this.Controls.Add(this.cordonTop);
((System.ComponentModel.ISupportInitialize)(this.cordonTop)).EndInit(); this.Controls.Add(this.cordonRight);
((System.ComponentModel.ISupportInitialize)(this.cordonRight)).EndInit(); this.Controls.Add(this.cordonLeft);
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).EndInit(); this.Controls.Add(this.height);
((System.ComponentModel.ISupportInitialize)(this.height)).EndInit(); this.Controls.Add(this.width);
this.ResumeLayout(false); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.PerformLayout(); this.Name = "ResizeDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
} this.Text = "Resize Map";
((System.ComponentModel.ISupportInitialize)(this.width)).EndInit();
#endregion ((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cordonTop)).EndInit();
private System.Windows.Forms.Label label1; ((System.ComponentModel.ISupportInitialize)(this.cordonRight)).EndInit();
private System.Windows.Forms.Label label2; ((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).EndInit();
private System.Windows.Forms.Label label3; ((System.ComponentModel.ISupportInitialize)(this.height)).EndInit();
private System.Windows.Forms.Button button1; this.ResumeLayout(false);
private System.Windows.Forms.Button button2; this.PerformLayout();
public System.Windows.Forms.NumericUpDown width;
public System.Windows.Forms.NumericUpDown cordonLeft; }
public System.Windows.Forms.NumericUpDown cordonTop;
public System.Windows.Forms.NumericUpDown cordonRight; #endregion
public System.Windows.Forms.NumericUpDown cordonBottom;
public System.Windows.Forms.NumericUpDown height; private System.Windows.Forms.Label label1;
} private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
public System.Windows.Forms.NumericUpDown width;
public System.Windows.Forms.NumericUpDown cordonLeft;
public System.Windows.Forms.NumericUpDown cordonTop;
public System.Windows.Forms.NumericUpDown cordonRight;
public System.Windows.Forms.NumericUpDown cordonBottom;
public System.Windows.Forms.NumericUpDown height;
}
} }

View File

@@ -1,120 +1,120 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
</root> </root>

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Editor
ITool Tool; ITool Tool;
public bool IsPanning; public bool IsPanning;
public bool ShowActorNames; public bool ShowActorNames;
public event Action AfterChange = () => { }; public event Action AfterChange = () => { };
@@ -338,22 +338,22 @@ namespace OpenRA.Editor
Map.Bounds.Left * TileSet.TileSize * Zoom + Offset.X, Map.Bounds.Left * TileSet.TileSize * Zoom + Offset.X,
Map.Bounds.Top * TileSet.TileSize * Zoom + Offset.Y, Map.Bounds.Top * TileSet.TileSize * Zoom + Offset.Y,
Map.Bounds.Width * TileSet.TileSize * Zoom, Map.Bounds.Width * TileSet.TileSize * Zoom,
Map.Bounds.Height * TileSet.TileSize * Zoom); Map.Bounds.Height * TileSet.TileSize * Zoom);
foreach (var ar in Map.Actors.Value) foreach (var ar in Map.Actors.Value)
{ {
if (ActorTemplates.ContainsKey(ar.Value.Type)) if (ActorTemplates.ContainsKey(ar.Value.Type))
DrawActor(e.Graphics, ar.Value.Location(), ActorTemplates[ar.Value.Type], DrawActor(e.Graphics, ar.Value.Location(), ActorTemplates[ar.Value.Type],
GetPaletteForActor(ar.Value)); GetPaletteForActor(ar.Value));
} }
if (ShowActorNames) if (ShowActorNames)
foreach (var ar in Map.Actors.Value) foreach (var ar in Map.Actors.Value)
if (!ar.Key.StartsWith("Actor")) // if it has a custom name if (!ar.Key.StartsWith("Actor")) // if it has a custom name
e.Graphics.DrawStringContrast(Font, ar.Key, e.Graphics.DrawStringContrast(Font, ar.Key,
(int)(ar.Value.Location().X * TileSet.TileSize * Zoom + Offset.X), (int)(ar.Value.Location().X * TileSet.TileSize * Zoom + Offset.X),
(int)(ar.Value.Location().Y * TileSet.TileSize * Zoom + Offset.Y), (int)(ar.Value.Location().Y * TileSet.TileSize * Zoom + Offset.Y),
Brushes.White, Brushes.White,
Brushes.Black); Brushes.Black);
if (Tool != null) if (Tool != null)
@@ -373,16 +373,16 @@ namespace OpenRA.Editor
public static int2 Location(this ActorReference ar) public static int2 Location(this ActorReference ar)
{ {
return ar.InitDict.Get<LocationInit>().value; return ar.InitDict.Get<LocationInit>().value;
} }
public static void DrawStringContrast(this SGraphics g, Font f, string s, int x, int y, Brush fg, Brush bg) public static void DrawStringContrast(this SGraphics g, Font f, string s, int x, int y, Brush fg, Brush bg)
{ {
g.DrawString(s, f, bg, x - 1, y - 1); g.DrawString(s, f, bg, x - 1, y - 1);
g.DrawString(s, f, bg, x + 1, y - 1); g.DrawString(s, f, bg, x + 1, y - 1);
g.DrawString(s, f, bg, x - 1, y + 1); g.DrawString(s, f, bg, x - 1, y + 1);
g.DrawString(s, f, bg, x + 1, y + 1); g.DrawString(s, f, bg, x + 1, y + 1);
g.DrawString(s, f, fg, x, y); g.DrawString(s, f, fg, x, y);
} }
} }
} }

View File

@@ -105,11 +105,11 @@ namespace OpenRA
public static bool Contains(this RectangleF r, int2 p) public static bool Contains(this RectangleF r, int2 p)
{ {
return r.Contains(p.ToPointF()); return r.Contains(p.ToPointF());
} }
public static bool HasModifier(this Modifiers k, Modifiers mod) public static bool HasModifier(this Modifiers k, Modifiers mod)
{ {
return (k & mod) == mod; return (k & mod) == mod;
} }
public static bool IsValidInput(this KeyInput key) public static bool IsValidInput(this KeyInput key)
@@ -117,37 +117,37 @@ namespace OpenRA
return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) || return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) ||
char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) || char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) ||
char.IsPunctuation(key.UnicodeChar); char.IsPunctuation(key.UnicodeChar);
} }
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k) public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k)
where V : new() where V : new()
{ {
return d.GetOrAdd(k, _ => new V()); return d.GetOrAdd(k, _ => new V());
} }
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k, Func<K, V> createFn) public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k, Func<K, V> createFn)
{ {
V ret; V ret;
if (!d.TryGetValue(k, out ret)) if (!d.TryGetValue(k, out ret))
d.Add(k, ret = createFn(k)); d.Add(k, ret = createFn(k));
return ret; return ret;
} }
public static T Random<T>(this IEnumerable<T> ts, Thirdparty.Random r) public static T Random<T>(this IEnumerable<T> ts, Thirdparty.Random r)
{ {
var xs = ts.ToArray(); var xs = ts.ToArray();
return xs[r.Next(xs.Length)]; return xs[r.Next(xs.Length)];
} }
public static float Product(this IEnumerable<float> xs) public static float Product(this IEnumerable<float> xs)
{ {
return xs.Aggregate(1f, (a, x) => a * x); return xs.Aggregate(1f, (a, x) => a * x);
} }
public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> xs, IEnumerable<T> ys) public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> xs, IEnumerable<T> ys)
{ {
// this is probably a shockingly-slow way to do this, but it's concise. // this is probably a shockingly-slow way to do this, but it's concise.
return xs.Except(ys).Concat(ys.Except(xs)); return xs.Except(ys).Concat(ys.Except(xs));
} }
} }
} }

View File

@@ -63,8 +63,8 @@ namespace OpenRA.FileFormats
} }
public void Write(Dictionary<string, byte[]> contents) public void Write(Dictionary<string, byte[]> contents)
{ {
if (!Directory.Exists(path)) if (!Directory.Exists(path))
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
foreach (var file in contents) foreach (var file in contents)

View File

@@ -35,7 +35,7 @@ namespace OpenRA.FileFormats.Graphics
ITexture CreateTexture(); ITexture CreateTexture();
IShader CreateShader( string name ); IShader CreateShader( string name );
Size WindowSize { get; } Size WindowSize { get; }
int GpuMemoryUsed { get; } int GpuMemoryUsed { get; }
void Clear( Color color ); void Clear( Color color );

View File

@@ -1,181 +1,181 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS) * Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Net; using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
namespace OpenRA.FileFormats.Graphics namespace OpenRA.FileFormats.Graphics
{ {
public static class PngLoader public static class PngLoader
{ {
public static Bitmap Load(string filename) public static Bitmap Load(string filename)
{ {
return Load(File.OpenRead(filename)); return Load(File.OpenRead(filename));
} }
public static Bitmap Load(Stream s) public static Bitmap Load(Stream s)
{ {
using (var br = new BinaryReader(s)) using (var br = new BinaryReader(s))
{ {
var signature = new byte[] { 137, 80, 78, 71, 13, 10, 26, 10 }; var signature = new byte[] { 137, 80, 78, 71, 13, 10, 26, 10 };
foreach (var b in signature) foreach (var b in signature)
if (br.ReadByte() != b) if (br.ReadByte() != b)
throw new InvalidDataException("PNG Signature is bogus"); throw new InvalidDataException("PNG Signature is bogus");
Bitmap bitmap = null; Bitmap bitmap = null;
Color[] palette = null; Color[] palette = null;
List<byte> data = new List<byte>(); List<byte> data = new List<byte>();
for (; ; ) for (; ; )
{ {
var length = IPAddress.NetworkToHostOrder(br.ReadInt32()); var length = IPAddress.NetworkToHostOrder(br.ReadInt32());
var type = Encoding.UTF8.GetString(br.ReadBytes(4)); var type = Encoding.UTF8.GetString(br.ReadBytes(4));
var content = br.ReadBytes(length); var content = br.ReadBytes(length);
var crc = br.ReadInt32(); var crc = br.ReadInt32();
using (var ms = new MemoryStream(content)) using (var ms = new MemoryStream(content))
using (var cr = new BinaryReader(ms)) using (var cr = new BinaryReader(ms))
switch (type) switch (type)
{ {
case "IHDR": case "IHDR":
{ {
var width = IPAddress.NetworkToHostOrder(cr.ReadInt32()); var width = IPAddress.NetworkToHostOrder(cr.ReadInt32());
var height = IPAddress.NetworkToHostOrder(cr.ReadInt32()); var height = IPAddress.NetworkToHostOrder(cr.ReadInt32());
var bitDepth = cr.ReadByte(); var bitDepth = cr.ReadByte();
var colorType = (PngColorType)cr.ReadByte(); var colorType = (PngColorType)cr.ReadByte();
var compression = cr.ReadByte(); var compression = cr.ReadByte();
var filter = cr.ReadByte(); var filter = cr.ReadByte();
var interlace = cr.ReadByte(); var interlace = cr.ReadByte();
if (compression != 0) throw new InvalidDataException("Compression method not supported"); if (compression != 0) throw new InvalidDataException("Compression method not supported");
if (interlace != 0) throw new InvalidDataException("Interlacing not supported"); if (interlace != 0) throw new InvalidDataException("Interlacing not supported");
bitmap = new Bitmap(width, height, MakePixelFormat(bitDepth, colorType)); bitmap = new Bitmap(width, height, MakePixelFormat(bitDepth, colorType));
} }
break; break;
case "PLTE": case "PLTE":
{ {
palette = new Color[256]; palette = new Color[256];
for (var i = 0; i < 256; i++) for (var i = 0; i < 256; i++)
{ {
var r = cr.ReadByte(); var g = cr.ReadByte(); var b = cr.ReadByte(); var r = cr.ReadByte(); var g = cr.ReadByte(); var b = cr.ReadByte();
palette[i] = Color.FromArgb(r, g, b); palette[i] = Color.FromArgb(r, g, b);
} }
} }
break; break;
case "tRNS": case "tRNS":
{ {
for (var i = 0; i < length; i++) for (var i = 0; i < length; i++)
palette[i] = Color.FromArgb(cr.ReadByte(), palette[i]); palette[i] = Color.FromArgb(cr.ReadByte(), palette[i]);
} }
break; break;
case "IDAT": case "IDAT":
{ {
data.AddRange(content); data.AddRange(content);
} }
break; break;
case "IEND": case "IEND":
{ {
var bits = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), var bits = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed); ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
using (var ns = new MemoryStream(data.ToArray())) using (var ns = new MemoryStream(data.ToArray()))
{ {
// 'zlib' flags bytes; confuses the DeflateStream. // 'zlib' flags bytes; confuses the DeflateStream.
var flags = (byte)ns.ReadByte(); var flags = (byte)ns.ReadByte();
var moreFlags = (byte)ns.ReadByte(); var moreFlags = (byte)ns.ReadByte();
using (var ds = new DeflateStream(ns, CompressionMode.Decompress)) using (var ds = new DeflateStream(ns, CompressionMode.Decompress))
using (var dr = new BinaryReader(ds)) using (var dr = new BinaryReader(ds))
{ {
var prevLine = new byte[bitmap.Width]; // all zero var prevLine = new byte[bitmap.Width]; // all zero
for (var y = 0; y < bitmap.Height; y++) for (var y = 0; y < bitmap.Height; y++)
{ {
var filter = (PngFilter)dr.ReadByte(); var filter = (PngFilter)dr.ReadByte();
var line = dr.ReadBytes(bitmap.Width); var line = dr.ReadBytes(bitmap.Width);
for (var i = 0; i < bitmap.Width; i++) for (var i = 0; i < bitmap.Width; i++)
line[i] = i > 0 line[i] = i > 0
? UnapplyFilter(filter, line[i], line[i - 1], prevLine[i], prevLine[i - 1]) ? UnapplyFilter(filter, line[i], line[i - 1], prevLine[i], prevLine[i - 1])
: UnapplyFilter(filter, line[i], 0, prevLine[i], 0); : UnapplyFilter(filter, line[i], 0, prevLine[i], 0);
Marshal.Copy(line, 0, new IntPtr(bits.Scan0.ToInt64() + y * bits.Stride), line.Length); Marshal.Copy(line, 0, new IntPtr(bits.Scan0.ToInt64() + y * bits.Stride), line.Length);
prevLine = line; prevLine = line;
} }
} }
} }
bitmap.UnlockBits(bits); bitmap.UnlockBits(bits);
using (var temp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed)) using (var temp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
{ {
var cp = temp.Palette; var cp = temp.Palette;
for (var i = 0; i < 256; i++) for (var i = 0; i < 256; i++)
cp.Entries[i] = palette[i]; // finalize the palette. cp.Entries[i] = palette[i]; // finalize the palette.
bitmap.Palette = cp; bitmap.Palette = cp;
return bitmap; return bitmap;
} }
} }
} }
} }
} }
} }
static byte UnapplyFilter(PngFilter f, byte x, byte a, byte b, byte c) static byte UnapplyFilter(PngFilter f, byte x, byte a, byte b, byte c)
{ {
switch (f) switch (f)
{ {
case PngFilter.None: return x; case PngFilter.None: return x;
case PngFilter.Sub: return (byte)(x + a); case PngFilter.Sub: return (byte)(x + a);
case PngFilter.Up: return (byte)(x + b); case PngFilter.Up: return (byte)(x + b);
case PngFilter.Average: return (byte)(x + (a + b) / 2); case PngFilter.Average: return (byte)(x + (a + b) / 2);
case PngFilter.Paeth: return (byte)(x + Paeth(a, b, c)); case PngFilter.Paeth: return (byte)(x + Paeth(a, b, c));
default: default:
throw new InvalidOperationException("Unsupported Filter"); throw new InvalidOperationException("Unsupported Filter");
} }
} }
static byte Paeth(byte a, byte b, byte c) static byte Paeth(byte a, byte b, byte c)
{ {
var p = a + b - c; var p = a + b - c;
var pa = Math.Abs(p - a); var pa = Math.Abs(p - a);
var pb = Math.Abs(p - b); var pb = Math.Abs(p - b);
var pc = Math.Abs(p - c); var pc = Math.Abs(p - c);
return (pa <= pb && pa <= pc) ? a : return (pa <= pb && pa <= pc) ? a :
(pb <= pc) ? b : c; (pb <= pc) ? b : c;
} }
[Flags] [Flags]
enum PngColorType { Indexed = 1, Color = 2, Alpha = 4 }; enum PngColorType { Indexed = 1, Color = 2, Alpha = 4 };
enum PngFilter { None, Sub, Up, Average, Paeth }; enum PngFilter { None, Sub, Up, Average, Paeth };
static PixelFormat MakePixelFormat(byte bitDepth, PngColorType colorType) static PixelFormat MakePixelFormat(byte bitDepth, PngColorType colorType)
{ {
if (bitDepth == 8 && colorType == (PngColorType.Indexed | PngColorType.Color)) if (bitDepth == 8 && colorType == (PngColorType.Indexed | PngColorType.Color))
return PixelFormat.Format8bppIndexed; return PixelFormat.Format8bppIndexed;
throw new InvalidDataException("Unknown pixelformat"); throw new InvalidDataException("Unknown pixelformat");
} }
} }
} }

View File

@@ -1,46 +1,56 @@
using System.Collections.Generic; #region Copyright & License Information
using System.IO; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
namespace OpenRA.FileFormats.Graphics * available to you under the terms of the GNU General Public License
{ * as published by the Free Software Foundation. For more information,
// format80-only SHP writer * see COPYING.
*/
public static class ShpWriter #endregion
{
public static void Write(Stream s, int width, int height, IEnumerable<byte[]> frames) using System.Collections.Generic;
{ using System.IO;
var compressedFrames = frames.Select(f => Format80.Encode(f)).ToArray(); using System.Linq;
// note: end-of-file and all-zeroes headers namespace OpenRA.FileFormats.Graphics
var dataOffset = 14 + (compressedFrames.Length + 2) * ImageHeader.SizeOnDisk; {
// format80-only SHP writer
using (var bw = new BinaryWriter(s))
{ public static class ShpWriter
bw.Write((ushort)compressedFrames.Length); {
bw.Write((ushort)0); // unused public static void Write(Stream s, int width, int height, IEnumerable<byte[]> frames)
bw.Write((ushort)0); // unused {
bw.Write((ushort)width); var compressedFrames = frames.Select(f => Format80.Encode(f)).ToArray();
bw.Write((ushort)height);
bw.Write((uint)0); // unused // note: end-of-file and all-zeroes headers
var dataOffset = 14 + (compressedFrames.Length + 2) * ImageHeader.SizeOnDisk;
foreach (var f in compressedFrames)
{ using (var bw = new BinaryWriter(s))
var ih = new ImageHeader { Format = Format.Format80, Offset = (uint)dataOffset }; {
dataOffset += f.Length; bw.Write((ushort)compressedFrames.Length);
bw.Write((ushort)0); // unused
ih.WriteTo(bw); bw.Write((ushort)0); // unused
} bw.Write((ushort)width);
bw.Write((ushort)height);
var eof = new ImageHeader { Offset = (uint)dataOffset }; bw.Write((uint)0); // unused
eof.WriteTo(bw);
foreach (var f in compressedFrames)
var allZeroes = new ImageHeader { }; {
allZeroes.WriteTo(bw); var ih = new ImageHeader { Format = Format.Format80, Offset = (uint)dataOffset };
dataOffset += f.Length;
foreach (var f in compressedFrames)
bw.Write(f); ih.WriteTo(bw);
} }
}
} var eof = new ImageHeader { Offset = (uint)dataOffset };
} eof.WriteTo(bw);
var allZeroes = new ImageHeader { };
allZeroes.WriteTo(bw);
foreach (var f in compressedFrames)
bw.Write(f);
}
}
}
}

View File

@@ -21,8 +21,8 @@ namespace OpenRA.FileFormats
{ {
public struct SourceLocation public struct SourceLocation
{ {
public string Filename; public int Line; public string Filename; public int Line;
public override string ToString() { return "{0}:{1}".F(Filename, Line); } public override string ToString() { return "{0}:{1}".F(Filename, Line); }
} }
public SourceLocation Location; public SourceLocation Location;
@@ -53,11 +53,11 @@ namespace OpenRA.FileFormats
public MiniYamlNode( string k, string v, List<MiniYamlNode> n, SourceLocation loc ) public MiniYamlNode( string k, string v, List<MiniYamlNode> n, SourceLocation loc )
: this( k, new MiniYaml( v, n ), loc ) : this( k, new MiniYaml( v, n ), loc )
{ {
} }
public override string ToString() public override string ToString()
{ {
return "{{YamlNode: {0} @ {1}}}".F(Key, Location); return "{{YamlNode: {0} @ {1}}}".F(Key, Location);
} }
} }
@@ -175,8 +175,8 @@ namespace OpenRA.FileFormats
var aDict = a.ToDictionary( x => x.Key ); var aDict = a.ToDictionary( x => x.Key );
var bDict = b.ToDictionary( x => x.Key ); var bDict = b.ToDictionary( x => x.Key );
var keys = aDict.Keys.Union( bDict.Keys ).ToList(); var keys = aDict.Keys.Union( bDict.Keys ).ToList();
var noInherit = keys.Where(x => x.Length > 0 && x[0] == '-') var noInherit = keys.Where(x => x.Length > 0 && x[0] == '-')
.ToDictionary(x => x.Substring(1), x => false); .ToDictionary(x => x.Substring(1), x => false);
@@ -189,7 +189,7 @@ namespace OpenRA.FileFormats
if( noInherit.ContainsKey( key ) ) if( noInherit.ContainsKey( key ) )
{ {
// if( aa != null ) // if( aa != null )
// ret.Add( aa ); // ret.Add( aa );
noInherit[key] = true; noInherit[key] = true;
} }
else else
@@ -198,10 +198,10 @@ namespace OpenRA.FileFormats
var merged = ( aa == null || bb == null ) ? aa ?? bb : new MiniYamlNode( key, Merge( aa.Value, bb.Value ), loc ); var merged = ( aa == null || bb == null ) ? aa ?? bb : new MiniYamlNode( key, Merge( aa.Value, bb.Value ), loc );
ret.Add( merged ); ret.Add( merged );
} }
} }
if (noInherit.ContainsValue(false)) if (noInherit.ContainsValue(false))
throw new YamlException("Bogus yaml removals: {0}".F( throw new YamlException("Bogus yaml removals: {0}".F(
string.Join(", ", noInherit.Where(x => !x.Value).Select(x => x.Key).ToArray()))); string.Join(", ", noInherit.Where(x => !x.Value).Select(x => x.Key).ToArray())));
return ret; return ret;
@@ -248,10 +248,10 @@ namespace OpenRA.FileFormats
yield return ""; yield return "";
} }
} }
} }
public class YamlException : Exception public class YamlException : Exception
{ {
public YamlException(string s) : base(s) { } public YamlException(string s) : base(s) { }
} }
} }

View File

@@ -1,47 +1,47 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
namespace OpenRA.FileFormats namespace OpenRA.FileFormats
{ {
public class Mod public class Mod
{ {
public string Title; public string Title;
public string Description; public string Description;
public string Version; public string Version;
public string Author; public string Author;
public string Requires; public string Requires;
public bool Standalone = false; public bool Standalone = false;
public static readonly Dictionary<string, Mod> AllMods = ValidateMods(Directory.GetDirectories("mods").Select(x => x.Substring(5)).ToArray()); public static readonly Dictionary<string, Mod> AllMods = ValidateMods(Directory.GetDirectories("mods").Select(x => x.Substring(5)).ToArray());
public static Dictionary<string, Mod> ValidateMods(string[] mods) public static Dictionary<string, Mod> ValidateMods(string[] mods)
{ {
var ret = new Dictionary<string, Mod>(); var ret = new Dictionary<string, Mod>();
foreach (var m in mods) foreach (var m in mods)
{ {
if (!File.Exists("mods" + Path.DirectorySeparatorChar + m + Path.DirectorySeparatorChar + "mod.yaml")) if (!File.Exists("mods" + Path.DirectorySeparatorChar + m + Path.DirectorySeparatorChar + "mod.yaml"))
continue; continue;
var yaml = new MiniYaml(null, MiniYaml.FromFile("mods" + Path.DirectorySeparatorChar + m + Path.DirectorySeparatorChar + "mod.yaml")); var yaml = new MiniYaml(null, MiniYaml.FromFile("mods" + Path.DirectorySeparatorChar + m + Path.DirectorySeparatorChar + "mod.yaml"));
if (!yaml.NodesDict.ContainsKey("Metadata")) if (!yaml.NodesDict.ContainsKey("Metadata"))
continue; continue;
ret.Add(m, FieldLoader.Load<Mod>(yaml.NodesDict["Metadata"])); ret.Add(m, FieldLoader.Load<Mod>(yaml.NodesDict["Metadata"]));
} }
return ret; return ret;
} }
} }
} }

View File

@@ -1,124 +1,124 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</ProjectGuid> <ProjectGuid>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenRA.FileFormats</RootNamespace> <RootNamespace>OpenRA.FileFormats</RootNamespace>
<AssemblyName>OpenRA.FileFormats</AssemblyName> <AssemblyName>OpenRA.FileFormats</AssemblyName>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath> <OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Optimize>false</Optimize> <Optimize>false</Optimize>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core"> <Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Tao.Sdl, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9c7a200e36c0094e"> <Reference Include="Tao.Sdl, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9c7a200e36c0094e">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.Sdl.dll</HintPath> <HintPath>..\thirdparty\Tao\Tao.Sdl.dll</HintPath>
</Reference> </Reference>
<Reference Include="WindowsBase"> <Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework> <RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73"> <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\ICSharpCode.SharpZipLib.dll</HintPath> <HintPath>..\thirdparty\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ColorHSLR.cs" /> <Compile Include="ColorHSLR.cs" />
<Compile Include="Evaluator.cs" /> <Compile Include="Evaluator.cs" />
<Compile Include="Exts.cs" /> <Compile Include="Exts.cs" />
<Compile Include="FieldLoader.cs" /> <Compile Include="FieldLoader.cs" />
<Compile Include="Graphics\IGraphicsDevice.cs" /> <Compile Include="Graphics\IGraphicsDevice.cs" />
<Compile Include="Graphics\IInputHandler.cs" /> <Compile Include="Graphics\IInputHandler.cs" />
<Compile Include="Graphics\PngLoader.cs" /> <Compile Include="Graphics\PngLoader.cs" />
<Compile Include="Graphics\ShpWriter.cs" /> <Compile Include="Graphics\ShpWriter.cs" />
<Compile Include="Graphics\Vertex.cs" /> <Compile Include="Graphics\Vertex.cs" />
<Compile Include="HttpUtil.cs" /> <Compile Include="HttpUtil.cs" />
<Compile Include="Manifest.cs" /> <Compile Include="Manifest.cs" />
<Compile Include="MiniYaml.cs" /> <Compile Include="MiniYaml.cs" />
<Compile Include="Mod.cs" /> <Compile Include="Mod.cs" />
<Compile Include="PackageEntry.cs" /> <Compile Include="PackageEntry.cs" />
<Compile Include="Palette.cs" /> <Compile Include="Palette.cs" />
<Compile Include="PlayerColorRemap.cs" /> <Compile Include="PlayerColorRemap.cs" />
<Compile Include="Primitives\ActionQueue.cs" /> <Compile Include="Primitives\ActionQueue.cs" />
<Compile Include="Primitives\DisposableAction.cs" /> <Compile Include="Primitives\DisposableAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Thirdparty\Random.cs" /> <Compile Include="Thirdparty\Random.cs" />
<Compile Include="Support\Log.cs" /> <Compile Include="Support\Log.cs" />
<Compile Include="Support\Stopwatch.cs" /> <Compile Include="Support\Stopwatch.cs" />
<Compile Include="Support\Timer.cs" /> <Compile Include="Support\Timer.cs" />
<Compile Include="TypeDictionary.cs" /> <Compile Include="TypeDictionary.cs" />
<Compile Include="Map\TileReference.cs" /> <Compile Include="Map\TileReference.cs" />
<Compile Include="Map\Terrain.cs" /> <Compile Include="Map\Terrain.cs" />
<Compile Include="Primitives\Cache.cs" /> <Compile Include="Primitives\Cache.cs" />
<Compile Include="Primitives\float2.cs" /> <Compile Include="Primitives\float2.cs" />
<Compile Include="Primitives\Pair.cs" /> <Compile Include="Primitives\Pair.cs" />
<Compile Include="Map\TileSet.cs" /> <Compile Include="Map\TileSet.cs" />
<Compile Include="Primitives\PriorityQueue.cs" /> <Compile Include="Primitives\PriorityQueue.cs" />
<Compile Include="Primitives\Lazy.cs" /> <Compile Include="Primitives\Lazy.cs" />
<Compile Include="FileFormats\AudLoader.cs" /> <Compile Include="FileFormats\AudLoader.cs" />
<Compile Include="FileFormats\Blowfish.cs" /> <Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" /> <Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="Primitives\Set.cs" /> <Compile Include="Primitives\Set.cs" />
<Compile Include="Graphics\Dune2ShpReader.cs" /> <Compile Include="Graphics\Dune2ShpReader.cs" />
<Compile Include="FileFormats\Format2.cs" /> <Compile Include="FileFormats\Format2.cs" />
<Compile Include="FileFormats\Format40.cs" /> <Compile Include="FileFormats\Format40.cs" />
<Compile Include="FileFormats\Format80.cs" /> <Compile Include="FileFormats\Format80.cs" />
<Compile Include="FileFormats\IniFile.cs" /> <Compile Include="FileFormats\IniFile.cs" />
<Compile Include="Graphics\ShpReader.cs" /> <Compile Include="Graphics\ShpReader.cs" />
<Compile Include="Primitives\int2.cs" /> <Compile Include="Primitives\int2.cs" />
<Compile Include="Map\SmudgeReference.cs" /> <Compile Include="Map\SmudgeReference.cs" />
<Compile Include="Map\PlayerReference.cs" /> <Compile Include="Map\PlayerReference.cs" />
<Compile Include="Graphics\VqaReader.cs" /> <Compile Include="Graphics\VqaReader.cs" />
<Compile Include="Filesystem\MixFile.cs" /> <Compile Include="Filesystem\MixFile.cs" />
<Compile Include="Filesystem\FileSystem.cs" /> <Compile Include="Filesystem\FileSystem.cs" />
<Compile Include="Filesystem\Folder.cs" /> <Compile Include="Filesystem\Folder.cs" />
<Compile Include="Filesystem\InstallShieldPackage.cs" /> <Compile Include="Filesystem\InstallShieldPackage.cs" />
<Compile Include="FileFormats\Blast.cs" /> <Compile Include="FileFormats\Blast.cs" />
<Compile Include="Filesystem\ZipFile.cs" /> <Compile Include="Filesystem\ZipFile.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
</Target> </Target>
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>

View File

@@ -15,7 +15,7 @@ using System.Collections.Generic;
namespace OpenRA.FileFormats namespace OpenRA.FileFormats
{ {
public class Cache<T, U> : IEnumerable<KeyValuePair<T, U>> public class Cache<T, U> : IEnumerable<KeyValuePair<T, U>>
{ {
Dictionary<T, U> hax; Dictionary<T, U> hax;
Func<T,U> loader; Func<T,U> loader;
@@ -26,10 +26,10 @@ namespace OpenRA.FileFormats
throw new ArgumentNullException(); throw new ArgumentNullException();
this.loader = loader; this.loader = loader;
} }
public Cache(Func<T, U> loader) public Cache(Func<T, U> loader)
: this(loader, EqualityComparer<T>.Default) { } : this(loader, EqualityComparer<T>.Default) { }
public U this[T key] public U this[T key]
{ {

View File

@@ -36,11 +36,11 @@ namespace OpenRA.FileFormats
p = null; p = null;
return value; return value;
} }
} }
public void Force() public void Force()
{ {
var ignored = Value; var ignored = Value;
} }
} }

View File

@@ -8,8 +8,8 @@
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using System.Drawing; using System.Drawing;
namespace OpenRA.FileFormats namespace OpenRA.FileFormats
@@ -25,7 +25,7 @@ namespace OpenRA.FileFormats
Second = second; Second = second;
} }
internal static IEqualityComparer<T> tc = EqualityComparer<T>.Default; internal static IEqualityComparer<T> tc = EqualityComparer<T>.Default;
internal static IEqualityComparer<U> uc = EqualityComparer<U>.Default; internal static IEqualityComparer<U> uc = EqualityComparer<U>.Default;
public static bool operator ==(Pair<T, U> a, Pair<T, U> b) public static bool operator ==(Pair<T, U> a, Pair<T, U> b)
@@ -60,31 +60,31 @@ namespace OpenRA.FileFormats
public override string ToString() public override string ToString()
{ {
return "({0},{1})".F(First, Second); return "({0},{1})".F(First, Second);
} }
class PairEqualityComparer : IEqualityComparer<Pair<T, U>> class PairEqualityComparer : IEqualityComparer<Pair<T, U>>
{ {
public bool Equals(Pair<T, U> x, Pair<T, U> y) { return x == y; } public bool Equals(Pair<T, U> x, Pair<T, U> y) { return x == y; }
public int GetHashCode(Pair<T, U> obj) { return obj.GetHashCode(); } public int GetHashCode(Pair<T, U> obj) { return obj.GetHashCode(); }
} }
public static IEqualityComparer<Pair<T, U>> EqualityComparer { get { return new PairEqualityComparer(); } } public static IEqualityComparer<Pair<T, U>> EqualityComparer { get { return new PairEqualityComparer(); } }
} }
public static class Pair public static class Pair
{ {
public static Pair<T, U> New<T, U>(T t, U u) { return new Pair<T, U>(t, u); } public static Pair<T, U> New<T, U>(T t, U u) { return new Pair<T, U>(t, u); }
static Pair() static Pair()
{ {
Pair<char,Color>.uc = new ColorEqualityComparer(); Pair<char,Color>.uc = new ColorEqualityComparer();
} }
// avoid the default crappy one // avoid the default crappy one
class ColorEqualityComparer : IEqualityComparer<Color> class ColorEqualityComparer : IEqualityComparer<Color>
{ {
public bool Equals(Color x, Color y) { return x.ToArgb() == y.ToArgb(); } public bool Equals(Color x, Color y) { return x.ToArgb() == y.ToArgb(); }
public int GetHashCode(Color obj) { return obj.GetHashCode(); } public int GetHashCode(Color obj) { return obj.GetHashCode(); }
} }
} }
} }

View File

@@ -1,36 +1,26 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA. * This file is part of OpenRA, which is free software. It is made
* * available to you under the terms of the GNU General Public License
* OpenRA is free software: you can redistribute it and/or modify * as published by the Free Software Foundation. For more information,
* it under the terms of the GNU General Public License as published by * see COPYING.
* the Free Software Foundation, either version 3 of the License, or */
* (at your option) any later version. #endregion
*
* OpenRA is distributed in the hope that it will be useful, using System.Reflection;
* but WITHOUT ANY WARRANTY; without even the implied warranty of using System.Runtime.InteropServices;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. [assembly: AssemblyTitle("OpenRA.FileFormats")]
* [assembly: AssemblyDescription("")]
* You should have received a copy of the GNU General Public License [assembly: AssemblyConfiguration("")]
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>. [assembly: AssemblyCompany("")]
*/ [assembly: AssemblyProduct("OpenRA.FileFormats")]
#endregion [assembly: AssemblyCopyright("Copyright © 2007,2009,2010")]
[assembly: AssemblyTrademark("")]
using System.Reflection; [assembly: AssemblyCulture("")]
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: AssemblyTitle("OpenRA.FileFormats")]
[assembly: AssemblyDescription("")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenRA.FileFormats")]
[assembly: AssemblyCopyright("Copyright © 2007,2009,2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -65,7 +65,7 @@ namespace OpenRA
return firstSprite.Sprite.size * firstSprite.Scale; return firstSprite.Sprite.size * firstSprite.Scale;
}); });
ApplyIRender = x => x.Render(this); ApplyIRender = x => x.Render(this);
ApplyRenderModifier = (m, p) => p.ModifyRender(this, m); ApplyRenderModifier = (m, p) => p.ModifyRender(this, m);
} }
@@ -83,14 +83,14 @@ namespace OpenRA
get { return currentActivity == null; } get { return currentActivity == null; }
} }
OpenRA.FileFormats.Lazy<float2> Size; OpenRA.FileFormats.Lazy<float2> Size;
// note: these delegates are cached to avoid massive allocation. // note: these delegates are cached to avoid massive allocation.
Func<IRender, IEnumerable<Renderable>> ApplyIRender; Func<IRender, IEnumerable<Renderable>> ApplyIRender;
Func<IEnumerable<Renderable>, IRenderModifier, IEnumerable<Renderable>> ApplyRenderModifier; Func<IEnumerable<Renderable>, IRenderModifier, IEnumerable<Renderable>> ApplyRenderModifier;
public IEnumerable<Renderable> Render() public IEnumerable<Renderable> Render()
{ {
var mods = TraitsImplementing<IRenderModifier>(); var mods = TraitsImplementing<IRenderModifier>();
var sprites = TraitsImplementing<IRender>().SelectMany(ApplyIRender); var sprites = TraitsImplementing<IRender>().SelectMany(ApplyIRender);
return mods.Aggregate(sprites, ApplyRenderModifier); return mods.Aggregate(sprites, ApplyRenderModifier);
} }

View File

@@ -266,11 +266,11 @@ namespace OpenRA
var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray(); var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray();
Console.WriteLine("Loading mods: {0}",string.Join(",",mm)); Console.WriteLine("Loading mods: {0}",string.Join(",",mm));
Settings.Game.Mods = mm; Settings.Game.Mods = mm;
Settings.Save(); Settings.Save();
Sound.StopMusic(); Sound.StopMusic();
Sound.StopVideo(); Sound.StopVideo();
Sound.Initialize(); Sound.Initialize();
modData = new ModData( mm ); modData = new ModData( mm );
modData.LoadInitialAssets(); modData.LoadInitialAssets();
@@ -366,11 +366,11 @@ namespace OpenRA
{ {
server = new Server.Server(modData, settings, map); server = new Server.Server(modData, settings, map);
JoinServer(IPAddress.Loopback.ToString(), settings.Server.ListenPort); JoinServer(IPAddress.Loopback.ToString(), settings.Server.ListenPort);
} }
public static bool IsCurrentWorld(World world) public static bool IsCurrentWorld(World world)
{ {
return orderManager != null && orderManager.world == world; return orderManager != null && orderManager.world == world;
} }
} }
} }

View File

@@ -22,29 +22,29 @@ namespace OpenRA
public readonly TypeDictionary Traits = new TypeDictionary(); public readonly TypeDictionary Traits = new TypeDictionary();
public ActorInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits ) public ActorInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits )
{ {
try try
{ {
var mergedNode = MergeWithParent(node, allUnits).NodesDict; var mergedNode = MergeWithParent(node, allUnits).NodesDict;
Name = name; Name = name;
foreach (var t in mergedNode) foreach (var t in mergedNode)
if (t.Key != "Inherits" && !t.Key.StartsWith("-")) if (t.Key != "Inherits" && !t.Key.StartsWith("-"))
Traits.Add(LoadTraitInfo(t.Key.Split('@')[0], t.Value)); Traits.Add(LoadTraitInfo(t.Key.Split('@')[0], t.Value));
} }
catch (YamlException e) catch (YamlException e)
{ {
throw new YamlException("Actor type {0}: {1}".F(name, e.Message)); throw new YamlException("Actor type {0}: {1}".F(name, e.Message));
}
}
static IEnumerable<MiniYaml> GetInheritanceChain(MiniYaml node, Dictionary<string, MiniYaml> allUnits)
{
while (node != null)
{
yield return node;
node = GetParent(node, allUnits);
} }
}
static IEnumerable<MiniYaml> GetInheritanceChain(MiniYaml node, Dictionary<string, MiniYaml> allUnits)
{
while (node != null)
{
yield return node;
node = GetParent(node, allUnits);
}
} }
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits ) static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
@@ -55,9 +55,9 @@ namespace OpenRA
return null; return null;
MiniYaml parent; MiniYaml parent;
allUnits.TryGetValue( inherits.Value, out parent ); allUnits.TryGetValue( inherits.Value, out parent );
if (parent == null) if (parent == null)
throw new InvalidOperationException( throw new InvalidOperationException(
"Bogus inheritance -- actor type {0} does not exist".F(inherits.Value)); "Bogus inheritance -- actor type {0} does not exist".F(inherits.Value));
return parent; return parent;
@@ -65,14 +65,14 @@ namespace OpenRA
static MiniYaml MergeWithParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits ) static MiniYaml MergeWithParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
{ {
var parent = GetParent( node, allUnits ); var parent = GetParent( node, allUnits );
if (parent != null) if (parent != null)
{ {
var result = MiniYaml.Merge(node, MergeWithParent(parent, allUnits)); var result = MiniYaml.Merge(node, MergeWithParent(parent, allUnits));
// strip the '-' // strip the '-'
result.Nodes.RemoveAll(a => a.Key.StartsWith("-")); result.Nodes.RemoveAll(a => a.Key.StartsWith("-"));
return result; return result;
} }
return node; return node;
} }

View File

@@ -53,15 +53,15 @@ namespace OpenRA.Graphics
public void PlayRepeating( string sequenceName ) public void PlayRepeating( string sequenceName )
{ {
backwards = false; backwards = false;
tickAlways = false; tickAlways = false;
CurrentSequence = SequenceProvider.GetSequence(name, sequenceName); CurrentSequence = SequenceProvider.GetSequence(name, sequenceName);
frame = 0; frame = 0;
tickFunc = () => tickFunc = () =>
{ {
++frame; ++frame;
if (frame >= CurrentSequence.Length) if (frame >= CurrentSequence.Length)
frame = 0; frame = 0;
}; };
} }

View File

@@ -56,8 +56,8 @@ namespace OpenRA.Graphics
palettes.Add(name, p); palettes.Add(name, p);
indices.Add(name, allocated++); indices.Add(name, allocated++);
} }
uint[,] data = new uint[MaxPalettes, 256]; uint[,] data = new uint[MaxPalettes, 256];
public void Update(IEnumerable<IPaletteModifier> paletteMods) public void Update(IEnumerable<IPaletteModifier> paletteMods)
{ {

View File

@@ -55,20 +55,20 @@ namespace OpenRA.Graphics
vertices[nv + 2] = new Vertex(new float2(o.X, o.Y + size.Y), vertices[nv + 2] = new Vertex(new float2(o.X, o.Y + size.Y),
r.FastMapTextureCoords(2), attrib); r.FastMapTextureCoords(2), attrib);
vertices[nv + 3] = new Vertex(new float2(o.X + size.X, o.Y + size.Y), vertices[nv + 3] = new Vertex(new float2(o.X + size.X, o.Y + size.Y),
r.FastMapTextureCoords(3), attrib); r.FastMapTextureCoords(3), attrib);
indices[ni] = (uint)(nv); indices[ni] = (uint)(nv);
indices[ni + 1] = indices[ni + 3] = (uint)(nv + 1); indices[ni + 1] = indices[ni + 3] = (uint)(nv + 1);
indices[ni + 2] = indices[ni + 5] = (uint)(nv + 2); indices[ni + 2] = indices[ni + 5] = (uint)(nv + 2);
indices[ni + 4] = (uint)(nv + 3); indices[ni + 4] = (uint)(nv + 3);
} }
static readonly int[] channelMasks = { 2, 1, 0, 3 }; // yes, our channel order is nuts. static readonly int[] channelMasks = { 2, 1, 0, 3 }; // yes, our channel order is nuts.
public static void FastCopyIntoChannel(Sprite dest, byte[] src) public static void FastCopyIntoChannel(Sprite dest, byte[] src)
{ {
var data = dest.sheet.Data; var data = dest.sheet.Data;
var srcStride = dest.bounds.Width; var srcStride = dest.bounds.Width;
var destStride = dest.sheet.Size.Width * 4; var destStride = dest.sheet.Size.Width * 4;
var destOffset = destStride * dest.bounds.Top + dest.bounds.Left * 4 + channelMasks[(int)dest.channel]; var destOffset = destStride * dest.bounds.Top + dest.bounds.Left * 4 + channelMasks[(int)dest.channel];
var destSkip = destStride - 4 * srcStride; var destSkip = destStride - 4 * srcStride;
var height = dest.bounds.Height; var height = dest.bounds.Height;

View File

@@ -86,11 +86,11 @@ namespace OpenRA.Graphics
wr.Draw(); wr.Draw();
Widget.DoDraw(); Widget.DoDraw();
var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default"; var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default";
var cursorSequence = CursorProvider.GetCursorSequence(cursorName); var cursorSequence = CursorProvider.GetCursorSequence(cursorName);
cursorSequence.GetSprite((int)cursorFrame).DrawAt( cursorSequence.GetSprite((int)cursorFrame).DrawAt(
Viewport.LastMousePos + Location - cursorSequence.Hotspot, Viewport.LastMousePos + Location - cursorSequence.Hotspot,
Game.modData.Palette.GetPaletteIndex(cursorSequence.Palette)); Game.modData.Palette.GetPaletteIndex(cursorSequence.Palette));
renderer.EndFrame( inputHandler ); renderer.EndFrame( inputHandler );

View File

@@ -122,33 +122,33 @@ namespace OpenRA.Graphics
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, color, color); Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, color, color);
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, color, color); Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, color, color);
Game.Renderer.LineRenderer.DrawLine(a, a + c, color, color); Game.Renderer.LineRenderer.DrawLine(a, a + c, color, color);
} }
public void DrawSelectionBox(Actor selectedUnit, Color c) public void DrawSelectionBox(Actor selectedUnit, Color c)
{ {
var bounds = selectedUnit.GetBounds(false); var bounds = selectedUnit.GetBounds(false);
var xy = new float2(bounds.Left, bounds.Top); var xy = new float2(bounds.Left, bounds.Top);
var Xy = new float2(bounds.Right, bounds.Top); var Xy = new float2(bounds.Right, bounds.Top);
var xY = new float2(bounds.Left, bounds.Bottom); var xY = new float2(bounds.Left, bounds.Bottom);
var XY = new float2(bounds.Right, bounds.Bottom); var XY = new float2(bounds.Right, bounds.Bottom);
Game.Renderer.LineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c); Game.Renderer.LineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c);
Game.Renderer.LineRenderer.DrawLine(xy, xy + new float2(0, 4), c, c); Game.Renderer.LineRenderer.DrawLine(xy, xy + new float2(0, 4), c, c);
Game.Renderer.LineRenderer.DrawLine(Xy, Xy + new float2(-4, 0), c, c); Game.Renderer.LineRenderer.DrawLine(Xy, Xy + new float2(-4, 0), c, c);
Game.Renderer.LineRenderer.DrawLine(Xy, Xy + new float2(0, 4), c, c); Game.Renderer.LineRenderer.DrawLine(Xy, Xy + new float2(0, 4), c, c);
Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(4, 0), c, c); Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(4, 0), c, c);
Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(0, -4), c, c); Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(0, -4), c, c);
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(-4, 0), c, c); Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(-4, 0), c, c);
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(0, -4), c, c); Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(0, -4), c, c);
} }
public void DrawRollover(Actor unit) public void DrawRollover(Actor unit)
{ {
var selectable = unit.TraitOrDefault<Selectable>(); var selectable = unit.TraitOrDefault<Selectable>();
if (selectable != null) if (selectable != null)
selectable.DrawRollover(this, unit); selectable.DrawRollover(this, unit);
} }
public void DrawLocus(Color c, int2[] cells) public void DrawLocus(Color c, int2[] cells)

View File

@@ -375,11 +375,11 @@ namespace OpenRA
// File header consists of a version byte, followed by 2 ushorts for width and height // File header consists of a version byte, followed by 2 ushorts for width and height
writer.Write(TileFormat); writer.Write(TileFormat);
writer.Write((ushort)MapSize.X); writer.Write((ushort)MapSize.X);
writer.Write((ushort)MapSize.Y); writer.Write((ushort)MapSize.Y);
if (!OpenRA.Rules.TileSets.ContainsKey(Tileset)) if (!OpenRA.Rules.TileSets.ContainsKey(Tileset))
throw new InvalidOperationException( throw new InvalidOperationException(
"Tileset used by the map ({0}) does not exist in this mod. Valid tilesets are: {1}" "Tileset used by the map ({0}) does not exist in this mod. Valid tilesets are: {1}"
.F(Tileset, string.Join(",", OpenRA.Rules.TileSets.Keys.ToArray()))); .F(Tileset, string.Join(",", OpenRA.Rules.TileSets.Keys.ToArray())));
// Tile data // Tile data
@@ -423,11 +423,11 @@ namespace OpenRA
} }
public void Resize(int width, int height) // editor magic. public void Resize(int width, int height) // editor magic.
{ {
var oldMapTiles = MapTiles.Value; var oldMapTiles = MapTiles.Value;
var oldMapResources = MapResources.Value; var oldMapResources = MapResources.Value;
MapTiles = Lazy.New(() => ResizeArray(oldMapTiles, oldMapTiles[0, 0], width, height)); MapTiles = Lazy.New(() => ResizeArray(oldMapTiles, oldMapTiles[0, 0], width, height));
MapResources = Lazy.New(() => ResizeArray(oldMapResources, oldMapResources[0, 0], width, height)); MapResources = Lazy.New(() => ResizeArray(oldMapResources, oldMapResources[0, 0], width, height));
MapSize = new int2(width, height); MapSize = new int2(width, height);
} }

View File

@@ -1,61 +1,71 @@
using System; #region Copyright & License Information
using System.Collections.Generic; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
namespace OpenRA.Network * available to you under the terms of the GNU General Public License
{ * as published by the Free Software Foundation. For more information,
class FrameData * see COPYING.
{ */
public struct ClientOrder #endregion
{
public int Client; using System;
public Order Order; using System.Collections.Generic;
} using System.Linq;
readonly Dictionary<int, int> clientQuitTimes = new Dictionary<int, int>(); namespace OpenRA.Network
readonly Dictionary<int, Dictionary<int, byte[]>> framePackets = new Dictionary<int, Dictionary<int, byte[]>>(); {
class FrameData
public IEnumerable<int> ClientsPlayingInFrame( int frame ) {
{ public struct ClientOrder
return clientQuitTimes {
.Where( x => frame <= x.Value ) public int Client;
.Select( x => x.Key ) public Order Order;
.OrderBy( x => x ); }
}
readonly Dictionary<int, int> clientQuitTimes = new Dictionary<int, int>();
public void ClientQuit( int clientId, int lastClientFrame ) readonly Dictionary<int, Dictionary<int, byte[]>> framePackets = new Dictionary<int, Dictionary<int, byte[]>>();
{
clientQuitTimes[clientId] = lastClientFrame; public IEnumerable<int> ClientsPlayingInFrame( int frame )
} {
return clientQuitTimes
public void AddFrameOrders( int clientId, int frame, byte[] orders ) .Where( x => frame <= x.Value )
{ .Select( x => x.Key )
var frameData = framePackets.GetOrAdd( frame ); .OrderBy( x => x );
frameData.Add( clientId, orders ); }
}
public void ClientQuit( int clientId, int lastClientFrame )
public bool IsReadyForFrame(int frame) {
{ clientQuitTimes[clientId] = lastClientFrame;
return !ClientsNotReadyForFrame(frame).Any(); }
}
public void AddFrameOrders( int clientId, int frame, byte[] orders )
public IEnumerable<int> ClientsNotReadyForFrame(int frame) {
{ var frameData = framePackets.GetOrAdd( frame );
var frameData = framePackets.GetOrAdd(frame); frameData.Add( clientId, orders );
return ClientsPlayingInFrame(frame) }
.Where(client => !frameData.ContainsKey(client));
} public bool IsReadyForFrame(int frame)
{
public IEnumerable<ClientOrder> OrdersForFrame( World world, int frame ) return !ClientsNotReadyForFrame(frame).Any();
{ }
var frameData = framePackets[ frame ];
var clientData = ClientsPlayingInFrame( frame ) public IEnumerable<int> ClientsNotReadyForFrame(int frame)
.ToDictionary( k => k, v => frameData[ v ] ); {
var frameData = framePackets.GetOrAdd(frame);
return clientData return ClientsPlayingInFrame(frame)
.SelectMany( x => x.Value .Where(client => !frameData.ContainsKey(client));
.ToOrderList( world ) }
.Select( o => new ClientOrder { Client = x.Key, Order = o } ) );
} public IEnumerable<ClientOrder> OrdersForFrame( World world, int frame )
} {
} var frameData = framePackets[ frame ];
var clientData = ClientsPlayingInFrame( frame )
.ToDictionary( k => k, v => frameData[ v ] );
return clientData
.SelectMany( x => x.Value
.ToOrderList( world )
.Select( o => new ClientOrder { Client = x.Key, Order = o } ) );
}
}
}

View File

@@ -155,18 +155,18 @@ namespace OpenRA.Network
public bool IsReadyForNextFrame public bool IsReadyForNextFrame
{ {
get { return NetFrameNumber >= 1 && frameData.IsReadyForFrame( NetFrameNumber ); } get { return NetFrameNumber >= 1 && frameData.IsReadyForFrame( NetFrameNumber ); }
} }
static readonly IEnumerable<Session.Client> NoClients = new Session.Client[] {}; static readonly IEnumerable<Session.Client> NoClients = new Session.Client[] {};
public IEnumerable<Session.Client> GetClientsNotReadyForNextFrame public IEnumerable<Session.Client> GetClientsNotReadyForNextFrame
{ {
get get
{ {
return NetFrameNumber >= 1 return NetFrameNumber >= 1
? frameData.ClientsNotReadyForFrame(NetFrameNumber) ? frameData.ClientsNotReadyForFrame(NetFrameNumber)
.Select(a => LobbyInfo.ClientWithIndex(a)) .Select(a => LobbyInfo.ClientWithIndex(a))
: NoClients; : NoClients;
} }
} }
public void Tick() public void Tick()

View File

@@ -1,110 +1,120 @@
using System; #region Copyright & License Information
using System.Collections.Generic; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
using System.Text; * This file is part of OpenRA, which is free software. It is made
using System.IO; * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
namespace OpenRA.Network * see COPYING.
{ */
public class ReplayConnection : IConnection #endregion
{
//uint nextFrame = 1; using System;
FileStream replayStream; using System.Collections.Generic;
using System.Linq;
public ReplayConnection( string replayFilename ) using System.Text;
{ using System.IO;
replayStream = File.OpenRead( replayFilename );
} namespace OpenRA.Network
{
public int LocalClientId public class ReplayConnection : IConnection
{ {
get { return 0; } //uint nextFrame = 1;
} FileStream replayStream;
public ConnectionState ConnectionState public ReplayConnection( string replayFilename )
{ {
get { return ConnectionState.Connected; } replayStream = File.OpenRead( replayFilename );
} }
// do nothing; ignore locally generated orders public int LocalClientId
public void Send( int frame, List<byte[]> orders ) { } {
public void SendImmediate( List<byte[]> orders ) { } get { return 0; }
public void SendSync( int frame, byte[] syncData ) }
{
var ms = new MemoryStream(); public ConnectionState ConnectionState
ms.Write( BitConverter.GetBytes( frame ) ); {
ms.Write( syncData ); get { return ConnectionState.Connected; }
sync.Add( ms.ToArray() ); }
}
// do nothing; ignore locally generated orders
List<byte[]> sync = new List<byte[]>(); public void Send( int frame, List<byte[]> orders ) { }
public void SendImmediate( List<byte[]> orders ) { }
public void Receive( Action<int, byte[]> packetFn ) public void SendSync( int frame, byte[] syncData )
{ {
while( sync.Count != 0 ) var ms = new MemoryStream();
{ ms.Write( BitConverter.GetBytes( frame ) );
packetFn( LocalClientId, sync[ 0 ] ); ms.Write( syncData );
sync.RemoveAt( 0 ); sync.Add( ms.ToArray() );
} }
if( replayStream == null ) return;
List<byte[]> sync = new List<byte[]>();
var reader = new BinaryReader( replayStream );
while( replayStream.Position < replayStream.Length ) public void Receive( Action<int, byte[]> packetFn )
{ {
var client = reader.ReadInt32(); while( sync.Count != 0 )
var packetLen = reader.ReadInt32(); {
var packet = reader.ReadBytes( packetLen ); packetFn( LocalClientId, sync[ 0 ] );
packetFn( client, packet ); sync.RemoveAt( 0 );
} }
replayStream = null; if( replayStream == null ) return;
}
var reader = new BinaryReader( replayStream );
public void Dispose() { } while( replayStream.Position < replayStream.Length )
} {
var client = reader.ReadInt32();
class ReplayRecorderConnection : IConnection var packetLen = reader.ReadInt32();
{ var packet = reader.ReadBytes( packetLen );
IConnection inner; packetFn( client, packet );
BinaryWriter writer; }
replayStream = null;
public ReplayRecorderConnection( IConnection inner, FileStream replayFile ) }
{
this.inner = inner; public void Dispose() { }
this.writer = new BinaryWriter( replayFile ); }
}
class ReplayRecorderConnection : IConnection
public int LocalClientId { get { return inner.LocalClientId; } } {
public ConnectionState ConnectionState { get { return inner.ConnectionState; } } IConnection inner;
BinaryWriter writer;
public void Send( int frame, List<byte[]> orders ) { inner.Send( frame, orders ); }
public void SendImmediate( List<byte[]> orders ) { inner.SendImmediate( orders ); } public ReplayRecorderConnection( IConnection inner, FileStream replayFile )
public void SendSync( int frame, byte[] syncData ) { inner.SendSync( frame, syncData ); } {
this.inner = inner;
public void Receive( Action<int, byte[]> packetFn ) this.writer = new BinaryWriter( replayFile );
{ }
inner.Receive( ( client, data ) =>
{ public int LocalClientId { get { return inner.LocalClientId; } }
writer.Write( client ); public ConnectionState ConnectionState { get { return inner.ConnectionState; } }
writer.Write( data.Length );
writer.Write( data ); public void Send( int frame, List<byte[]> orders ) { inner.Send( frame, orders ); }
packetFn( client, data ); public void SendImmediate( List<byte[]> orders ) { inner.SendImmediate( orders ); }
} ); public void SendSync( int frame, byte[] syncData ) { inner.SendSync( frame, syncData ); }
}
public void Receive( Action<int, byte[]> packetFn )
bool disposed; {
inner.Receive( ( client, data ) =>
public void Dispose() {
{ writer.Write( client );
if( disposed ) writer.Write( data.Length );
return; writer.Write( data );
packetFn( client, data );
writer.Close(); } );
disposed = true; }
}
bool disposed;
~ReplayRecorderConnection()
{ public void Dispose()
Dispose(); {
} if( disposed )
} return;
}
writer.Close();
disposed = true;
}
~ReplayRecorderConnection()
{
Dispose();
}
}
}

View File

@@ -188,9 +188,9 @@ namespace OpenRA.Network
var oldStance = p.Stances[target]; var oldStance = p.Stances[target];
p.Stances[target] = s; p.Stances[target] = s;
if (target == w.LocalPlayer) if (target == w.LocalPlayer)
w.WorldActor.Trait<Shroud>().UpdatePlayerStance(w, p, oldStance, s); w.WorldActor.Trait<Shroud>().UpdatePlayerStance(w, p, oldStance, s);
foreach (var nsc in w.ActorsWithTrait<INotifyStanceChanged>()) foreach (var nsc in w.ActorsWithTrait<INotifyStanceChanged>())
nsc.Trait.StanceChanged(nsc.Actor, p, target, oldStance, s); nsc.Trait.StanceChanged(nsc.Actor, p, target, oldStance, s);
} }
} }

View File

@@ -82,15 +82,15 @@ namespace OpenRA
a[ i ] = args[ key ]; a[ i ] = args[ key ];
} }
return ctor.Invoke( a ); return ctor.Invoke( a );
} }
public IEnumerable<Type> GetTypesImplementing<T>() public IEnumerable<Type> GetTypesImplementing<T>()
{ {
var it = typeof(T); var it = typeof(T);
return ModAssemblies.Select( ma => ma.First ).Distinct() return ModAssemblies.Select( ma => ma.First ).Distinct()
.SelectMany(ma => ma.GetTypes() .SelectMany(ma => ma.GetTypes()
.Where(t => t != it && it.IsAssignableFrom(t))); .Where(t => t != it && it.IsAssignableFrom(t)));
} }
[AttributeUsage( AttributeTargets.Parameter )] [AttributeUsage( AttributeTargets.Parameter )]
public class ParamAttribute : Attribute public class ParamAttribute : Attribute

View File

@@ -1,241 +1,241 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</ProjectGuid> <ProjectGuid>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenRA</RootNamespace> <RootNamespace>OpenRA</RootNamespace>
<AssemblyName>OpenRA.Game</AssemblyName> <AssemblyName>OpenRA.Game</AssemblyName>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled> <UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode> <UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval> <UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<ApplicationIcon>OpenRA.ico</ApplicationIcon> <ApplicationIcon>OpenRA.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath> <OutputPath>..\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Optimize>false</Optimize> <Optimize>false</Optimize>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core"> <Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Tao.FreeType, Version=2.3.5.0, Culture=neutral, PublicKeyToken=e499629dc69cd531"> <Reference Include="Tao.FreeType, Version=2.3.5.0, Culture=neutral, PublicKeyToken=e499629dc69cd531">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.FreeType.dll</HintPath> <HintPath>..\thirdparty\Tao\Tao.FreeType.dll</HintPath>
</Reference> </Reference>
<Reference Include="Tao.OpenAl, Version=1.1.0.1, Culture=neutral, PublicKeyToken=a7579dda88828311"> <Reference Include="Tao.OpenAl, Version=1.1.0.1, Culture=neutral, PublicKeyToken=a7579dda88828311">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.OpenAl.dll</HintPath> <HintPath>..\thirdparty\Tao\Tao.OpenAl.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GameRules\WeaponInfo.cs" /> <Compile Include="GameRules\WeaponInfo.cs" />
<Compile Include="Group.cs" /> <Compile Include="Group.cs" />
<Compile Include="Orders\GenericSelectTarget.cs" /> <Compile Include="Orders\GenericSelectTarget.cs" />
<Compile Include="Server\ProtocolVersion.cs" /> <Compile Include="Server\ProtocolVersion.cs" />
<Compile Include="Traits\LintAttributes.cs" /> <Compile Include="Traits\LintAttributes.cs" />
<Compile Include="Traits\Player\PlayerResources.cs" /> <Compile Include="Traits\Player\PlayerResources.cs" />
<Compile Include="Traits\World\Shroud.cs" /> <Compile Include="Traits\World\Shroud.cs" />
<Compile Include="Widgets\ChatEntryWidget.cs" /> <Compile Include="Widgets\ChatEntryWidget.cs" />
<Compile Include="Widgets\MapPreviewWidget.cs" /> <Compile Include="Widgets\MapPreviewWidget.cs" />
<Compile Include="Widgets\WidgetUtils.cs" /> <Compile Include="Widgets\WidgetUtils.cs" />
<Compile Include="Effects\DelayedAction.cs" /> <Compile Include="Effects\DelayedAction.cs" />
<Compile Include="Effects\FlashTarget.cs" /> <Compile Include="Effects\FlashTarget.cs" />
<Compile Include="GameRules\ActorInfo.cs" /> <Compile Include="GameRules\ActorInfo.cs" />
<Compile Include="GameRules\VoiceInfo.cs" /> <Compile Include="GameRules\VoiceInfo.cs" />
<Compile Include="Effects\IEffect.cs" /> <Compile Include="Effects\IEffect.cs" />
<Compile Include="Graphics\ChromeProvider.cs" /> <Compile Include="Graphics\ChromeProvider.cs" />
<Compile Include="Graphics\MappedImage.cs" /> <Compile Include="Graphics\MappedImage.cs" />
<Compile Include="Graphics\Minimap.cs" /> <Compile Include="Graphics\Minimap.cs" />
<Compile Include="Graphics\SpriteFont.cs" /> <Compile Include="Graphics\SpriteFont.cs" />
<Compile Include="Network\Connection.cs" /> <Compile Include="Network\Connection.cs" />
<Compile Include="Network\OrderIO.cs" /> <Compile Include="Network\OrderIO.cs" />
<Compile Include="Network\OrderManager.cs" /> <Compile Include="Network\OrderManager.cs" />
<Compile Include="Selection.cs" /> <Compile Include="Selection.cs" />
<Compile Include="Server\Connection.cs" /> <Compile Include="Server\Connection.cs" />
<Compile Include="Server\Exts.cs" /> <Compile Include="Server\Exts.cs" />
<Compile Include="Server\MasterServerQuery.cs" /> <Compile Include="Server\MasterServerQuery.cs" />
<Compile Include="Server\Server.cs" /> <Compile Include="Server\Server.cs" />
<Compile Include="Server\ServerOrder.cs" /> <Compile Include="Server\ServerOrder.cs" />
<Compile Include="Sound.cs" /> <Compile Include="Sound.cs" />
<Compile Include="Support\PerfHistory.cs" /> <Compile Include="Support\PerfHistory.cs" />
<Compile Include="Sync.cs" /> <Compile Include="Sync.cs" />
<Compile Include="Traits\World\SpatialBins.cs" /> <Compile Include="Traits\World\SpatialBins.cs" />
<Compile Include="Traits\World\Country.cs" /> <Compile Include="Traits\World\Country.cs" />
<Compile Include="Actor.cs" /> <Compile Include="Actor.cs" />
<Compile Include="GameRules\Rules.cs" /> <Compile Include="GameRules\Rules.cs" />
<Compile Include="Graphics\Animation.cs" /> <Compile Include="Graphics\Animation.cs" />
<Compile Include="Game.cs" /> <Compile Include="Game.cs" />
<Compile Include="Graphics\CursorSequence.cs" /> <Compile Include="Graphics\CursorSequence.cs" />
<Compile Include="Graphics\CursorSheetBuilder.cs" /> <Compile Include="Graphics\CursorSheetBuilder.cs" />
<Compile Include="Graphics\LineRenderer.cs" /> <Compile Include="Graphics\LineRenderer.cs" />
<Compile Include="Graphics\WorldRenderer.cs" /> <Compile Include="Graphics\WorldRenderer.cs" />
<Compile Include="Orders\IOrderGenerator.cs" /> <Compile Include="Orders\IOrderGenerator.cs" />
<Compile Include="Player.cs" /> <Compile Include="Player.cs" />
<Compile Include="Graphics\Sheet.cs" /> <Compile Include="Graphics\Sheet.cs" />
<Compile Include="Graphics\Sequence.cs" /> <Compile Include="Graphics\Sequence.cs" />
<Compile Include="Network\Order.cs" /> <Compile Include="Network\Order.cs" />
<Compile Include="Graphics\SequenceProvider.cs" /> <Compile Include="Graphics\SequenceProvider.cs" />
<Compile Include="Graphics\SheetBuilder.cs" /> <Compile Include="Graphics\SheetBuilder.cs" />
<Compile Include="Graphics\HardwarePalette.cs" /> <Compile Include="Graphics\HardwarePalette.cs" />
<Compile Include="Support\Program.cs" /> <Compile Include="Support\Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Graphics\Renderer.cs" /> <Compile Include="Graphics\Renderer.cs" />
<Compile Include="Graphics\Sprite.cs" /> <Compile Include="Graphics\Sprite.cs" />
<Compile Include="Graphics\SpriteRenderer.cs" /> <Compile Include="Graphics\SpriteRenderer.cs" />
<Compile Include="Graphics\SpriteLoader.cs" /> <Compile Include="Graphics\SpriteLoader.cs" />
<Compile Include="Graphics\TerrainRenderer.cs" /> <Compile Include="Graphics\TerrainRenderer.cs" />
<Compile Include="Traits\World\PlayerColorPalette.cs" /> <Compile Include="Traits\World\PlayerColorPalette.cs" />
<Compile Include="Traits\World\ResourceLayer.cs" /> <Compile Include="Traits\World\ResourceLayer.cs" />
<Compile Include="Traits\World\ResourceType.cs" /> <Compile Include="Traits\World\ResourceType.cs" />
<Compile Include="Traits\Selectable.cs" /> <Compile Include="Traits\Selectable.cs" />
<Compile Include="Traits\Render\RenderSimple.cs" /> <Compile Include="Traits\Render\RenderSimple.cs" />
<Compile Include="Traits\TraitsInterfaces.cs" /> <Compile Include="Traits\TraitsInterfaces.cs" />
<Compile Include="Traits\World\UnitInfluence.cs" /> <Compile Include="Traits\World\UnitInfluence.cs" />
<Compile Include="Network\UnitOrders.cs" /> <Compile Include="Network\UnitOrders.cs" />
<Compile Include="Traits\Util.cs" /> <Compile Include="Traits\Util.cs" />
<Compile Include="UiOverlay.cs" /> <Compile Include="UiOverlay.cs" />
<Compile Include="Graphics\Util.cs" /> <Compile Include="Graphics\Util.cs" />
<Compile Include="Graphics\Viewport.cs" /> <Compile Include="Graphics\Viewport.cs" />
<Compile Include="Orders\UnitOrderGenerator.cs" /> <Compile Include="Orders\UnitOrderGenerator.cs" />
<Compile Include="World.cs" /> <Compile Include="World.cs" />
<Compile Include="WorldUtils.cs" /> <Compile Include="WorldUtils.cs" />
<Compile Include="Traits\Player\EvaAlerts.cs" /> <Compile Include="Traits\Player\EvaAlerts.cs" />
<Compile Include="Traits\World\ScreenShaker.cs" /> <Compile Include="Traits\World\ScreenShaker.cs" />
<Compile Include="Widgets\WidgetLoader.cs" /> <Compile Include="Widgets\WidgetLoader.cs" />
<Compile Include="Widgets\ButtonWidget.cs" /> <Compile Include="Widgets\ButtonWidget.cs" />
<Compile Include="Widgets\Widget.cs" /> <Compile Include="Widgets\Widget.cs" />
<Compile Include="Widgets\BackgroundWidget.cs" /> <Compile Include="Widgets\BackgroundWidget.cs" />
<Compile Include="Widgets\LabelWidget.cs" /> <Compile Include="Widgets\LabelWidget.cs" />
<Compile Include="Widgets\CheckboxWidget.cs" /> <Compile Include="Widgets\CheckboxWidget.cs" />
<Compile Include="Widgets\PerfGraphWidget.cs" /> <Compile Include="Widgets\PerfGraphWidget.cs" />
<Compile Include="Widgets\ColorBlockWidget.cs" /> <Compile Include="Widgets\ColorBlockWidget.cs" />
<Compile Include="GameRules\MusicInfo.cs" /> <Compile Include="GameRules\MusicInfo.cs" />
<Compile Include="Widgets\ImageWidget.cs" /> <Compile Include="Widgets\ImageWidget.cs" />
<Compile Include="Widgets\TextFieldWidget.cs" /> <Compile Include="Widgets\TextFieldWidget.cs" />
<Compile Include="Widgets\ChatDisplayWidget.cs" /> <Compile Include="Widgets\ChatDisplayWidget.cs" />
<Compile Include="Widgets\SliderWidget.cs" /> <Compile Include="Widgets\SliderWidget.cs" />
<Compile Include="Widgets\TimerWidget.cs" /> <Compile Include="Widgets\TimerWidget.cs" />
<Compile Include="Widgets\ShpImageWidget.cs" /> <Compile Include="Widgets\ShpImageWidget.cs" />
<Compile Include="Traits\DrawLineToTarget.cs" /> <Compile Include="Traits\DrawLineToTarget.cs" />
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" /> <Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
<Compile Include="Widgets\ViewportScrollControllerWidget.cs" /> <Compile Include="Widgets\ViewportScrollControllerWidget.cs" />
<Compile Include="Traits\Player\DeveloperMode.cs" /> <Compile Include="Traits\Player\DeveloperMode.cs" />
<Compile Include="Traits\RevealsShroud.cs" /> <Compile Include="Traits\RevealsShroud.cs" />
<Compile Include="Traits\Health.cs" /> <Compile Include="Traits\Health.cs" />
<Compile Include="Widgets\VqaPlayerWidget.cs" /> <Compile Include="Widgets\VqaPlayerWidget.cs" />
<Compile Include="GameRules\Settings.cs" /> <Compile Include="GameRules\Settings.cs" />
<Compile Include="Support\Arguments.cs" /> <Compile Include="Support\Arguments.cs" />
<Compile Include="Traits\ActorStance.cs" /> <Compile Include="Traits\ActorStance.cs" />
<Compile Include="Traits\Armor.cs" /> <Compile Include="Traits\Armor.cs" />
<Compile Include="Graphics\CursorProvider.cs" /> <Compile Include="Graphics\CursorProvider.cs" />
<Compile Include="Server\TraitInterfaces.cs" /> <Compile Include="Server\TraitInterfaces.cs" />
<Compile Include="Widgets\ScrollPanelWidget.cs" /> <Compile Include="Widgets\ScrollPanelWidget.cs" />
<Compile Include="Graphics\ShroudRenderer.cs" /> <Compile Include="Graphics\ShroudRenderer.cs" />
<Compile Include="Network\Handshake.cs" /> <Compile Include="Network\Handshake.cs" />
<Compile Include="Widgets\ProgressBarWidget.cs" /> <Compile Include="Widgets\ProgressBarWidget.cs" />
<Compile Include="Utilities.cs" /> <Compile Include="Utilities.cs" />
<Compile Include="Traits\Waypoint.cs" /> <Compile Include="Traits\Waypoint.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project> <Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
<Name>OpenRA.FileFormats</Name> <Name>OpenRA.FileFormats</Name>
</ProjectReference> </ProjectReference>
<Compile Include="ActorInitializer.cs" /> <Compile Include="ActorInitializer.cs" />
<Compile Include="ActorReference.cs" /> <Compile Include="ActorReference.cs" />
<Compile Include="InputHandler.cs" /> <Compile Include="InputHandler.cs" />
<Compile Include="ModData.cs" /> <Compile Include="ModData.cs" />
<Compile Include="Map.cs" /> <Compile Include="Map.cs" />
<Compile Include="Network\FrameData.cs" /> <Compile Include="Network\FrameData.cs" />
<Compile Include="Network\ReplayConnection.cs" /> <Compile Include="Network\ReplayConnection.cs" />
<Compile Include="Network\Session.cs" /> <Compile Include="Network\Session.cs" />
<Compile Include="ObjectCreator.cs" /> <Compile Include="ObjectCreator.cs" />
<Compile Include="Network\SyncReport.cs" /> <Compile Include="Network\SyncReport.cs" />
<Compile Include="Traits\EditorAppearance.cs" /> <Compile Include="Traits\EditorAppearance.cs" />
<Compile Include="Traits\SubcellInit.cs" /> <Compile Include="Traits\SubcellInit.cs" />
<Compile Include="Traits\Target.cs" /> <Compile Include="Traits\Target.cs" />
<Compile Include="Traits\ValidateOrder.cs" /> <Compile Include="Traits\ValidateOrder.cs" />
<Compile Include="TraitDictionary.cs" /> <Compile Include="TraitDictionary.cs" />
<Compile Include="Traits\Activities\CancelableActivity.cs" /> <Compile Include="Traits\Activities\CancelableActivity.cs" />
<Compile Include="Widgets\PasswordFieldWidget.cs" /> <Compile Include="Widgets\PasswordFieldWidget.cs" />
<Compile Include="Widgets\ScrollingTextWidget.cs" /> <Compile Include="Widgets\ScrollingTextWidget.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0"> <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible> <Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName> <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0"> <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible> <Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName> <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5"> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible> <Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName> <ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="OpenRA.ico" /> <Content Include="OpenRA.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Widgets\Delegates\" /> <Folder Include="Widgets\Delegates\" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
</Target> </Target>
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>

View File

@@ -1,37 +1,27 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA. * This file is part of OpenRA, which is free software. It is made
* * available to you under the terms of the GNU General Public License
* OpenRA is free software: you can redistribute it and/or modify * as published by the Free Software Foundation. For more information,
* it under the terms of the GNU General Public License as published by * see COPYING.
* the Free Software Foundation, either version 3 of the License, or */
* (at your option) any later version. #endregion
*
* OpenRA is distributed in the hope that it will be useful, using System.Reflection;
* but WITHOUT ANY WARRANTY; without even the implied warranty of using System.Runtime.CompilerServices;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the using System.Runtime.InteropServices;
* GNU General Public License for more details.
* [assembly: AssemblyTitle("OpenRA")]
* You should have received a copy of the GNU General Public License [assembly: AssemblyDescription("")]
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>. [assembly: AssemblyConfiguration("")]
*/ [assembly: AssemblyCompany("")]
#endregion [assembly: AssemblyProduct("OpenRA")]
[assembly: AssemblyCopyright("Copyright © 2007,2009,2010")]
using System.Reflection; [assembly: AssemblyTrademark("")]
using System.Runtime.CompilerServices; [assembly: AssemblyCulture("")]
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: AssemblyTitle("OpenRA")]
[assembly: AssemblyDescription("")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenRA")]
[assembly: AssemblyCopyright("Copyright © 2007,2009,2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -17,14 +17,14 @@ namespace OpenRA
{ {
class TraitDictionary class TraitDictionary
{ {
Dictionary<Type, ITraitContainer> traits = new Dictionary<Type, ITraitContainer>(); Dictionary<Type, ITraitContainer> traits = new Dictionary<Type, ITraitContainer>();
ITraitContainer InnerGet( Type t ) ITraitContainer InnerGet( Type t )
{ {
return traits.GetOrAdd( t, doCreateTraitContainer ); return traits.GetOrAdd( t, doCreateTraitContainer );
} }
// construct this delegate once. // construct this delegate once.
static Func<Type, ITraitContainer> doCreateTraitContainer = CreateTraitContainer; static Func<Type, ITraitContainer> doCreateTraitContainer = CreateTraitContainer;
static ITraitContainer CreateTraitContainer( Type t ) static ITraitContainer CreateTraitContainer( Type t )
{ {

View File

@@ -1,38 +1,48 @@
using System; #region Copyright & License Information
using System.Collections.Generic; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
using System.Text; * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
namespace OpenRA.Traits.Activities * as published by the Free Software Foundation. For more information,
{ * see COPYING.
public abstract class CancelableActivity : IActivity */
{ #endregion
protected IActivity NextActivity { get; private set; }
protected bool IsCanceled { get; private set; } using System;
using System.Collections.Generic;
public abstract IActivity Tick( Actor self ); using System.Linq;
protected virtual bool OnCancel( Actor self ) { return true; } using System.Text;
public void Cancel( Actor self ) namespace OpenRA.Traits.Activities
{ {
IsCanceled = OnCancel( self ); public abstract class CancelableActivity : IActivity
if( IsCanceled ) {
NextActivity = null; protected IActivity NextActivity { get; private set; }
else if (NextActivity != null) protected bool IsCanceled { get; private set; }
NextActivity.Cancel( self );
} public abstract IActivity Tick( Actor self );
protected virtual bool OnCancel( Actor self ) { return true; }
public void Queue( IActivity activity )
{ public void Cancel( Actor self )
if( NextActivity != null ) {
NextActivity.Queue( activity ); IsCanceled = OnCancel( self );
else if( IsCanceled )
NextActivity = activity; NextActivity = null;
} else if (NextActivity != null)
NextActivity.Cancel( self );
public virtual IEnumerable<float2> GetCurrentPath() }
{
yield break; public void Queue( IActivity activity )
} {
} if( NextActivity != null )
} NextActivity.Queue( activity );
else
NextActivity = activity;
}
public virtual IEnumerable<float2> GetCurrentPath()
{
yield break;
}
}
}

View File

@@ -28,16 +28,16 @@ namespace OpenRA.Traits
public readonly HealthInfo Info; public readonly HealthInfo Info;
[Sync] [Sync]
int hp; int hp;
public int DisplayHp { get; private set; } public int DisplayHp { get; private set; }
public Health(ActorInitializer init, HealthInfo info) public Health(ActorInitializer init, HealthInfo info)
{ {
Info = info; Info = info;
MaxHP = info.HP; MaxHP = info.HP;
hp = init.Contains<HealthInit>() ? (int)(init.Get<HealthInit, float>() * MaxHP) : MaxHP; hp = init.Contains<HealthInit>() ? (int)(init.Get<HealthInit, float>() * MaxHP) : MaxHP;
DisplayHp = hp; DisplayHp = hp;
} }
@@ -122,16 +122,16 @@ namespace OpenRA.Traits
} }
if (hp > MaxHP) hp = MaxHP; if (hp > MaxHP) hp = MaxHP;
} }
public void Tick(Actor self) public void Tick(Actor self)
{ {
if (hp > DisplayHp) if (hp > DisplayHp)
DisplayHp = hp; DisplayHp = hp;
if (DisplayHp > hp) if (DisplayHp > hp)
DisplayHp = (2 * DisplayHp + hp) / 3; DisplayHp = (2 * DisplayHp + hp) / 3;
} }
} }
@@ -165,7 +165,7 @@ namespace OpenRA.Traits
} }
public static DamageState GetDamageState(this Actor self) public static DamageState GetDamageState(this Actor self)
{ {
if (self.Destroyed) return DamageState.Dead; if (self.Destroyed) return DamageState.Dead;
var health = self.TraitOrDefault<Health>(); var health = self.TraitOrDefault<Health>();

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Traits
public bool DisableShroud = false; public bool DisableShroud = false;
public bool PathDebug = false; public bool PathDebug = false;
public bool UnitInfluenceDebug = false; public bool UnitInfluenceDebug = false;
public bool UnlimitedPower; public bool UnlimitedPower;
public bool BuildAnywhere; public bool BuildAnywhere;
public object Create (ActorInitializer init) { return new DeveloperMode(this); } public object Create (ActorInitializer init) { return new DeveloperMode(this); }
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
[Sync] public bool DisableShroud; [Sync] public bool DisableShroud;
[Sync] public bool PathDebug; [Sync] public bool PathDebug;
[Sync] public bool UnitInfluenceDebug; [Sync] public bool UnitInfluenceDebug;
[Sync] public bool UnlimitedPower; [Sync] public bool UnlimitedPower;
[Sync] public bool BuildAnywhere; [Sync] public bool BuildAnywhere;
public DeveloperMode(DeveloperModeInfo info) public DeveloperMode(DeveloperModeInfo info)
@@ -46,7 +46,7 @@ namespace OpenRA.Traits
DisableShroud = info.DisableShroud; DisableShroud = info.DisableShroud;
PathDebug = info.PathDebug; PathDebug = info.PathDebug;
UnitInfluenceDebug = info.UnitInfluenceDebug; UnitInfluenceDebug = info.UnitInfluenceDebug;
UnlimitedPower = info.UnlimitedPower; UnlimitedPower = info.UnlimitedPower;
BuildAnywhere = info.BuildAnywhere; BuildAnywhere = info.BuildAnywhere;
} }
@@ -103,11 +103,11 @@ namespace OpenRA.Traits
{ {
UnlimitedPower ^= true; UnlimitedPower ^= true;
break; break;
} }
case "DevBuildAnywhere": case "DevBuildAnywhere":
{ {
BuildAnywhere ^= true; BuildAnywhere ^= true;
break; break;
} }
default: default:
return; return;

View File

@@ -49,33 +49,33 @@ namespace OpenRA.Traits
DrawControlGroup(wr, self, xy); DrawControlGroup(wr, self, xy);
DrawPips(wr, self, xY); DrawPips(wr, self, xY);
DrawTags(wr, self, new float2(.5f * (bounds.Left + bounds.Right), bounds.Top)); DrawTags(wr, self, new float2(.5f * (bounds.Left + bounds.Right), bounds.Top));
DrawUnitPath(self); DrawUnitPath(self);
DrawExtraBars(self, xy, Xy); DrawExtraBars(self, xy, Xy);
} }
public void DrawRollover(WorldRenderer wr, Actor self) public void DrawRollover(WorldRenderer wr, Actor self)
{ {
var bounds = self.GetBounds(false); var bounds = self.GetBounds(false);
var xy = new float2(bounds.Left, bounds.Top); var xy = new float2(bounds.Left, bounds.Top);
var Xy = new float2(bounds.Right, bounds.Top); var Xy = new float2(bounds.Right, bounds.Top);
DrawHealthBar(self, xy, Xy); DrawHealthBar(self, xy, Xy);
DrawExtraBars(self, xy, Xy); DrawExtraBars(self, xy, Xy);
} }
void DrawExtraBars(Actor self, float2 xy, float2 Xy) void DrawExtraBars(Actor self, float2 xy, float2 Xy)
{ {
foreach (var extraBar in self.TraitsImplementing<ISelectionBar>()) foreach (var extraBar in self.TraitsImplementing<ISelectionBar>())
{ {
var value = extraBar.GetValue(); var value = extraBar.GetValue();
if (value != 0) if (value != 0)
{ {
xy.Y += 4; xy.Y += 4;
Xy.Y += 4; Xy.Y += 4;
DrawSelectionBar(self, xy, Xy, extraBar.GetValue(), extraBar.GetColor()); DrawSelectionBar(self, xy, Xy, extraBar.GetValue(), extraBar.GetColor());
} }
} }
} }
void DrawSelectionBox(Actor self, float2 xy, float2 Xy, float2 xY, float2 XY, Color c) void DrawSelectionBox(Actor self, float2 xy, float2 Xy, float2 xY, float2 XY, Color c)
@@ -89,29 +89,29 @@ namespace OpenRA.Traits
Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(0, -4), c, c); Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(0, -4), c, c);
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(-4, 0), c, c); Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(-4, 0), c, c);
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(0, -4), c, c); Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(0, -4), c, c);
} }
void DrawSelectionBar(Actor self, float2 xy, float2 Xy, float value, Color barColor) void DrawSelectionBar(Actor self, float2 xy, float2 Xy, float value, Color barColor)
{ {
if (!self.IsInWorld) return; if (!self.IsInWorld) return;
var health = self.TraitOrDefault<Health>(); var health = self.TraitOrDefault<Health>();
if (health == null || health.IsDead) return; if (health == null || health.IsDead) return;
var c = Color.FromArgb(128, 30, 30, 30); var c = Color.FromArgb(128, 30, 30, 30);
var c2 = Color.FromArgb(128, 10, 10, 10); var c2 = Color.FromArgb(128, 10, 10, 10);
var barColor2 = Color.FromArgb(255, barColor.R / 2, barColor.G / 2, barColor.B / 2); var barColor2 = Color.FromArgb(255, barColor.R / 2, barColor.G / 2, barColor.B / 2);
var z = float2.Lerp(xy, Xy, value); var z = float2.Lerp(xy, Xy, value);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), Xy + new float2(0, -4), c, c); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), Xy + new float2(0, -4), c, c);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), Xy + new float2(0, -3), c2, c2); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), Xy + new float2(0, -3), c2, c2);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), Xy + new float2(0, -2), c, c); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), Xy + new float2(0, -2), c, c);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), z + new float2(0, -3), barColor, barColor); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), z + new float2(0, -3), barColor, barColor);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), z + new float2(0, -2), barColor2, barColor2); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), z + new float2(0, -2), barColor2, barColor2);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), z + new float2(0, -4), barColor2, barColor2); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), z + new float2(0, -4), barColor2, barColor2);
} }
void DrawHealthBar(Actor self, float2 xy, float2 Xy) void DrawHealthBar(Actor self, float2 xy, float2 Xy)
@@ -121,7 +121,7 @@ namespace OpenRA.Traits
var health = self.TraitOrDefault<Health>(); var health = self.TraitOrDefault<Health>();
if (health == null || health.IsDead) return; if (health == null || health.IsDead) return;
var c = Color.FromArgb(128, 30, 30, 30); var c = Color.FromArgb(128, 30, 30, 30);
var c2 = Color.FromArgb(128, 10, 10, 10); var c2 = Color.FromArgb(128, 10, 10, 10);
var healthColor = (health.DamageState == DamageState.Critical) ? Color.Red : var healthColor = (health.DamageState == DamageState.Critical) ? Color.Red :
@@ -133,30 +133,30 @@ namespace OpenRA.Traits
healthColor.G / 2, healthColor.G / 2,
healthColor.B / 2); healthColor.B / 2);
var z = float2.Lerp(xy, Xy, health.HPFraction); var z = float2.Lerp(xy, Xy, health.HPFraction);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), Xy + new float2(0, -4), c, c); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), Xy + new float2(0, -4), c, c);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), Xy + new float2(0, -3), c2, c2); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), Xy + new float2(0, -3), c2, c2);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), Xy + new float2(0, -2), c, c); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), Xy + new float2(0, -2), c, c);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), z + new float2(0, -3), healthColor, healthColor); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -3), z + new float2(0, -3), healthColor, healthColor);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), z + new float2(0, -2), healthColor2, healthColor2); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -2), z + new float2(0, -2), healthColor2, healthColor2);
Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), z + new float2(0, -4), healthColor2, healthColor2); Game.Renderer.LineRenderer.DrawLine(xy + new float2(0, -4), z + new float2(0, -4), healthColor2, healthColor2);
if (health.DisplayHp != health.HP) if (health.DisplayHp != health.HP)
{ {
var deltaColor = Color.OrangeRed; var deltaColor = Color.OrangeRed;
var deltaColor2 = Color.FromArgb( var deltaColor2 = Color.FromArgb(
255, 255,
deltaColor.R / 2, deltaColor.R / 2,
deltaColor.G / 2, deltaColor.G / 2,
deltaColor.B / 2); deltaColor.B / 2);
var zz = float2.Lerp(xy, Xy, (float)health.DisplayHp / health.MaxHP); var zz = float2.Lerp(xy, Xy, (float)health.DisplayHp / health.MaxHP);
Game.Renderer.LineRenderer.DrawLine(z + new float2(0, -3), zz + new float2(0, -3), deltaColor, deltaColor); Game.Renderer.LineRenderer.DrawLine(z + new float2(0, -3), zz + new float2(0, -3), deltaColor, deltaColor);
Game.Renderer.LineRenderer.DrawLine(z + new float2(0, -2), zz + new float2(0, -2), deltaColor2, deltaColor2); Game.Renderer.LineRenderer.DrawLine(z + new float2(0, -2), zz + new float2(0, -2), deltaColor2, deltaColor2);
Game.Renderer.LineRenderer.DrawLine(z + new float2(0, -4), zz + new float2(0, -4), deltaColor2, deltaColor2); Game.Renderer.LineRenderer.DrawLine(z + new float2(0, -4), zz + new float2(0, -4), deltaColor2, deltaColor2);
} }
} }

View File

@@ -1,26 +1,36 @@
using System; #region Copyright & License Information
using System.Collections.Generic; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
using System.Text; * This file is part of OpenRA, which is free software. It is made
using OpenRA.FileFormats; * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
namespace OpenRA.Traits * see COPYING.
{ */
public class SubCellInit : IActorInit<SubCell> #endregion
{
[FieldFromYamlKey] using System;
public readonly int value = 0; using System.Collections.Generic;
using System.Linq;
public SubCellInit() { } using System.Text;
using OpenRA.FileFormats;
public SubCellInit(int init)
{ namespace OpenRA.Traits
value = init; {
} public class SubCellInit : IActorInit<SubCell>
{
public SubCell Value(World world) [FieldFromYamlKey]
{ public readonly int value = 0;
return (SubCell)value;
} public SubCellInit() { }
}
} public SubCellInit(int init)
{
value = init;
}
public SubCell Value(World world)
{
return (SubCell)value;
}
}
}

View File

@@ -13,236 +13,236 @@ using System.Drawing;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
using System; using System;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
// depends on the order of pips in WorldRenderer.cs! // depends on the order of pips in WorldRenderer.cs!
public enum PipType { Transparent, Green, Yellow, Red, Gray }; public enum PipType { Transparent, Green, Yellow, Red, Gray };
public enum TagType { None, Fake, Primary }; public enum TagType { None, Fake, Primary };
public enum Stance { Enemy, Neutral, Ally }; public enum Stance { Enemy, Neutral, Ally };
public class AttackInfo public class AttackInfo
{ {
public Actor Attacker; public Actor Attacker;
public WarheadInfo Warhead; public WarheadInfo Warhead;
public int Damage; public int Damage;
public DamageState DamageState; public DamageState DamageState;
public DamageState PreviousDamageState; public DamageState PreviousDamageState;
public bool DamageStateChanged; public bool DamageStateChanged;
public int PreviousHealth; public int PreviousHealth;
public int Health; public int Health;
} }
public interface ITick { void Tick(Actor self); } public interface ITick { void Tick(Actor self); }
public interface IRender { IEnumerable<Renderable> Render(Actor self); } public interface IRender { IEnumerable<Renderable> Render(Actor self); }
public interface IIssueOrder public interface IIssueOrder
{ {
IEnumerable<IOrderTargeter> Orders { get; } IEnumerable<IOrderTargeter> Orders { get; }
Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued); Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued);
} }
public interface IOrderTargeter public interface IOrderTargeter
{ {
string OrderID { get; } string OrderID { get; }
int OrderPriority { get; } int OrderPriority { get; }
bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueue, ref string cursor); bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueue, ref string cursor);
bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueue, bool forceMove, ref string cursor); bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueue, bool forceMove, ref string cursor);
bool IsQueued { get; } bool IsQueued { get; }
} }
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); } public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); } public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
public interface IOrderCursor { string CursorForOrder(Actor self, Order order); } public interface IOrderCursor { string CursorForOrder(Actor self, Order order); }
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); } public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
public interface ICustomUnitOrderGenerator : IOrderGenerator { }; public interface ICustomUnitOrderGenerator : IOrderGenerator { };
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); } public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); } public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); } public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
public interface INotifyBuildComplete { void BuildingComplete(Actor self); } public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); } public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); } public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }
public interface INotifyOtherCaptured { void OnActorCaptured(Actor self, Actor captured, Actor captor, Player oldOwner, Player newOwner); } public interface INotifyOtherCaptured { void OnActorCaptured(Actor self, Actor captured, Actor captor, Player oldOwner, Player newOwner); }
public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); } public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
public interface IStoreOre { int Capacity { get; } } public interface IStoreOre { int Capacity { get; } }
public interface IToolTip public interface IToolTip
{ {
string Name(); string Name();
Player Owner(); Player Owner();
Stance Stance(); Stance Stance();
} }
public interface IDisable { bool Disabled { get; } } public interface IDisable { bool Disabled { get; } }
public interface IExplodeModifier { bool ShouldExplode(Actor self); } public interface IExplodeModifier { bool ShouldExplode(Actor self); }
public interface INudge { void OnNudge(Actor self, Actor nudger); } public interface INudge { void OnNudge(Actor self, Actor nudger); }
public interface IRadarSignature public interface IRadarSignature
{ {
IEnumerable<int2> RadarSignatureCells(Actor self); IEnumerable<int2> RadarSignatureCells(Actor self);
Color RadarSignatureColor(Actor self); Color RadarSignatureColor(Actor self);
} }
public interface IVisibilityModifier { bool IsVisible(Actor self); } public interface IVisibilityModifier { bool IsVisible(Actor self); }
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); } public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
public interface IHasLocation public interface IHasLocation
{ {
int2 PxPosition { get; } int2 PxPosition { get; }
} }
public enum SubCell public enum SubCell
{ {
FullCell, FullCell,
TopLeft, TopLeft,
TopRight, TopRight,
Center, Center,
BottomLeft, BottomLeft,
BottomRight BottomRight
} }
public interface IOccupySpace : IHasLocation public interface IOccupySpace : IHasLocation
{ {
int2 TopLeft { get; } int2 TopLeft { get; }
IEnumerable<Pair<int2, SubCell>> OccupiedCells(); IEnumerable<Pair<int2, SubCell>> OccupiedCells();
} }
public static class IOccupySpaceExts public static class IOccupySpaceExts
{ {
public static int2 NearestCellTo(this IOccupySpace ios, int2 other) public static int2 NearestCellTo(this IOccupySpace ios, int2 other)
{ {
var nearest = ios.TopLeft; var nearest = ios.TopLeft;
var nearestDistance = int.MaxValue; var nearestDistance = int.MaxValue;
foreach (var cell in ios.OccupiedCells()) foreach (var cell in ios.OccupiedCells())
{ {
var dist = (other - cell.First).LengthSquared; var dist = (other - cell.First).LengthSquared;
if (dist < nearestDistance) if (dist < nearestDistance)
{ {
nearest = cell.First; nearest = cell.First;
nearestDistance = dist; nearestDistance = dist;
} }
} }
return nearest; return nearest;
} }
} }
public interface INotifyAttack { void Attacking(Actor self, Target target); } public interface INotifyAttack { void Attacking(Actor self, Target target); }
public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); } public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); }
public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); } public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
public interface ISpeedModifier { decimal GetSpeedModifier(); } public interface ISpeedModifier { decimal GetSpeedModifier(); }
public interface IFirepowerModifier { float GetFirepowerModifier(); } public interface IFirepowerModifier { float GetFirepowerModifier(); }
public interface ISelectionColorModifier { Color GetSelectionColorModifier(Actor self, Color defaultColor); } public interface ISelectionColorModifier { Color GetSelectionColorModifier(Actor self, Color defaultColor); }
public interface IPalette { void InitPalette(WorldRenderer wr); } public interface IPalette { void InitPalette(WorldRenderer wr); }
public interface IPaletteModifier { void AdjustPalette(Dictionary<string, Palette> b); } public interface IPaletteModifier { void AdjustPalette(Dictionary<string, Palette> b); }
public interface IPips { IEnumerable<PipType> GetPips(Actor self); } public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
public interface ITags { IEnumerable<TagType> GetTags(); } public interface ITags { IEnumerable<TagType> GetTags(); }
public interface ISelectionBar { float GetValue(); Color GetColor(); } public interface ISelectionBar { float GetValue(); Color GetColor(); }
public interface ITeleportable : IHasLocation /* crap name! */ public interface ITeleportable : IHasLocation /* crap name! */
{ {
bool CanEnterCell(int2 location); bool CanEnterCell(int2 location);
void SetPosition(Actor self, int2 cell); void SetPosition(Actor self, int2 cell);
void SetPxPosition(Actor self, int2 px); void SetPxPosition(Actor self, int2 px);
void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */ void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */
} }
public interface IMove : ITeleportable public interface IMove : ITeleportable
{ {
int Altitude { get; set; } int Altitude { get; set; }
} }
public interface IFacing public interface IFacing
{ {
int ROT { get; } int ROT { get; }
int Facing { get; set; } int Facing { get; set; }
int InitialFacing { get; } int InitialFacing { get; }
} }
public interface ICrushable public interface ICrushable
{ {
void OnCrush(Actor crusher); void OnCrush(Actor crusher);
IEnumerable<string> CrushClasses { get; } IEnumerable<string> CrushClasses { get; }
} }
public struct Renderable public struct Renderable
{ {
public readonly Sprite Sprite; public readonly Sprite Sprite;
public readonly float2 Pos; public readonly float2 Pos;
public readonly string Palette; public readonly string Palette;
public readonly int Z; public readonly int Z;
public readonly int ZOffset; public readonly int ZOffset;
public float Scale; public float Scale;
public Renderable(Sprite sprite, float2 pos, string palette, int z, int zOffset, float scale) public Renderable(Sprite sprite, float2 pos, string palette, int z, int zOffset, float scale)
{ {
Sprite = sprite; Sprite = sprite;
Pos = pos; Pos = pos;
Palette = palette; Palette = palette;
Z = z; Z = z;
ZOffset = zOffset; ZOffset = zOffset;
Scale = scale; /* default */ Scale = scale; /* default */
} }
public Renderable(Sprite sprite, float2 pos, string palette, int z) public Renderable(Sprite sprite, float2 pos, string palette, int z)
: this(sprite, pos, palette, z, 0, 1f) { } : this(sprite, pos, palette, z, 0, 1f) { }
public Renderable(Sprite sprite, float2 pos, string palette, int z, float scale) public Renderable(Sprite sprite, float2 pos, string palette, int z, float scale)
: this(sprite, pos, palette, z, 0, scale) { } : this(sprite, pos, palette, z, 0, scale) { }
public Renderable WithScale(float newScale) { return new Renderable(Sprite, Pos, Palette, Z, ZOffset, newScale); } public Renderable WithScale(float newScale) { return new Renderable(Sprite, Pos, Palette, Z, ZOffset, newScale); }
public Renderable WithPalette(string newPalette) { return new Renderable(Sprite, Pos, newPalette, Z, ZOffset, Scale); } public Renderable WithPalette(string newPalette) { return new Renderable(Sprite, Pos, newPalette, Z, ZOffset, Scale); }
public Renderable WithZOffset(int newOffset) { return new Renderable(Sprite, Pos, Palette, Z, newOffset, Scale); } public Renderable WithZOffset(int newOffset) { return new Renderable(Sprite, Pos, Palette, Z, newOffset, Scale); }
public Renderable WithPos(float2 newPos) { return new Renderable(Sprite, newPos, Palette, Z, ZOffset, Scale); } public Renderable WithPos(float2 newPos) { return new Renderable(Sprite, newPos, Palette, Z, ZOffset, Scale); }
} }
public interface ITraitInfo { object Create(ActorInitializer init); } public interface ITraitInfo { object Create(ActorInitializer init); }
public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } } public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } }
public interface ITraitPrerequisite<T> where T : ITraitInfo { } public interface ITraitPrerequisite<T> where T : ITraitInfo { }
public interface INotifySelection { void SelectionChanged(); } public interface INotifySelection { void SelectionChanged(); }
public interface IWorldLoaded { void WorldLoaded(World w); } public interface IWorldLoaded { void WorldLoaded(World w); }
public interface ICreatePlayers { void CreatePlayers(World w); } public interface ICreatePlayers { void CreatePlayers(World w); }
public interface IBotInfo { string Name { get; } } public interface IBotInfo { string Name { get; } }
public interface IBot public interface IBot
{ {
void Activate(Player p); void Activate(Player p);
IBotInfo Info { get; } IBotInfo Info { get; }
} }
public interface IActivity public interface IActivity
{ {
IActivity Tick(Actor self); IActivity Tick(Actor self);
void Cancel(Actor self); void Cancel(Actor self);
void Queue(IActivity activity); void Queue(IActivity activity);
IEnumerable<float2> GetCurrentPath(); IEnumerable<float2> GetCurrentPath();
} }
public interface IRenderOverlay { void Render(WorldRenderer wr); } public interface IRenderOverlay { void Render(WorldRenderer wr); }
public interface INotifyIdle { void TickIdle(Actor self); } public interface INotifyIdle { void TickIdle(Actor self); }
public interface IBlocksBullets { } public interface IBlocksBullets { }
public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); } public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); }
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr, Actor self); } public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr, Actor self); }
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); } public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
public interface IRenderAsTerrain { IEnumerable<Renderable> RenderAsTerrain(Actor self); } public interface IRenderAsTerrain { IEnumerable<Renderable> RenderAsTerrain(Actor self); }
public interface ITargetable public interface ITargetable
{ {
string[] TargetTypes { get; } string[] TargetTypes { get; }
IEnumerable<int2> TargetableCells(Actor self); IEnumerable<int2> TargetableCells(Actor self);
bool TargetableBy(Actor self, Actor byActor); bool TargetableBy(Actor self, Actor byActor);
} }
public interface INotifyStanceChanged public interface INotifyStanceChanged
{ {
void StanceChanged(Actor self, Player a, Player b, void StanceChanged(Actor self, Player a, Player b,
Stance oldStance, Stance newStance); Stance oldStance, Stance newStance);
} }
public interface ILintPass { void Run(Action<string> emitError); } public interface ILintPass { void Run(Action<string> emitError); }
} }

View File

@@ -9,9 +9,9 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA namespace OpenRA
{ {
public class UiOverlay public class UiOverlay

View File

@@ -13,369 +13,369 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Widgets namespace OpenRA.Widgets
{ {
public abstract class Widget public abstract class Widget
{ {
// Info defined in YAML // Info defined in YAML
public string Id = null; public string Id = null;
public string X = "0"; public string X = "0";
public string Y = "0"; public string Y = "0";
public string Width = "0"; public string Width = "0";
public string Height = "0"; public string Height = "0";
public string Delegate = null; public string Delegate = null;
public string EventHandler = null; public string EventHandler = null;
public bool Visible = true; public bool Visible = true;
public readonly List<Widget> Children = new List<Widget>(); public readonly List<Widget> Children = new List<Widget>();
// Calculated internally // Calculated internally
public Rectangle Bounds; public Rectangle Bounds;
public Widget Parent = null; public Widget Parent = null;
public static Stack<Widget> WindowList = new Stack<Widget>(); public static Stack<Widget> WindowList = new Stack<Widget>();
// Common Funcs that most widgets will want // Common Funcs that most widgets will want
public Func<MouseInput, bool> OnMouseDown = mi => false; public Func<MouseInput, bool> OnMouseDown = mi => false;
public Func<MouseInput, bool> OnMouseUp = mi => false; public Func<MouseInput, bool> OnMouseUp = mi => false;
public Action<MouseInput> OnMouseMove = mi => { }; public Action<MouseInput> OnMouseMove = mi => { };
public Func<KeyInput, bool> OnKeyPress = e => false; public Func<KeyInput, bool> OnKeyPress = e => false;
public Func<bool> IsVisible; public Func<bool> IsVisible;
public Widget() { IsVisible = () => Visible; } public Widget() { IsVisible = () => Visible; }
public static Widget RootWidget public static Widget RootWidget
{ {
get { return rootWidget; } get { return rootWidget; }
set { rootWidget = value; } set { rootWidget = value; }
} }
private static Widget rootWidget = new ContainerWidget(); private static Widget rootWidget = new ContainerWidget();
public Widget(Widget widget) public Widget(Widget widget)
{ {
Id = widget.Id; Id = widget.Id;
X = widget.X; X = widget.X;
Y = widget.Y; Y = widget.Y;
Width = widget.Width; Width = widget.Width;
Height = widget.Height; Height = widget.Height;
Delegate = widget.Delegate; Delegate = widget.Delegate;
Visible = widget.Visible; Visible = widget.Visible;
Bounds = widget.Bounds; Bounds = widget.Bounds;
Parent = widget.Parent; Parent = widget.Parent;
OnMouseDown = widget.OnMouseDown; OnMouseDown = widget.OnMouseDown;
OnMouseUp = widget.OnMouseUp; OnMouseUp = widget.OnMouseUp;
OnMouseMove = widget.OnMouseMove; OnMouseMove = widget.OnMouseMove;
OnKeyPress = widget.OnKeyPress; OnKeyPress = widget.OnKeyPress;
IsVisible = widget.IsVisible; IsVisible = widget.IsVisible;
foreach (var child in widget.Children) foreach (var child in widget.Children)
AddChild(child.Clone()); AddChild(child.Clone());
} }
public virtual Widget Clone() public virtual Widget Clone()
{ {
throw new InvalidOperationException("Widget type `{0}` is not cloneable.".F(GetType().Name)); throw new InvalidOperationException("Widget type `{0}` is not cloneable.".F(GetType().Name));
} }
public virtual int2 RenderOrigin public virtual int2 RenderOrigin
{ {
get get
{ {
var offset = (Parent == null) ? int2.Zero : Parent.ChildOrigin; var offset = (Parent == null) ? int2.Zero : Parent.ChildOrigin;
return new int2(Bounds.X, Bounds.Y) + offset; return new int2(Bounds.X, Bounds.Y) + offset;
} }
} }
public virtual int2 ChildOrigin { get { return RenderOrigin; } } public virtual int2 ChildOrigin { get { return RenderOrigin; } }
public virtual Rectangle RenderBounds { get { return new Rectangle(RenderOrigin.X, RenderOrigin.Y, Bounds.Width, Bounds.Height); } } public virtual Rectangle RenderBounds { get { return new Rectangle(RenderOrigin.X, RenderOrigin.Y, Bounds.Width, Bounds.Height); } }
public virtual void Initialize() public virtual void Initialize()
{ {
// Parse the YAML equations to find the widget bounds // Parse the YAML equations to find the widget bounds
var parentBounds = (Parent == null) var parentBounds = (Parent == null)
? new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height) ? new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height)
: Parent.Bounds; : Parent.Bounds;
var substitutions = new Dictionary<string, int>(); var substitutions = new Dictionary<string, int>();
substitutions.Add("WINDOW_RIGHT", Game.viewport.Width); substitutions.Add("WINDOW_RIGHT", Game.viewport.Width);
substitutions.Add("WINDOW_BOTTOM", Game.viewport.Height); substitutions.Add("WINDOW_BOTTOM", Game.viewport.Height);
substitutions.Add("PARENT_RIGHT", parentBounds.Width); substitutions.Add("PARENT_RIGHT", parentBounds.Width);
substitutions.Add("PARENT_LEFT", parentBounds.Left); substitutions.Add("PARENT_LEFT", parentBounds.Left);
substitutions.Add("PARENT_TOP", parentBounds.Top); substitutions.Add("PARENT_TOP", parentBounds.Top);
substitutions.Add("PARENT_BOTTOM", parentBounds.Height); substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
int width = Evaluator.Evaluate(Width, substitutions); int width = Evaluator.Evaluate(Width, substitutions);
int height = Evaluator.Evaluate(Height, substitutions); int height = Evaluator.Evaluate(Height, substitutions);
substitutions.Add("WIDTH", width); substitutions.Add("WIDTH", width);
substitutions.Add("HEIGHT", height); substitutions.Add("HEIGHT", height);
Bounds = new Rectangle(Evaluator.Evaluate(X, substitutions), Bounds = new Rectangle(Evaluator.Evaluate(X, substitutions),
Evaluator.Evaluate(Y, substitutions), Evaluator.Evaluate(Y, substitutions),
width, width,
height); height);
} }
public void PostInit(Dictionary<string, object> args) public void PostInit(Dictionary<string, object> args)
{ {
if (Delegate == null) if (Delegate == null)
return; return;
args["widget"] = this; args["widget"] = this;
var iwd = Game.modData.ObjectCreator.CreateObject<IWidgetDelegate>(Delegate, args) var iwd = Game.modData.ObjectCreator.CreateObject<IWidgetDelegate>(Delegate, args)
as IWidgetDelegateEx; as IWidgetDelegateEx;
if (iwd != null) if (iwd != null)
iwd.Init(); iwd.Init();
args.Remove("widget"); args.Remove("widget");
} }
public virtual Rectangle EventBounds { get { return RenderBounds; } } public virtual Rectangle EventBounds { get { return RenderBounds; } }
public virtual Rectangle GetEventBounds() public virtual Rectangle GetEventBounds()
{ {
return Children return Children
.Where(c => c.IsVisible()) .Where(c => c.IsVisible())
.Select(c => c.GetEventBounds()) .Select(c => c.GetEventBounds())
.Aggregate(EventBounds, Rectangle.Union); .Aggregate(EventBounds, Rectangle.Union);
} }
public static Widget SelectedWidget; public static Widget SelectedWidget;
public bool Focused { get { return SelectedWidget == this; } } public bool Focused { get { return SelectedWidget == this; } }
public virtual bool TakeFocus(MouseInput mi) public virtual bool TakeFocus(MouseInput mi)
{ {
if (Focused) if (Focused)
return true; return true;
if (SelectedWidget != null && !SelectedWidget.LoseFocus(mi)) if (SelectedWidget != null && !SelectedWidget.LoseFocus(mi))
return false; return false;
SelectedWidget = this; SelectedWidget = this;
return true; return true;
} }
// Remove focus from this widget; return false if you don't want to give it up // Remove focus from this widget; return false if you don't want to give it up
public virtual bool LoseFocus(MouseInput mi) public virtual bool LoseFocus(MouseInput mi)
{ {
// Some widgets may need to override focus depending on mouse click // Some widgets may need to override focus depending on mouse click
return LoseFocus(); return LoseFocus();
} }
public virtual bool LoseFocus() public virtual bool LoseFocus()
{ {
if (SelectedWidget == this) if (SelectedWidget == this)
SelectedWidget = null; SelectedWidget = null;
return true; return true;
} }
public virtual string GetCursor(int2 pos) { return "default"; } public virtual string GetCursor(int2 pos) { return "default"; }
public string GetCursorOuter(int2 pos) public string GetCursorOuter(int2 pos)
{ {
// Is the cursor on top of us? // Is the cursor on top of us?
if (!(IsVisible() && GetEventBounds().Contains(pos))) if (!(IsVisible() && GetEventBounds().Contains(pos)))
return null; return null;
// Do any of our children specify a cursor? // Do any of our children specify a cursor?
foreach (var child in Children.OfType<Widget>().Reverse()) foreach (var child in Children.OfType<Widget>().Reverse())
{ {
var cc = child.GetCursorOuter(pos); var cc = child.GetCursorOuter(pos);
if (cc != null) if (cc != null)
return cc; return cc;
} }
return EventBounds.Contains(pos) ? GetCursor(pos) : null; return EventBounds.Contains(pos) ? GetCursor(pos) : null;
} }
public static bool HandleInput(MouseInput mi) public static bool HandleInput(MouseInput mi)
{ {
bool handled = false; bool handled = false;
if (SelectedWidget != null && SelectedWidget.HandleMouseInputOuter(mi)) if (SelectedWidget != null && SelectedWidget.HandleMouseInputOuter(mi))
handled = true; handled = true;
if (!handled && RootWidget.HandleMouseInputOuter(mi)) if (!handled && RootWidget.HandleMouseInputOuter(mi))
handled = true; handled = true;
if (mi.Event == MouseInputEvent.Move) if (mi.Event == MouseInputEvent.Move)
{ {
Viewport.LastMousePos = mi.Location; Viewport.LastMousePos = mi.Location;
Viewport.TicksSinceLastMove = 0; Viewport.TicksSinceLastMove = 0;
} }
return handled; return handled;
} }
public bool HandleMouseInputOuter(MouseInput mi) public bool HandleMouseInputOuter(MouseInput mi)
{ {
// Are we able to handle this event? // Are we able to handle this event?
if (!(Focused || (IsVisible() && GetEventBounds().Contains(mi.Location.X, mi.Location.Y)))) if (!(Focused || (IsVisible() && GetEventBounds().Contains(mi.Location.X, mi.Location.Y))))
return false; return false;
// Send the event to the deepest children first and bubble up if unhandled // Send the event to the deepest children first and bubble up if unhandled
foreach (var child in Children.OfType<Widget>().Reverse()) foreach (var child in Children.OfType<Widget>().Reverse())
if (child.HandleMouseInputOuter(mi)) if (child.HandleMouseInputOuter(mi))
return true; return true;
return HandleMouseInput(mi); return HandleMouseInput(mi);
} }
// Hack: Don't eat mouse input that others want // Hack: Don't eat mouse input that others want
// TODO: Solve this properly // TODO: Solve this properly
public virtual bool HandleMouseInput(MouseInput mi) public virtual bool HandleMouseInput(MouseInput mi)
{ {
// Apply any special logic added by delegates; they return true if they caught the input // Apply any special logic added by delegates; they return true if they caught the input
if (mi.Event == MouseInputEvent.Down && OnMouseDown(mi)) return true; if (mi.Event == MouseInputEvent.Down && OnMouseDown(mi)) return true;
if (mi.Event == MouseInputEvent.Up && OnMouseUp(mi)) return true; if (mi.Event == MouseInputEvent.Up && OnMouseUp(mi)) return true;
if (mi.Event == MouseInputEvent.Move) if (mi.Event == MouseInputEvent.Move)
OnMouseMove(mi); OnMouseMove(mi);
return false; return false;
} }
public virtual bool HandleKeyPressInner(KeyInput e) { return false; } public virtual bool HandleKeyPressInner(KeyInput e) { return false; }
public virtual bool HandleKeyPressOuter(KeyInput e) public virtual bool HandleKeyPressOuter(KeyInput e)
{ {
if (!IsVisible()) if (!IsVisible())
return false; return false;
// Can any of our children handle this? // Can any of our children handle this?
foreach (var child in Children) foreach (var child in Children)
if (child.HandleKeyPressOuter(e)) if (child.HandleKeyPressOuter(e))
return true; return true;
// Do any widgety behavior (enter text etc) // Do any widgety behavior (enter text etc)
var handled = HandleKeyPressInner(e); var handled = HandleKeyPressInner(e);
// Apply any special logic added by delegates; they return true if they caught the input // Apply any special logic added by delegates; they return true if they caught the input
if (OnKeyPress(e)) return true; if (OnKeyPress(e)) return true;
return handled; return handled;
} }
public static bool HandleKeyPress(KeyInput e) public static bool HandleKeyPress(KeyInput e)
{ {
if (SelectedWidget != null) if (SelectedWidget != null)
return SelectedWidget.HandleKeyPressOuter(e); return SelectedWidget.HandleKeyPressOuter(e);
if (RootWidget.HandleKeyPressOuter(e)) if (RootWidget.HandleKeyPressOuter(e))
return true; return true;
return false; return false;
} }
public abstract void DrawInner(); public abstract void DrawInner();
public virtual void Draw() public virtual void Draw()
{ {
if (IsVisible()) if (IsVisible())
{ {
DrawInner(); DrawInner();
foreach (var child in Children) foreach (var child in Children)
child.Draw(); child.Draw();
} }
} }
public virtual void Tick() public virtual void Tick()
{ {
if (IsVisible()) if (IsVisible())
foreach (var child in Children) foreach (var child in Children)
child.Tick(); child.Tick();
} }
public virtual void AddChild(Widget child) public virtual void AddChild(Widget child)
{ {
child.Parent = this; child.Parent = this;
Children.Add(child); Children.Add(child);
} }
public virtual void RemoveChild(Widget child) { Children.Remove(child); } public virtual void RemoveChild(Widget child) { Children.Remove(child); }
public virtual void RemoveChildren() { Children.Clear(); } public virtual void RemoveChildren() { Children.Clear(); }
public Widget GetWidget(string id) public Widget GetWidget(string id)
{ {
if (this.Id == id) if (this.Id == id)
return this; return this;
foreach (var child in Children) foreach (var child in Children)
{ {
var w = child.GetWidget(id); var w = child.GetWidget(id);
if (w != null) if (w != null)
return w; return w;
} }
return null; return null;
} }
public T GetWidget<T>(string id) where T : Widget public T GetWidget<T>(string id) where T : Widget
{ {
var widget = GetWidget(id); var widget = GetWidget(id);
return (widget != null) ? (T)widget : null; return (widget != null) ? (T)widget : null;
} }
public static void CloseWindow() public static void CloseWindow()
{ {
RootWidget.Children.Remove(WindowList.Pop()); RootWidget.Children.Remove(WindowList.Pop());
if (WindowList.Count > 0) if (WindowList.Count > 0)
rootWidget.Children.Add(WindowList.Peek()); rootWidget.Children.Add(WindowList.Peek());
} }
public static Widget OpenWindow(string id) public static Widget OpenWindow(string id)
{ {
return OpenWindow(id, new Dictionary<string, object>()); return OpenWindow(id, new Dictionary<string, object>());
} }
public static Widget OpenWindow(string id, Dictionary<string, object> args) public static Widget OpenWindow(string id, Dictionary<string, object> args)
{ {
var window = Game.modData.WidgetLoader.LoadWidget(args, rootWidget, id); var window = Game.modData.WidgetLoader.LoadWidget(args, rootWidget, id);
if (WindowList.Count > 0) if (WindowList.Count > 0)
rootWidget.Children.Remove(WindowList.Peek()); rootWidget.Children.Remove(WindowList.Peek());
WindowList.Push(window); WindowList.Push(window);
return window; return window;
} }
public static void DoTick() public static void DoTick()
{ {
RootWidget.Tick(); RootWidget.Tick();
} }
public static void DoDraw() public static void DoDraw()
{ {
RootWidget.Draw(); RootWidget.Draw();
} }
} }
public class ContainerWidget : Widget public class ContainerWidget : Widget
{ {
public Func<string> GetBackground; public Func<string> GetBackground;
public string Background = null; public string Background = null;
public ContainerWidget() public ContainerWidget()
: base() : base()
{ {
GetBackground = () => Background; GetBackground = () => Background;
} }
public ContainerWidget(ContainerWidget other) public ContainerWidget(ContainerWidget other)
: base(other) : base(other)
{ {
Background = other.Background; Background = other.Background;
GetBackground = other.GetBackground; GetBackground = other.GetBackground;
} }
public override void DrawInner() public override void DrawInner()
{ {
var bg = GetBackground(); var bg = GetBackground();
if (bg != null) if (bg != null)
WidgetUtils.DrawPanel(bg, RenderBounds); WidgetUtils.DrawPanel(bg, RenderBounds);
} }
public override string GetCursor(int2 pos) { return null; } public override string GetCursor(int2 pos) { return null; }
public override Widget Clone() { return new ContainerWidget(this); } public override Widget Clone() { return new ContainerWidget(this); }
} }
public interface IWidgetDelegate { } public interface IWidgetDelegate { }
public interface IWidgetDelegateEx : IWidgetDelegate public interface IWidgetDelegateEx : IWidgetDelegate
{ {
void Init(); void Init();
} }
} }

View File

@@ -31,13 +31,13 @@ namespace OpenRA.Widgets
public override void DrawInner() public override void DrawInner()
{ {
var selbox = SelectionBox; var selbox = SelectionBox;
if (selbox == null) if (selbox == null)
{ {
foreach (var u in SelectActorsInBox(world, Game.CellSize * dragStart, Game.CellSize * dragStart)) foreach (var u in SelectActorsInBox(world, Game.CellSize * dragStart, Game.CellSize * dragStart))
worldRenderer.DrawRollover(u); worldRenderer.DrawRollover(u);
return; return;
} }
var a = selbox.Value.First; var a = selbox.Value.First;
@@ -47,9 +47,9 @@ namespace OpenRA.Widgets
Game.Renderer.LineRenderer.DrawLine(a, a + b, Color.White, Color.White); Game.Renderer.LineRenderer.DrawLine(a, a + b, Color.White, Color.White);
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, Color.White, Color.White); Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, Color.White, Color.White);
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, Color.White, Color.White); Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, Color.White, Color.White);
Game.Renderer.LineRenderer.DrawLine(a, a + c, Color.White, Color.White); Game.Renderer.LineRenderer.DrawLine(a, a + c, Color.White, Color.White);
foreach (var u in SelectActorsInBox(world, selbox.Value.First, selbox.Value.Second)) foreach (var u in SelectActorsInBox(world, selbox.Value.First, selbox.Value.Second))
worldRenderer.DrawRollover(u); worldRenderer.DrawRollover(u);
} }
@@ -102,8 +102,8 @@ namespace OpenRA.Widgets
if (world.OrderGenerator == null) return; if (world.OrderGenerator == null) return;
var orders = world.OrderGenerator.Order(world, xy.ToInt2(), mi).ToArray(); var orders = world.OrderGenerator.Order(world, xy.ToInt2(), mi).ToArray();
orders.Do( o => world.IssueOrder( o ) ); orders.Do( o => world.IssueOrder( o ) );
world.PlayVoiceForOrders(orders); world.PlayVoiceForOrders(orders);
} }

View File

@@ -15,7 +15,7 @@ using OpenRA.Effects;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Orders; using OpenRA.Orders;
using OpenRA.Traits; using OpenRA.Traits;
using XRandom = OpenRA.Thirdparty.Random; using XRandom = OpenRA.Thirdparty.Random;
namespace OpenRA namespace OpenRA
@@ -200,11 +200,11 @@ namespace OpenRA
return ret; return ret;
} }
} }
public IEnumerable<TraitPair<T>> ActorsWithTrait<T>() public IEnumerable<TraitPair<T>> ActorsWithTrait<T>()
{ {
return traitDict.ActorsWithTraitMultiple<T>(this); return traitDict.ActorsWithTraitMultiple<T>(this);
} }
} }

View File

@@ -6,15 +6,15 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Support; using OpenRA.Support;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA namespace OpenRA
@@ -125,33 +125,33 @@ namespace OpenRA
if (!a.Info.Traits.Contains<SelectableInfo>()) return null; if (!a.Info.Traits.Contains<SelectableInfo>()) return null;
var v = a.Info.Traits.Get<SelectableInfo>().Voice; var v = a.Info.Traits.Get<SelectableInfo>().Voice;
return (v == null) ? null : Rules.Voices[v]; return (v == null) ? null : Rules.Voices[v];
} }
public static void PlayVoiceForOrders(this World w, Order[] orders) public static void PlayVoiceForOrders(this World w, Order[] orders)
{ {
// Find an actor with a phrase to say // Find an actor with a phrase to say
foreach (var o in orders) foreach (var o in orders)
{ {
if (o.Subject.Destroyed) continue; if (o.Subject.Destroyed) continue;
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>()) foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o), if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o),
o.Subject, o.Subject.Owner.Country.Race)) o.Subject, o.Subject.Owner.Country.Race))
return; return;
} }
} }
public static void DoTimed<T>(this IEnumerable<T> e, Action<T> a, string text, double time) public static void DoTimed<T>(this IEnumerable<T> e, Action<T> a, string text, double time)
{ {
var sw = new Stopwatch(); var sw = new Stopwatch();
e.Do(x => e.Do(x =>
{ {
var t = sw.ElapsedTime(); var t = sw.ElapsedTime();
a(x); a(x);
var dt = sw.ElapsedTime() - t; var dt = sw.ElapsedTime() - t;
if (dt > time) if (dt > time)
Log.Write("perf", text, x, dt * 1000, Game.LocalTick); Log.Write("perf", text, x, dt * 1000, Game.LocalTick);
}); });
} }
} }
} }

View File

@@ -6,17 +6,17 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System; using System;
using System.Linq; using System.Linq;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.RA; using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Mods.RA.Render; using OpenRA.Mods.RA.Render;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Traits.Activities; using OpenRA.Traits.Activities;
namespace OpenRA.Mods.Cnc namespace OpenRA.Mods.Cnc
@@ -48,14 +48,14 @@ namespace OpenRA.Mods.Cnc
public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info) : base(init.self) public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info) : base(init.self)
{ {
Info = info; Info = info;
Turret = init.self.Trait<Turreted>(); Turret = init.self.Trait<Turreted>();
if (init.Contains<SkipMakeAnimsInit>()) if (init.Contains<SkipMakeAnimsInit>())
{ {
State = PopupState.Closed; State = PopupState.Closed;
init.self.Trait<RenderBuilding>() init.self.Trait<RenderBuilding>()
.PlayCustomAnimRepeating(init.self, "closed-idle"); .PlayCustomAnimRepeating(init.self, "closed-idle");
Turret.desiredFacing = null; Turret.desiredFacing = null;
buildComplete = true; buildComplete = true;
} }
} }

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Cnc
}); });
} }
// GoodGuy win conditions // GoodGuy win conditions
// BadGuy is dead // BadGuy is dead
var badcount = self.World.Actors.Count(a => a.Owner == Players["BadGuy"] && !a.IsDead()); var badcount = self.World.Actors.Count(a => a.Owner == Players["BadGuy"] && !a.IsDead());
if (badcount != lastBadCount) if (badcount != lastBadCount)
{ {
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Cnc
OnVictory(self.World); OnVictory(self.World);
} }
//GoodGuy lose conditions //GoodGuy lose conditions
var goodCount = self.World.Actors.Count(a => a.Owner == Players["GoodGuy"] && !a.IsDead()); var goodCount = self.World.Actors.Count(a => a.Owner == Players["GoodGuy"] && !a.IsDead());
if (goodCount == 0) if (goodCount == 0)
OnLose(self.World); OnLose(self.World);

View File

@@ -1,36 +1,46 @@
using System.Reflection; #region Copyright & License Information
using System.Runtime.CompilerServices; /*
using System.Runtime.InteropServices; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
// General Information about an assembly is controlled through the following * available to you under the terms of the GNU General Public License
// set of attributes. Change these attribute values to modify the information * as published by the Free Software Foundation. For more information,
// associated with an assembly. * see COPYING.
[assembly: AssemblyTitle("OpenRA.Mods.Cnc")] */
[assembly: AssemblyDescription("")] #endregion
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] using System.Reflection;
[assembly: AssemblyProduct("OpenRA.Mods.Cnc")] using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Copyright © 2010")] using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// Setting ComVisible to false makes the types in this assembly not visible // associated with an assembly.
// to COM components. If you need to access a type in this assembly from [assembly: AssemblyTitle("OpenRA.Mods.Cnc")]
// COM, set the ComVisible attribute to true on that type. [assembly: AssemblyDescription("")]
[assembly: ComVisible(false)] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
// The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: AssemblyProduct("OpenRA.Mods.Cnc")]
[assembly: Guid("3b31edcf-34e4-4a58-8130-88b15b046d10")] [assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values: [assembly: AssemblyCulture("")]
//
// Major Version // Setting ComVisible to false makes the types in this assembly not visible
// Minor Version // to COM components. If you need to access a type in this assembly from
// Build Number // COM, set the ComVisible attribute to true on that type.
// Revision [assembly: ComVisible(false)]
//
// You can specify all the values or you can default the Build and Revision Numbers // The following GUID is for the ID of the typelib if this project is exposed to COM
// by using the '*' as shown below: [assembly: Guid("3b31edcf-34e4-4a58-8130-88b15b046d10")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] // Version information for an assembly consists of the following four values:
[assembly: AssemblyFileVersion("1.0.0.0")] //
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -66,11 +66,11 @@ namespace OpenRA.Mods.RA.Activities
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (actor.Destroyed) return; if (actor.Destroyed) return;
var mobile = actor.Trait<Mobile>(); var mobile = actor.Trait<Mobile>();
mobile.SetPosition(actor, self.Location); mobile.SetPosition(actor, self.Location);
w.Add(actor); w.Add(actor);
actor.CancelActivity(); actor.CancelActivity();
actor.QueueActivity(mobile.MoveTo(exitTile.Value, 0)); actor.QueueActivity(mobile.MoveTo(exitTile.Value, 0));

View File

@@ -1,43 +1,43 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Traits.Activities; using OpenRA.Traits.Activities;
namespace OpenRA.Mods.RA.Air namespace OpenRA.Mods.RA.Air
{ {
public class FlyCircle : CancelableActivity public class FlyCircle : CancelableActivity
{ {
public override IActivity Tick(Actor self) public override IActivity Tick(Actor self)
{ {
var cruiseAltitude = self.Info.Traits.Get<PlaneInfo>().CruiseAltitude; var cruiseAltitude = self.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
if (IsCanceled) return NextActivity; if (IsCanceled) return NextActivity;
var aircraft = self.Trait<Aircraft>(); var aircraft = self.Trait<Aircraft>();
var desiredFacing = aircraft.Facing + 64; // we can't possibly turn this fast. var desiredFacing = aircraft.Facing + 64; // we can't possibly turn this fast.
if (aircraft.Altitude == cruiseAltitude) if (aircraft.Altitude == cruiseAltitude)
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT); aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
if (aircraft.Altitude < cruiseAltitude) if (aircraft.Altitude < cruiseAltitude)
++aircraft.Altitude; ++aircraft.Altitude;
FlyUtil.Fly(self, cruiseAltitude); FlyUtil.Fly(self, cruiseAltitude);
return this; return this;
} }
public override IEnumerable<float2> GetCurrentPath() public override IEnumerable<float2> GetCurrentPath()
{ {
yield break; yield break;
} }
} }
} }

View File

@@ -6,11 +6,11 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Orders; using OpenRA.Mods.RA.Orders;
@@ -40,13 +40,13 @@ namespace OpenRA.Mods.RA.Air
{ {
/* not spawning in the air, so try to assoc. with our afld. this is a hack. */ /* not spawning in the air, so try to assoc. with our afld. this is a hack. */
var afld = self.World.FindUnits(self.CenterLocation, self.CenterLocation) var afld = self.World.FindUnits(self.CenterLocation, self.CenterLocation)
.FirstOrDefault( a => a.HasTrait<Reservable>() ); .FirstOrDefault( a => a.HasTrait<Reservable>() );
if (afld != null) if (afld != null)
{ {
var res = afld.Trait<Reservable>(); var res = afld.Trait<Reservable>();
if (res != null) if (res != null)
reservation = res.Reserve(afld, self, this); reservation = res.Reserve(afld, self, this);
} }
} }
} }
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.RA.Air
var target = self.World.ClampToWorld(order.TargetLocation); var target = self.World.ClampToWorld(order.TargetLocation);
self.SetTargetLine(Target.FromCell(target), Color.Green); self.SetTargetLine(Target.FromCell(target), Color.Green);
self.CancelActivity(); self.CancelActivity();
self.QueueActivity(Fly.ToCell(target)); self.QueueActivity(Fly.ToCell(target));
self.QueueActivity(new FlyCircle()); self.QueueActivity(new FlyCircle());
} }

View File

@@ -6,11 +6,11 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Air namespace OpenRA.Mods.RA.Air
@@ -33,29 +33,29 @@ namespace OpenRA.Mods.RA.Air
self.QueueActivity(new Rearm()); self.QueueActivity(new Rearm());
} }
else else
{ {
// nowhere to land, pick something friendly and circle over it. // nowhere to land, pick something friendly and circle over it.
// i'd prefer something we own // i'd prefer something we own
var someBuilding = self.World.ActorsWithTrait<Building>() var someBuilding = self.World.ActorsWithTrait<Building>()
.Select( a => a.Actor ) .Select( a => a.Actor )
.FirstOrDefault(a => a.Owner == self.Owner); .FirstOrDefault(a => a.Owner == self.Owner);
// failing that, something unlikely to shoot at us // failing that, something unlikely to shoot at us
if (someBuilding == null) if (someBuilding == null)
someBuilding = self.World.ActorsWithTrait<Building>() someBuilding = self.World.ActorsWithTrait<Building>()
.Select( a => a.Actor ) .Select( a => a.Actor )
.FirstOrDefault(a => self.Owner.Stances[a.Owner] == Stance.Ally); .FirstOrDefault(a => self.Owner.Stances[a.Owner] == Stance.Ally);
if (someBuilding == null) if (someBuilding == null)
{ {
// ... going down the garden to eat worms ... // ... going down the garden to eat worms ...
self.QueueActivity(new FlyOffMap()); self.QueueActivity(new FlyOffMap());
self.QueueActivity(new RemoveSelf()); self.QueueActivity(new RemoveSelf());
return; return;
} }
self.QueueActivity(Fly.ToCell(someBuilding.Location)); self.QueueActivity(Fly.ToCell(someBuilding.Location));
self.QueueActivity(new FlyCircle()); self.QueueActivity(new FlyCircle());
} }
} }

View File

@@ -11,7 +11,7 @@
using System; using System;
using System.Linq; using System.Linq;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Traits.Activities; using OpenRA.Traits.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
namespace OpenRA.Mods.RA.Air namespace OpenRA.Mods.RA.Air
@@ -24,13 +24,13 @@ namespace OpenRA.Mods.RA.Air
int2 w1, w2, w3; /* tangent points to turn circles */ int2 w1, w2, w3; /* tangent points to turn circles */
public static Actor ChooseAirfield(Actor self) public static Actor ChooseAirfield(Actor self)
{ {
return self.World.ActorsWithTrait<Reservable>() return self.World.ActorsWithTrait<Reservable>()
.Where(a => a.Actor.Owner == self.Owner) .Where(a => a.Actor.Owner == self.Owner)
.Where(a => self.Info.Traits.Get<PlaneInfo>().RearmBuildings.Contains(a.Actor.Info.Name) .Where(a => self.Info.Traits.Get<PlaneInfo>().RearmBuildings.Contains(a.Actor.Info.Name)
&& !Reservable.IsReserved(a.Actor)) && !Reservable.IsReserved(a.Actor))
.OrderBy(a => (a.Actor.CenterLocation - self.CenterLocation).LengthSquared) .OrderBy(a => (a.Actor.CenterLocation - self.CenterLocation).LengthSquared)
.Select(a => a.Actor) .Select(a => a.Actor)
.FirstOrDefault(); .FirstOrDefault();
} }

View File

@@ -1,8 +1,18 @@
using OpenRA.Traits; #region Copyright & License Information
/*
namespace OpenRA.Mods.RA * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
{ * This file is part of OpenRA, which is free software. It is made
/* tag trait for "bases": mcv/fact */ * available to you under the terms of the GNU General Public License
public class BaseBuildingInfo : TraitInfo<BaseBuilding> { } * as published by the Free Software Foundation. For more information,
public class BaseBuilding { } * see COPYING.
} */
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
/* tag trait for "bases": mcv/fact */
public class BaseBuildingInfo : TraitInfo<BaseBuilding> { }
public class BaseBuilding { }
}

View File

@@ -53,8 +53,8 @@ namespace OpenRA.Mods.RA.Buildings
if (remainingTicks == 0) if (remainingTicks == 0)
{ {
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>(); var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();
var buildingValue = csv != null ? csv.Value : self.Info.Traits.Get<ValuedInfo>().Cost; var buildingValue = csv != null ? csv.Value : self.Info.Traits.Get<ValuedInfo>().Cost;
var hpToRepair = Math.Min(Info.RepairStep, Health.MaxHP - Health.HP); var hpToRepair = Math.Min(Info.RepairStep, Health.MaxHP - Health.HP);
var cost = (hpToRepair * Info.RepairPercent * buildingValue) / (Health.MaxHP * 100); var cost = (hpToRepair * Info.RepairPercent * buildingValue) / (Health.MaxHP * 100);
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost)) if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))

View File

@@ -9,7 +9,7 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
namespace OpenRA.Mods.RA.Buildings namespace OpenRA.Mods.RA.Buildings
@@ -35,9 +35,9 @@ namespace OpenRA.Mods.RA.Buildings
pr.GiveCash(refund); pr.GiveCash(refund);
foreach (var ns in self.TraitsImplementing<INotifySold>()) foreach (var ns in self.TraitsImplementing<INotifySold>())
ns.Sold(self); ns.Sold(self);
if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
self.World.AddFrameEndTask(w => w.Add(new CashTick(refund, 30, 2, self.CenterLocation, self.Owner.ColorRamp.GetColor(0)))); self.World.AddFrameEndTask(w => w.Add(new CashTick(refund, 30, 2, self.CenterLocation, self.Owner.ColorRamp.GetColor(0))));
self.Destroy(); self.Destroy();

View File

@@ -68,18 +68,18 @@ namespace OpenRA.Mods.RA
canCloak = (e.DamageState < DamageState.Critical); canCloak = (e.DamageState < DamageState.Critical);
if (Cloaked && !canCloak) if (Cloaked && !canCloak)
DoUncloak(); DoUncloak();
} }
static readonly Renderable[] Nothing = { }; static readonly Renderable[] Nothing = { };
public IEnumerable<Renderable> public IEnumerable<Renderable>
ModifyRender(Actor self, IEnumerable<Renderable> rs) ModifyRender(Actor self, IEnumerable<Renderable> rs)
{ {
if (remainingTime > 0) if (remainingTime > 0)
return rs; return rs;
if (Cloaked && IsVisible(self)) if (Cloaked && IsVisible(self))
return rs.Select(a => a.WithPalette("shadow")); return rs.Select(a => a.WithPalette("shadow"));
else else
return Nothing; return Nothing;
} }
@@ -107,10 +107,10 @@ namespace OpenRA.Mods.RA
if (!Cloaked || self.Owner == self.World.LocalPlayer || if (!Cloaked || self.Owner == self.World.LocalPlayer ||
self.World.LocalPlayer == null || self.World.LocalPlayer == null ||
self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
return true; return true;
return self.World.ActorsWithTrait<DetectCloaked>().Any(a => return self.World.ActorsWithTrait<DetectCloaked>().Any(a =>
a.Actor.Owner.Stances[self.Owner] != Stance.Ally && a.Actor.Owner.Stances[self.Owner] != Stance.Ally &&
(self.Location - a.Actor.Location).Length < a.Actor.Info.Traits.Get<DetectCloakedInfo>().Range); (self.Location - a.Actor.Location).Length < a.Actor.Info.Traits.Get<DetectCloakedInfo>().Range);
} }

View File

@@ -47,9 +47,9 @@ namespace OpenRA.Mods.RA
if (self.Owner.WinState == WinState.Lost) return; if (self.Owner.WinState == WinState.Lost) return;
self.Owner.WinState = WinState.Lost; self.Owner.WinState = WinState.Lost;
Game.Debug("{0} is defeated.".F(self.Owner.PlayerName)); Game.Debug("{0} is defeated.".F(self.Owner.PlayerName));
foreach (var a in self.World.Actors.Where(a => a.Owner == self.Owner)) foreach (var a in self.World.Actors.Where(a => a.Owner == self.Owner))
a.Kill(a); a.Kill(a);
if (self.Owner == self.World.LocalPlayer) if (self.Owner == self.World.LocalPlayer)

View File

@@ -11,7 +11,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
/* /*
@@ -95,13 +95,13 @@ namespace OpenRA.Mods.RA
public bool CanEnterCell(int2 cell) public bool CanEnterCell(int2 cell)
{ {
if (!self.World.Map.IsInMap(cell.X, cell.Y)) return false; if (!self.World.Map.IsInMap(cell.X, cell.Y)) return false;
var type = self.World.GetTerrainType(cell); var type = self.World.GetTerrainType(cell);
if (!Info.TerrainTypes.Contains(type)) if (!Info.TerrainTypes.Contains(type))
return false; return false;
if (self.World.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(cell) != null) return false; if (self.World.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(cell) != null) return false;
if (self.World.WorldActor.Trait<UnitInfluence>().GetUnitsAt(cell).Any()) return false; if (self.World.WorldActor.Trait<UnitInfluence>().GetUnitsAt(cell).Any()) return false;
return true; return true;
} }

View File

@@ -48,45 +48,45 @@ namespace OpenRA.Mods.RA
for (var n = 0; n < toSpawn; n++) for (var n = 0; n < toSpawn; n++)
SpawnCrate(self, info); SpawnCrate(self, info);
} }
} }
void SpawnCrate(Actor self, CrateDropInfo info) void SpawnCrate(Actor self, CrateDropInfo info)
{ {
var threshold = 100; var threshold = 100;
var inWater = self.World.SharedRandom.NextDouble() < info.WaterChance; var inWater = self.World.SharedRandom.NextDouble() < info.WaterChance;
for (var n = 0; n < threshold; n++) for (var n = 0; n < threshold; n++)
{ {
var p = self.World.ChooseRandomCell(self.World.SharedRandom); var p = self.World.ChooseRandomCell(self.World.SharedRandom);
// Is this valid terrain? // Is this valid terrain?
var terrainType = self.World.GetTerrainType(p); var terrainType = self.World.GetTerrainType(p);
if (!(inWater ? info.ValidWater : info.ValidGround).Contains(terrainType)) continue; if (!(inWater ? info.ValidWater : info.ValidGround).Contains(terrainType)) continue;
// Don't drop on any actors // Don't drop on any actors
if (self.World.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(p) != null) continue; if (self.World.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(p) != null) continue;
if (self.World.WorldActor.Trait<UnitInfluence>().GetUnitsAt(p).Any()) continue; if (self.World.WorldActor.Trait<UnitInfluence>().GetUnitsAt(p).Any()) continue;
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
var crate = w.CreateActor(false, "crate", new TypeDictionary { new OwnerInit(w.WorldActor.Owner) }); var crate = w.CreateActor(false, "crate", new TypeDictionary { new OwnerInit(w.WorldActor.Owner) });
crates.Add(crate); crates.Add(crate);
var startPos = w.ChooseRandomEdgeCell(); var startPos = w.ChooseRandomEdgeCell();
var plane = w.CreateActor("badr", new TypeDictionary var plane = w.CreateActor("badr", new TypeDictionary
{ {
new LocationInit( startPos ), new LocationInit( startPos ),
new OwnerInit( w.WorldActor.Owner), new OwnerInit( w.WorldActor.Owner),
new FacingInit( Util.GetFacing(p - startPos, 0) ), new FacingInit( Util.GetFacing(p - startPos, 0) ),
new AltitudeInit( Rules.Info["badr"].Traits.Get<AircraftInfo>().CruiseAltitude ), new AltitudeInit( Rules.Info["badr"].Traits.Get<AircraftInfo>().CruiseAltitude ),
}); });
plane.CancelActivity(); plane.CancelActivity();
plane.QueueActivity(new FlyAttackLoop(p)); plane.QueueActivity(new FlyAttackLoop(p));
plane.Trait<ParaDrop>().SetLZ(p); plane.Trait<ParaDrop>().SetLZ(p);
plane.Trait<Cargo>().Load(plane, crate); plane.Trait<Cargo>().Load(plane, crate);
}); });
return; return;
} }
} }
} }
} }

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Effects
public readonly int Arm = 0; public readonly int Arm = 0;
public readonly bool Shadow = false; public readonly bool Shadow = false;
public readonly bool Proximity = false; public readonly bool Proximity = false;
public readonly float Angle = 0; public readonly float Angle = 0;
public readonly int TrailInterval = 2; public readonly int TrailInterval = 2;
public IEffect Create(ProjectileArgs args) { return new Bullet( this, args ); } public IEffect Create(ProjectileArgs args) { return new Bullet( this, args ); }
@@ -82,8 +82,8 @@ namespace OpenRA.Mods.RA.Effects
return (int)(rawFacing < 128 return (int)(rawFacing < 128
? rawFacing - scale * attitude ? rawFacing - scale * attitude
: rawFacing + scale * attitude); : rawFacing + scale * attitude);
} }
int ticksToNextSmoke; int ticksToNextSmoke;
public void Tick( World world ) public void Tick( World world )
@@ -102,13 +102,13 @@ namespace OpenRA.Mods.RA.Effects
var highPos = (Info.High || Info.Angle > 0) var highPos = (Info.High || Info.Angle > 0)
? (pos - new float2(0, GetAltitude())) ? (pos - new float2(0, GetAltitude()))
: pos; : pos;
if (--ticksToNextSmoke < 0) if (--ticksToNextSmoke < 0)
{ {
world.AddFrameEndTask(w => w.Add( world.AddFrameEndTask(w => w.Add(
new Smoke(w, highPos.ToInt2(), Info.Trail))); new Smoke(w, highPos.ToInt2(), Info.Trail)));
ticksToNextSmoke = Info.TrailInterval; ticksToNextSmoke = Info.TrailInterval;
} }
} }

View File

@@ -10,7 +10,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.RA.Effects

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Effects
public readonly string Image = null; public readonly string Image = null;
public readonly int ROT = 5; public readonly int ROT = 5;
public readonly int RangeLimit = 0; public readonly int RangeLimit = 0;
public readonly bool TurboBoost = false; public readonly bool TurboBoost = false;
public readonly int TrailInterval = 2; public readonly int TrailInterval = 2;
public IEffect Create(ProjectileArgs args) { return new Missile( this, args ); } public IEffect Create(ProjectileArgs args) { return new Missile( this, args ); }
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA.Effects
} }
// In pixels // In pixels
const int MissileCloseEnough = 7; const int MissileCloseEnough = 7;
int ticksToNextSmoke; int ticksToNextSmoke;
public void Tick( World world ) public void Tick( World world )
@@ -107,12 +107,12 @@ namespace OpenRA.Mods.RA.Effects
if (Info.Trail != null) if (Info.Trail != null)
{ {
var sp = (SubPxPosition - (move * 3) / 2) / 1024 - new int2(0, Altitude); var sp = (SubPxPosition - (move * 3) / 2) / 1024 - new int2(0, Altitude);
if (--ticksToNextSmoke < 0) if (--ticksToNextSmoke < 0)
{ {
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp, Info.Trail))); world.AddFrameEndTask(w => w.Add(new Smoke(w, sp, Info.Trail)));
ticksToNextSmoke = Info.TrailInterval; ticksToNextSmoke = Info.TrailInterval;
} }
} }

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Effects
public RepairIndicator(Actor a, int frames) public RepairIndicator(Actor a, int frames)
{ {
this.a = a; anim.PlayRepeating("repair"); this.a = a; anim.PlayRepeating("repair");
framesLeft = frames; framesLeft = frames;
} }

View File

@@ -18,8 +18,8 @@ namespace OpenRA.Mods.RA
[WeaponReference] [WeaponReference]
public readonly string Weapon = "UnitExplode"; public readonly string Weapon = "UnitExplode";
[WeaponReference] [WeaponReference]
public readonly string EmptyWeapon = "UnitExplode"; public readonly string EmptyWeapon = "UnitExplode";
public readonly int Chance = 100; public readonly int Chance = 100;
} }
@@ -28,8 +28,8 @@ namespace OpenRA.Mods.RA
public void Damaged(Actor self, AttackInfo e) public void Damaged(Actor self, AttackInfo e)
{ {
if (e.DamageState == DamageState.Dead) if (e.DamageState == DamageState.Dead)
{ {
if (self.World.SharedRandom.Next(100) > self.Info.Traits.Get<ExplodesInfo>().Chance) if (self.World.SharedRandom.Next(100) > self.Info.Traits.Get<ExplodesInfo>().Chance)
return; return;
var weapon = ChooseWeaponForExplosion(self); var weapon = ChooseWeaponForExplosion(self);

View File

@@ -13,7 +13,7 @@ using System.Linq;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.FileFormats; using OpenRA.FileFormats;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -41,14 +41,14 @@ namespace OpenRA.Mods.RA
var cost = self.Info.Traits.Get<ValuedInfo>().Cost; var cost = self.Info.Traits.Get<ValuedInfo>().Cost;
Levels = Info.CostThreshold.Select(t => (int)(t * cost)).ToArray(); Levels = Info.CostThreshold.Select(t => (int)(t * cost)).ToArray();
RankAnim = new Animation("rank"); RankAnim = new Animation("rank");
RankAnim.PlayFetchIndex("rank", () => Level - 1); RankAnim.PlayFetchIndex("rank", () => Level - 1);
if (init.Contains<ExperienceInit>()) if (init.Contains<ExperienceInit>())
{ {
Experience = init.Get<ExperienceInit, int>(); Experience = init.Get<ExperienceInit, int>();
while (Level < Levels.Length && Experience >= Levels[Level]) while (Level < Levels.Length && Experience >= Levels[Level])
Level++; Level++;
} }
} }
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.RA
int Level = 0; int Level = 0;
public void GiveOneLevel() public void GiveOneLevel()
{ {
if (Level < Levels.Length) if (Level < Levels.Length)
GiveExperience(Levels[Level] - Experience); GiveExperience(Levels[Level] - Experience);
} }
@@ -94,40 +94,40 @@ namespace OpenRA.Mods.RA
} }
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> rs) public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> rs)
{ {
if (self.Owner == self.World.LocalPlayer && Level > 0) if (self.Owner == self.World.LocalPlayer && Level > 0)
return InnerModifyRender(self, rs); return InnerModifyRender(self, rs);
else else
return rs; return rs;
} }
IEnumerable<Renderable> InnerModifyRender(Actor self, IEnumerable<Renderable> rs) IEnumerable<Renderable> InnerModifyRender(Actor self, IEnumerable<Renderable> rs)
{ {
foreach (var r in rs) foreach (var r in rs)
yield return r; yield return r;
RankAnim.Tick(); // hack RankAnim.Tick(); // hack
var bounds = self.GetBounds(false); var bounds = self.GetBounds(false);
yield return new Renderable(RankAnim.Image, yield return new Renderable(RankAnim.Image,
new float2(bounds.Right - 6, bounds.Bottom - 8), "effect", (int)self.CenterLocation.Y); new float2(bounds.Right - 6, bounds.Bottom - 8), "effect", (int)self.CenterLocation.Y);
}
}
class ExperienceInit : IActorInit<int>
{
[FieldFromYamlKey]
public readonly int value = 0;
public ExperienceInit() { }
public ExperienceInit(int init)
{
value = init;
}
public int Value(World world)
{
return value;
} }
}
class ExperienceInit : IActorInit<int>
{
[FieldFromYamlKey]
public readonly int value = 0;
public ExperienceInit() { }
public ExperienceInit(int init)
{
value = init;
}
public int Value(World world)
{
return value;
}
} }
} }

View File

@@ -63,13 +63,13 @@ namespace OpenRA.Mods.RA
} }
Actor ClosestProc(Actor self, Actor ignore) Actor ClosestProc(Actor self, Actor ignore)
{ {
var refs = self.World.ActorsWithTrait<IAcceptOre>() var refs = self.World.ActorsWithTrait<IAcceptOre>()
.Where(x => x.Actor != ignore && x.Actor.Owner == self.Owner) .Where(x => x.Actor != ignore && x.Actor.Owner == self.Owner)
.ToList(); .ToList();
var mi = self.Info.Traits.Get<MobileInfo>(); var mi = self.Info.Traits.Get<MobileInfo>();
var path = self.World.WorldActor.Trait<PathFinder>().FindPath( var path = self.World.WorldActor.Trait<PathFinder>().FindPath(
PathSearch.FromPoints(self.World, mi, PathSearch.FromPoints(self.World, mi,
refs.Select(r => r.Actor.Location + r.Trait.DeliverOffset), refs.Select(r => r.Actor.Location + r.Trait.DeliverOffset),
self.Location, false)); self.Location, false));
path.Reverse(); path.Reverse();

View File

@@ -26,8 +26,8 @@ namespace OpenRA.Mods.RA
public Color RadarColorOverride(Actor self) public Color RadarColorOverride(Actor self)
{ {
return Color.FromArgb(128, self.Owner.ColorRamp.GetColor(0)); return Color.FromArgb(128, self.Owner.ColorRamp.GetColor(0));
} }
static readonly Renderable[] Nothing = { }; static readonly Renderable[] Nothing = { };
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r) public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
{ {

View File

@@ -1,16 +1,26 @@
using System; #region Copyright & License Information
using System.Collections.Generic; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
using System.Text; * This file is part of OpenRA, which is free software. It is made
using OpenRA.Traits; * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
namespace OpenRA.Mods.RA * see COPYING.
{ */
class LintBuildablePrerequisites : ILintPass #endregion
{
public void Run(Action<string> emitError) using System;
{ using System.Collections.Generic;
emitError("Hello World"); using System.Linq;
} using System.Text;
} using OpenRA.Traits;
}
namespace OpenRA.Mods.RA
{
class LintBuildablePrerequisites : ILintPass
{
public void Run(Action<string> emitError)
{
emitError("Hello World");
}
}
}

View File

@@ -87,12 +87,12 @@ namespace OpenRA.Mods.RA.Move
{ {
using (new PerfSample("Pathfinder")) using (new PerfSample("Pathfinder"))
{ {
using(search) using(search)
while (!search.queue.Empty) while (!search.queue.Empty)
{ {
var p = search.Expand(world); var p = search.Expand(world);
if (search.heuristic(p) == 0) if (search.heuristic(p) == 0)
return MakePath(search.cellInfo, p); return MakePath(search.cellInfo, p);
} }
// no path exists // no path exists
@@ -114,35 +114,35 @@ namespace OpenRA.Mods.RA.Move
ret.Add(pathNode); ret.Add(pathNode);
CheckSanePath(ret); CheckSanePath(ret);
return ret; return ret;
} }
public List<int2> FindBidiPath( /* searches from both ends toward each other */ public List<int2> FindBidiPath( /* searches from both ends toward each other */
PathSearch fromSrc, PathSearch fromSrc,
PathSearch fromDest) PathSearch fromDest)
{ {
using (new PerfSample("Pathfinder")) using (new PerfSample("Pathfinder"))
{ {
using (fromSrc) using (fromSrc)
using (fromDest) using (fromDest)
while (!fromSrc.queue.Empty && !fromDest.queue.Empty) while (!fromSrc.queue.Empty && !fromDest.queue.Empty)
{ {
/* make some progress on the first search */ /* make some progress on the first search */
var p = fromSrc.Expand(world); var p = fromSrc.Expand(world);
if (fromDest.cellInfo[p.X, p.Y].Seen && fromDest.cellInfo[p.X, p.Y].MinCost < float.PositiveInfinity) if (fromDest.cellInfo[p.X, p.Y].Seen && fromDest.cellInfo[p.X, p.Y].MinCost < float.PositiveInfinity)
return MakeBidiPath(fromSrc, fromDest, p); return MakeBidiPath(fromSrc, fromDest, p);
/* make some progress on the second search */ /* make some progress on the second search */
var q = fromDest.Expand(world); var q = fromDest.Expand(world);
if (fromSrc.cellInfo[q.X, q.Y].Seen && fromSrc.cellInfo[q.X, q.Y].MinCost < float.PositiveInfinity) if (fromSrc.cellInfo[q.X, q.Y].Seen && fromSrc.cellInfo[q.X, q.Y].MinCost < float.PositiveInfinity)
return MakeBidiPath(fromSrc, fromDest, q); return MakeBidiPath(fromSrc, fromDest, q);
} }
return new List<int2>(); return new List<int2>();
} }
} }
static List<int2> MakeBidiPath(PathSearch a, PathSearch b, int2 p) static List<int2> MakeBidiPath(PathSearch a, PathSearch b, int2 p)

View File

@@ -191,37 +191,37 @@ namespace OpenRA.Mods.RA.Move
search.AddInitialCell( sl ); search.AddInitialCell( sl );
return search; return search;
} }
static readonly Queue<CellInfo[,]> cellInfoPool = new Queue<CellInfo[,]>(); static readonly Queue<CellInfo[,]> cellInfoPool = new Queue<CellInfo[,]>();
static CellInfo[,] GetFromPool() static CellInfo[,] GetFromPool()
{ {
lock (cellInfoPool) lock (cellInfoPool)
return cellInfoPool.Dequeue(); return cellInfoPool.Dequeue();
} }
static void PutBackIntoPool(CellInfo[,] ci) static void PutBackIntoPool(CellInfo[,] ci)
{ {
lock (cellInfoPool) lock (cellInfoPool)
cellInfoPool.Enqueue(ci); cellInfoPool.Enqueue(ci);
} }
CellInfo[ , ] InitCellInfo() CellInfo[ , ] InitCellInfo()
{ {
CellInfo[,] result = null; CellInfo[,] result = null;
while (cellInfoPool.Count > 0) while (cellInfoPool.Count > 0)
{ {
var cellInfo = GetFromPool(); var cellInfo = GetFromPool();
if (cellInfo.GetUpperBound(0) != world.Map.MapSize.X - 1 || if (cellInfo.GetUpperBound(0) != world.Map.MapSize.X - 1 ||
cellInfo.GetUpperBound(1) != world.Map.MapSize.Y - 1) cellInfo.GetUpperBound(1) != world.Map.MapSize.Y - 1)
{ {
Log.Write("debug", "Discarding old pooled CellInfo of wrong size."); Log.Write("debug", "Discarding old pooled CellInfo of wrong size.");
continue; continue;
} }
result = cellInfo; result = cellInfo;
break; break;
} }
if (result == null) if (result == null)
@@ -243,20 +243,20 @@ namespace OpenRA.Mods.RA.Move
int straight = Math.Abs( d.X - d.Y ); int straight = Math.Abs( d.X - d.Y );
return (3400 * diag / 24) + (100 * straight); return (3400 * diag / 24) + (100 * straight);
}; };
} }
bool disposed; bool disposed;
public void Dispose() public void Dispose()
{ {
if (disposed) if (disposed)
return; return;
disposed = true; disposed = true;
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
PutBackIntoPool(cellInfo); PutBackIntoPool(cellInfo);
cellInfo = null; cellInfo = null;
} }
~PathSearch() { Dispose(); } ~PathSearch() { Dispose(); }
} }
} }

View File

@@ -1,42 +1,52 @@
using System; #region Copyright & License Information
using System.Collections.Generic; /*
using System.Linq; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
using System.Text; * This file is part of OpenRA, which is free software. It is made
using OpenRA.Traits; * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
namespace OpenRA.Mods.RA.Orders * see COPYING.
{ */
public class DeployOrderTargeter : IOrderTargeter #endregion
{
readonly Func<bool> useDeployCursor; using System;
using System.Collections.Generic;
public DeployOrderTargeter( string order, int priority ) using System.Linq;
: this( order, priority, () => true ) using System.Text;
{ using OpenRA.Traits;
}
namespace OpenRA.Mods.RA.Orders
public DeployOrderTargeter( string order, int priority, Func<bool> useDeployCursor ) {
{ public class DeployOrderTargeter : IOrderTargeter
this.OrderID = order; {
this.OrderPriority = priority; readonly Func<bool> useDeployCursor;
this.useDeployCursor = useDeployCursor;
} public DeployOrderTargeter( string order, int priority )
: this( order, priority, () => true )
public string OrderID { get; private set; } {
public int OrderPriority { get; private set; } }
public bool CanTargetActor( Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor ) public DeployOrderTargeter( string order, int priority, Func<bool> useDeployCursor )
{ {
IsQueued = forceQueued; this.OrderID = order;
cursor = useDeployCursor() ? "deploy" : "deploy-blocked"; this.OrderPriority = priority;
return self == target; this.useDeployCursor = useDeployCursor;
} }
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor) public string OrderID { get; private set; }
{ public int OrderPriority { get; private set; }
return false;
} public bool CanTargetActor( Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor )
{
public bool IsQueued { get; protected set; } IsQueued = forceQueued;
} cursor = useDeployCursor() ? "deploy" : "deploy-blocked";
} return self == target;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
{
return false;
}
public bool IsQueued { get; protected set; }
}
}

View File

@@ -6,15 +6,15 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Mods.RA.Render; using OpenRA.Mods.RA.Render;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA

View File

@@ -6,75 +6,75 @@
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
public class ParaDropInfo : TraitInfo<ParaDrop> public class ParaDropInfo : TraitInfo<ParaDrop>
{ {
public readonly int LZRange = 4; public readonly int LZRange = 4;
public readonly string ChuteSound = "chute1.aud"; public readonly string ChuteSound = "chute1.aud";
} }
public class ParaDrop : ITick public class ParaDrop : ITick
{ {
readonly List<int2> droppedAt = new List<int2>(); readonly List<int2> droppedAt = new List<int2>();
int2 lz; int2 lz;
public void SetLZ(int2 lz) public void SetLZ(int2 lz)
{ {
this.lz = lz; this.lz = lz;
droppedAt.Clear(); droppedAt.Clear();
} }
public void Tick(Actor self) public void Tick(Actor self)
{ {
var info = self.Info.Traits.Get<ParaDropInfo>(); var info = self.Info.Traits.Get<ParaDropInfo>();
var r = info.LZRange; var r = info.LZRange;
if ((self.Location - lz).LengthSquared <= r * r && !droppedAt.Contains(self.Location)) if ((self.Location - lz).LengthSquared <= r * r && !droppedAt.Contains(self.Location))
{ {
var cargo = self.Trait<Cargo>(); var cargo = self.Trait<Cargo>();
if (cargo.IsEmpty(self)) if (cargo.IsEmpty(self))
FinishedDropping(self); FinishedDropping(self);
else else
{ {
if (!IsSuitableCell(cargo.Peek(self), self.Location)) if (!IsSuitableCell(cargo.Peek(self), self.Location))
return; return;
// unload a dude here // unload a dude here
droppedAt.Add(self.Location); droppedAt.Add(self.Location);
var a = cargo.Unload(self); var a = cargo.Unload(self);
var rs = a.Trait<RenderSimple>(); var rs = a.Trait<RenderSimple>();
var aircraft = self.Trait<IMove>(); var aircraft = self.Trait<IMove>();
self.World.AddFrameEndTask(w => w.Add( self.World.AddFrameEndTask(w => w.Add(
new Parachute(self.Owner, rs.anim.Name, new Parachute(self.Owner, rs.anim.Name,
Util.CenterOfCell(Util.CellContaining(self.CenterLocation)), Util.CenterOfCell(Util.CellContaining(self.CenterLocation)),
aircraft.Altitude, a))); aircraft.Altitude, a)));
Sound.Play(info.ChuteSound, self.CenterLocation); Sound.Play(info.ChuteSound, self.CenterLocation);
} }
} }
} }
bool IsSuitableCell(Actor actorToDrop, int2 p) bool IsSuitableCell(Actor actorToDrop, int2 p)
{ {
return actorToDrop.Trait<ITeleportable>().CanEnterCell(p); return actorToDrop.Trait<ITeleportable>().CanEnterCell(p);
} }
void FinishedDropping(Actor self) void FinishedDropping(Actor self)
{ {
self.CancelActivity(); self.CancelActivity();
self.QueueActivity(new FlyOffMap { Interruptible = false }); self.QueueActivity(new FlyOffMap { Interruptible = false });
self.QueueActivity(new RemoveSelf()); self.QueueActivity(new RemoveSelf());
} }
} }
} }

View File

@@ -34,8 +34,8 @@ namespace OpenRA.Mods.RA
.Any(); .Any();
base.Tick(self); base.Tick(self);
} }
static ActorInfo[] None = { }; static ActorInfo[] None = { };
public override IEnumerable<ActorInfo> AllItems() public override IEnumerable<ActorInfo> AllItems()
{ {
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA
{ {
// Find a production structure to build this actor // Find a production structure to build this actor
var producers = self.World var producers = self.World
.ActorsWithTrait<Production>() .ActorsWithTrait<Production>()
.Where(x => x.Actor.Owner == self.Owner) .Where(x => x.Actor.Owner == self.Owner)
.Where(x => x.Trait.Info.Produces.Contains(Info.Type)) .Where(x => x.Trait.Info.Produces.Contains(Info.Type))
.OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary. .OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary.

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
public readonly Actor self; public readonly Actor self;
public ProductionQueueInfo Info; public ProductionQueueInfo Info;
PowerManager PlayerPower; PowerManager PlayerPower;
PlayerResources PlayerResources; PlayerResources PlayerResources;
string Race; string Race;
// A list of things we are currently building // A list of things we are currently building
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA
[Sync] [Sync]
public bool CurrentDone { get { return QueueLength == 0 ? false : Queue[0].Done; } } public bool CurrentDone { get { return QueueLength == 0 ? false : Queue[0].Done; } }
// A list of things we could possibly build, even if our race doesn't normally get it // A list of things we could possibly build, even if our race doesn't normally get it
public Dictionary<ActorInfo, ProductionState> Produceable; public Dictionary<ActorInfo, ProductionState> Produceable;
public ProductionQueue( Actor self, Actor playerActor, ProductionQueueInfo info ) public ProductionQueue( Actor self, Actor playerActor, ProductionQueueInfo info )
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA
PlayerResources = playerActor.Trait<PlayerResources>(); PlayerResources = playerActor.Trait<PlayerResources>();
PlayerPower = playerActor.Trait<PowerManager>(); PlayerPower = playerActor.Trait<PowerManager>();
Race = self.Owner.Country.Race; Race = self.Owner.Country.Race;
Produceable = InitTech(playerActor); Produceable = InitTech(playerActor);
} }
@@ -75,26 +75,26 @@ namespace OpenRA.Mods.RA
PlayerResources = newOwner.PlayerActor.Trait<PlayerResources>(); PlayerResources = newOwner.PlayerActor.Trait<PlayerResources>();
Queue.Clear(); Queue.Clear();
// Produceable contains the tech from the original owner - this is desired so we don't clear it. // Produceable contains the tech from the original owner - this is desired so we don't clear it.
Produceable = InitTech(self.Owner.PlayerActor); Produceable = InitTech(self.Owner.PlayerActor);
} }
Dictionary<ActorInfo, ProductionState> InitTech(Actor playerActor) Dictionary<ActorInfo, ProductionState> InitTech(Actor playerActor)
{ {
var tech = new Dictionary<ActorInfo, ProductionState>(); var tech = new Dictionary<ActorInfo, ProductionState>();
var ttc = playerActor.Trait<TechTree>(); var ttc = playerActor.Trait<TechTree>();
foreach (var a in AllBuildables(Info.Type)) foreach (var a in AllBuildables(Info.Type))
{ {
var bi = a.Traits.Get<BuildableInfo>(); var bi = a.Traits.Get<BuildableInfo>();
// Can our race build this by satisfying normal prereqs? // Can our race build this by satisfying normal prereqs?
var buildable = bi.Owner.Contains(Race); var buildable = bi.Owner.Contains(Race);
tech.Add(a, new ProductionState() { Visible = buildable && !bi.Hidden }); tech.Add(a, new ProductionState() { Visible = buildable && !bi.Hidden });
if (buildable) if (buildable)
ttc.Add(a.Name, a.Traits.Get<BuildableInfo>().Prerequisites.ToList(), this); ttc.Add(a.Name, a.Traits.Get<BuildableInfo>().Prerequisites.ToList(), this);
} }
return tech; return tech;
} }
IEnumerable<ActorInfo> AllBuildables(string category) IEnumerable<ActorInfo> AllBuildables(string category)

View File

@@ -1,49 +1,49 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
class ProductionBarInfo : ITraitInfo class ProductionBarInfo : ITraitInfo
{ {
public object Create(ActorInitializer init) { return new ProductionBar( init.self ); } public object Create(ActorInitializer init) { return new ProductionBar( init.self ); }
} }
class ProductionBar : ISelectionBar class ProductionBar : ISelectionBar
{ {
Actor self; Actor self;
public ProductionBar(Actor self) { this.self = self; } public ProductionBar(Actor self) { this.self = self; }
public float GetValue() public float GetValue()
{ {
// only people we like should see our production status. // only people we like should see our production status.
if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] != Stance.Ally) if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] != Stance.Ally)
return 0; return 0;
var queue = self.TraitsImplementing<ProductionQueue>().FirstOrDefault(q => q.CurrentItem() != null); var queue = self.TraitsImplementing<ProductionQueue>().FirstOrDefault(q => q.CurrentItem() != null);
if (queue == null) if (queue == null)
{ {
var produces = self.Trait<Production>().Info.Produces; var produces = self.Trait<Production>().Info.Produces;
queue = self.Owner.PlayerActor.TraitsImplementing<ProductionQueue>() queue = self.Owner.PlayerActor.TraitsImplementing<ProductionQueue>()
.FirstOrDefault(q => produces.Contains(q.Info.Type)); .FirstOrDefault(q => produces.Contains(q.Info.Type));
} }
if (queue == null || queue.CurrentItem() == null) if (queue == null || queue.CurrentItem() == null)
return 0f; return 0f;
return 1 - (float)queue.CurrentItem().RemainingCost / queue.CurrentItem().TotalCost; return 1 - (float)queue.CurrentItem().RemainingCost / queue.CurrentItem().TotalCost;
} }
public Color GetColor() { return Color.SkyBlue; } public Color GetColor() { return Color.SkyBlue; }
} }
} }

View File

@@ -1,36 +1,46 @@
using System.Reflection; #region Copyright & License Information
using System.Runtime.CompilerServices; /*
using System.Runtime.InteropServices; * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
// General Information about an assembly is controlled through the following * available to you under the terms of the GNU General Public License
// set of attributes. Change these attribute values to modify the information * as published by the Free Software Foundation. For more information,
// associated with an assembly. * see COPYING.
[assembly: AssemblyTitle("OpenRA.Mods.RA")] */
[assembly: AssemblyDescription("")] #endregion
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] using System.Reflection;
[assembly: AssemblyProduct("OpenRA.Mods.RA")] using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Copyright © 2010")] using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// Setting ComVisible to false makes the types in this assembly not visible // associated with an assembly.
// to COM components. If you need to access a type in this assembly from [assembly: AssemblyTitle("OpenRA.Mods.RA")]
// COM, set the ComVisible attribute to true on that type. [assembly: AssemblyDescription("")]
[assembly: ComVisible(false)] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
// The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: AssemblyProduct("OpenRA.Mods.RA")]
[assembly: Guid("23828b43-3536-4681-bc2f-2eb2e0972354")] [assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values: [assembly: AssemblyCulture("")]
//
// Major Version // Setting ComVisible to false makes the types in this assembly not visible
// Minor Version // to COM components. If you need to access a type in this assembly from
// Build Number // COM, set the ComVisible attribute to true on that type.
// Revision [assembly: ComVisible(false)]
//
// You can specify all the values or you can default the Build and Revision Numbers // The following GUID is for the ID of the typelib if this project is exposed to COM
// by using the '*' as shown below: [assembly: Guid("23828b43-3536-4681-bc2f-2eb2e0972354")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] // Version information for an assembly consists of the following four values:
[assembly: AssemblyFileVersion("1.0.0.0")] //
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,206 +1,206 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Linq;
using OpenRA.Effects;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class ProximityCapturableInfo : ITraitInfo
{
public readonly bool Permanent = false;
public readonly int Range = 5;
public readonly bool MustBeClear = false;
public readonly string[] CaptorTypes = {"Vehicle", "Tank", "Infantry"};
public object Create(ActorInitializer init) { return new ProximityCapturable(init.self, this); }
}
public class ProximityCapturable : ITick, ISync
{
[Sync]
public Player Owner { get { return Captured ? Self.Owner : OriginalOwner; } }
[Sync]
public readonly Player OriginalOwner;
public ProximityCapturableInfo Info;
[Sync]
public int Range;
[Sync]
public bool Permanent;
[Sync]
public bool Captured = false;
[Sync]
public bool MustBeClear = false;
public string[] CaptorTypes = {};
public Actor Self;
public ProximityCapturable(Actor self, ProximityCapturableInfo info)
{
Info = info;
Range = info.Range;
Permanent = info.Permanent;
MustBeClear = info.MustBeClear;
Self = self;
OriginalOwner = self.Owner;
CaptorTypes = info.CaptorTypes;
}
public void Tick(Actor self)
{
if (Captured && Permanent) return; // Permanent capture
//var playersNear = CountPlayersNear(self, OriginalOwner, Range);
if (!Captured)
{
var captor = GetInRange(self, OriginalOwner, Range, CaptorTypes);
if (captor != null)
{
if (MustBeClear && !IsClear(self, captor.Owner, Range, OriginalOwner, CaptorTypes)) return;
ChangeOwnership(self, captor, OriginalOwner);
}
return;
}
// if the area must be clear, and there is more than 1 player nearby => return ownership to default
if (MustBeClear && !IsClear(self, Owner, Range, OriginalOwner, CaptorTypes))
{
// Revert Ownership
ChangeOwnership(self, Owner, OriginalOwner);
return;
}
// See if the 'temporary' owner still is in range
if (!IsStillInRange(self, self.Owner, Range, CaptorTypes))
{
// no.. So find a new one
var captor = GetInRange(self, OriginalOwner, Range, CaptorTypes);
if (captor != null) // got one
{
ChangeOwnership(self, captor, Owner);
return;
}
// Revert Ownership otherwise
ChangeOwnership(self, Owner, OriginalOwner);
}
}
private void ChangeOwnership(Actor self, Player previousOwner, Player originalOwner)
{
self.World.AddFrameEndTask(w =>
{
if (self.Destroyed) return;
// momentarily remove from world so the ownership queries don't get confused
w.Remove(self);
self.Owner = originalOwner;
w.Add(self);
if (self.Owner == self.World.LocalPlayer)
w.Add(new FlashTarget(self));
Captured = false;
foreach (var t in self.TraitsImplementing<INotifyCapture>())
t.OnCapture(self, self, previousOwner, self.Owner);
});
}
private void ChangeOwnership(Actor self, Actor captor, Player previousOwner)
{
self.World.AddFrameEndTask(w =>
{
if (self.Destroyed || (captor.Destroyed || !captor.IsInWorld)) return;
// momentarily remove from world so the ownership queries don't get confused
w.Remove(self);
self.Owner = captor.Owner;
w.Add(self);
if (self.Owner == self.World.LocalPlayer)
w.Add(new FlashTarget(self));
Captured = true;
foreach (var t in self.TraitsImplementing<INotifyCapture>())
t.OnCapture(self, captor, previousOwner, self.Owner);
});
}
static bool AreMutualAllies(Player a, Player b)
{
return a.Stances[b] == Stance.Ally &&
b.Stances[a] == Stance.Ally;
}
public static bool IsClear(Actor self, Player currentOwner, int range, Player originalOwner, string[] actorTypes)
{
var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return unitsInRange.Where(a => !a.Destroyed && a.IsInWorld && a != self && !a.Owner.NonCombatant && a.Owner != originalOwner) using System.Linq;
.Where(a => a.Owner != currentOwner) using OpenRA.Effects;
.Where(a => actorTypes.Length == 0 || (a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes))) using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class ProximityCapturableInfo : ITraitInfo
{
public readonly bool Permanent = false;
public readonly int Range = 5;
public readonly bool MustBeClear = false;
public readonly string[] CaptorTypes = {"Vehicle", "Tank", "Infantry"};
public object Create(ActorInitializer init) { return new ProximityCapturable(init.self, this); }
}
public class ProximityCapturable : ITick, ISync
{
[Sync]
public Player Owner { get { return Captured ? Self.Owner : OriginalOwner; } }
[Sync]
public readonly Player OriginalOwner;
public ProximityCapturableInfo Info;
[Sync]
public int Range;
[Sync]
public bool Permanent;
[Sync]
public bool Captured = false;
[Sync]
public bool MustBeClear = false;
public string[] CaptorTypes = {};
public Actor Self;
public ProximityCapturable(Actor self, ProximityCapturableInfo info)
{
Info = info;
Range = info.Range;
Permanent = info.Permanent;
MustBeClear = info.MustBeClear;
Self = self;
OriginalOwner = self.Owner;
CaptorTypes = info.CaptorTypes;
}
public void Tick(Actor self)
{
if (Captured && Permanent) return; // Permanent capture
//var playersNear = CountPlayersNear(self, OriginalOwner, Range);
if (!Captured)
{
var captor = GetInRange(self, OriginalOwner, Range, CaptorTypes);
if (captor != null)
{
if (MustBeClear && !IsClear(self, captor.Owner, Range, OriginalOwner, CaptorTypes)) return;
ChangeOwnership(self, captor, OriginalOwner);
}
return;
}
// if the area must be clear, and there is more than 1 player nearby => return ownership to default
if (MustBeClear && !IsClear(self, Owner, Range, OriginalOwner, CaptorTypes))
{
// Revert Ownership
ChangeOwnership(self, Owner, OriginalOwner);
return;
}
// See if the 'temporary' owner still is in range
if (!IsStillInRange(self, self.Owner, Range, CaptorTypes))
{
// no.. So find a new one
var captor = GetInRange(self, OriginalOwner, Range, CaptorTypes);
if (captor != null) // got one
{
ChangeOwnership(self, captor, Owner);
return;
}
// Revert Ownership otherwise
ChangeOwnership(self, Owner, OriginalOwner);
}
}
private void ChangeOwnership(Actor self, Player previousOwner, Player originalOwner)
{
self.World.AddFrameEndTask(w =>
{
if (self.Destroyed) return;
// momentarily remove from world so the ownership queries don't get confused
w.Remove(self);
self.Owner = originalOwner;
w.Add(self);
if (self.Owner == self.World.LocalPlayer)
w.Add(new FlashTarget(self));
Captured = false;
foreach (var t in self.TraitsImplementing<INotifyCapture>())
t.OnCapture(self, self, previousOwner, self.Owner);
});
}
private void ChangeOwnership(Actor self, Actor captor, Player previousOwner)
{
self.World.AddFrameEndTask(w =>
{
if (self.Destroyed || (captor.Destroyed || !captor.IsInWorld)) return;
// momentarily remove from world so the ownership queries don't get confused
w.Remove(self);
self.Owner = captor.Owner;
w.Add(self);
if (self.Owner == self.World.LocalPlayer)
w.Add(new FlashTarget(self));
Captured = true;
foreach (var t in self.TraitsImplementing<INotifyCapture>())
t.OnCapture(self, captor, previousOwner, self.Owner);
});
}
static bool AreMutualAllies(Player a, Player b)
{
return a.Stances[b] == Stance.Ally &&
b.Stances[a] == Stance.Ally;
}
public static bool IsClear(Actor self, Player currentOwner, int range, Player originalOwner, string[] actorTypes)
{
var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return unitsInRange.Where(a => !a.Destroyed && a.IsInWorld && a != self && !a.Owner.NonCombatant && a.Owner != originalOwner)
.Where(a => a.Owner != currentOwner)
.Where(a => actorTypes.Length == 0 || (a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes)))
.All(a => AreMutualAllies(a.Owner, currentOwner)); .All(a => AreMutualAllies(a.Owner, currentOwner));
} }
// TODO exclude other NeutralActor that arent permanent // TODO exclude other NeutralActor that arent permanent
public static bool IsStillInRange(Actor self, Player currentOwner, int range, string[] actorTypes) public static bool IsStillInRange(Actor self, Player currentOwner, int range, string[] actorTypes)
{ {
var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range); var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return unitsInRange return unitsInRange
.Where(a => a.Owner == currentOwner && !a.Destroyed && a.IsInWorld && a != self) .Where(a => a.Owner == currentOwner && !a.Destroyed && a.IsInWorld && a != self)
.Where(a => actorTypes.Length == 0 || (a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes))) .Where(a => actorTypes.Length == 0 || (a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes)))
.Any(); .Any();
} }
// TODO exclude other NeutralActor that arent permanent // TODO exclude other NeutralActor that arent permanent
public static Actor GetInRange(Actor self, Player originalOwner, int range, string[] actorTypes) public static Actor GetInRange(Actor self, Player originalOwner, int range, string[] actorTypes)
{ {
var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range); var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return unitsInRange return unitsInRange
.Where(a => a.Owner != originalOwner && !a.Destroyed && a.IsInWorld && a != self) .Where(a => a.Owner != originalOwner && !a.Destroyed && a.IsInWorld && a != self)
.Where(a => !a.Owner.PlayerRef.OwnsWorld) .Where(a => !a.Owner.PlayerRef.OwnsWorld)
.Where(a => !a.Owner.PlayerRef.NonCombatant) .Where(a => !a.Owner.PlayerRef.NonCombatant)
.Where(a => actorTypes.Length == 0 || (a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes))) .Where(a => actorTypes.Length == 0 || (a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes)))
.OrderBy(a => (a.CenterLocation - self.CenterLocation).LengthSquared) .OrderBy(a => (a.CenterLocation - self.CenterLocation).LengthSquared)
.FirstOrDefault(); .FirstOrDefault();
} }
public static int CountPlayersNear(Actor self, Player ignoreMe, int range, string[] actorTypes) public static int CountPlayersNear(Actor self, Player ignoreMe, int range, string[] actorTypes)
{ {
var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range); var unitsInRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return unitsInRange return unitsInRange
.Where(a => a.Owner != ignoreMe && !a.Destroyed && a.IsInWorld && a != self) .Where(a => a.Owner != ignoreMe && !a.Destroyed && a.IsInWorld && a != self)
.Where(a => !a.Owner.PlayerRef.OwnsWorld) .Where(a => !a.Owner.PlayerRef.OwnsWorld)
.Where(a => !a.Owner.PlayerRef.NonCombatant) .Where(a => !a.Owner.PlayerRef.NonCombatant)
.Where(a =>actorTypes.Length == 0 || ( a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes))) .Where(a =>actorTypes.Length == 0 || ( a.HasTrait<ProximityCaptor>() && a.Trait<ProximityCaptor>().HasAny(actorTypes)))
.Select(a => a.Owner) .Select(a => a.Owner)
.Distinct() .Distinct()
.Count(); .Count();
} }
} }
} }

View File

@@ -1,28 +1,28 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
* see COPYING. * see COPYING.
*/ */
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render namespace OpenRA.Mods.RA.Render
{ {
class RenderEditorOnlyInfo : RenderSimpleInfo class RenderEditorOnlyInfo : RenderSimpleInfo
{ {
public override object Create(ActorInitializer init) { return new RenderEditorOnly(init.self); } public override object Create(ActorInitializer init) { return new RenderEditorOnly(init.self); }
} }
class RenderEditorOnly : RenderSimple class RenderEditorOnly : RenderSimple
{ {
public RenderEditorOnly(Actor self) : base(self, () => 0) { } public RenderEditorOnly(Actor self) : base(self, () => 0) { }
static readonly Renderable[] Nothing = { }; static readonly Renderable[] Nothing = { };
public override IEnumerable<Renderable> Render(Actor self) { return Nothing; } public override IEnumerable<Renderable> Render(Actor self) { return Nothing; }
} }
} }

View File

@@ -8,7 +8,7 @@
*/ */
#endregion #endregion
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;

Some files were not shown because too many files have changed in this diff Show More