chrome
This commit is contained in:
@@ -16,8 +16,13 @@ namespace OpenRA.Server
|
||||
var right = new TcpListener(1235);
|
||||
right.Start();
|
||||
|
||||
var l = left.AcceptTcpClient().GetStream();
|
||||
var r = right.AcceptTcpClient().GetStream();
|
||||
var lc = left.AcceptTcpClient();
|
||||
lc.NoDelay = true;
|
||||
var l = lc.GetStream();
|
||||
|
||||
var rc = right.AcceptTcpClient();
|
||||
rc.NoDelay = true;
|
||||
var r = rc.GetStream();
|
||||
|
||||
var ll = new Thread(RW(l, r));
|
||||
var rr = new Thread(RW(r, l));
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRa.Game
|
||||
DrawBuildPalette("Building");
|
||||
}
|
||||
|
||||
static string[] groups = new string[] { "Building", "Vehicle", "Ship", "Infantry", "Plane" };
|
||||
static string[] groups = new string[] { "Building", "Defense", "Vehicle", "Ship", "Infantry", "Plane" };
|
||||
Dictionary<string, Sprite> sprites;
|
||||
|
||||
void DrawBuildPalette(string queueName)
|
||||
@@ -75,7 +75,9 @@ namespace OpenRa.Game
|
||||
var y = 0;
|
||||
|
||||
var buildableItems = Rules.TechTree.BuildableItems(Game.LocalPlayer, queueName).ToArray();
|
||||
foreach (var item in Rules.TechTree.AllItems(Game.LocalPlayer, queueName))
|
||||
var allItems = Rules.TechTree.AllItems(Game.LocalPlayer, queueName)
|
||||
.OrderBy( a => Rules.UnitInfo[a].TechLevel );
|
||||
foreach (var item in allItems)
|
||||
{
|
||||
if (Rules.UnitInfo[item].TechLevel == -1) continue;
|
||||
var rect = new Rectangle(Game.viewport.Width - (3 - x) * 64 - 20, 32 + 48 * y, 64, 48);
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace OpenRa.Game
|
||||
static class Rules
|
||||
{
|
||||
public static IniFile AllRules;
|
||||
public static Dictionary<string, List<string>> Categories = new Dictionary<string,List<string>>();
|
||||
public static Dictionary<string, List<string>> Categories = new Dictionary<string, List<string>>();
|
||||
public static Dictionary<string, string> UnitCategory;
|
||||
public static InfoLoader<UnitInfo> UnitInfo;
|
||||
public static InfoLoader<WeaponInfo> WeaponInfo;
|
||||
@@ -19,41 +19,43 @@ namespace OpenRa.Game
|
||||
public static GeneralInfo General;
|
||||
public static TechTree TechTree;
|
||||
|
||||
public static void LoadRules( string mapFileName )
|
||||
public static void LoadRules(string mapFileName)
|
||||
{
|
||||
AllRules = new IniFile(
|
||||
FileSystem.Open( mapFileName ),
|
||||
FileSystem.Open( "rules.ini" ),
|
||||
FileSystem.Open( "units.ini" ),
|
||||
FileSystem.Open( "campaignUnits.ini" ) );
|
||||
FileSystem.Open(mapFileName),
|
||||
FileSystem.Open("rules.ini"),
|
||||
FileSystem.Open("units.ini"),
|
||||
FileSystem.Open("campaignUnits.ini"));
|
||||
|
||||
General = new GeneralInfo();
|
||||
FieldLoader.Load(General, AllRules.GetSection("General"));
|
||||
|
||||
LoadCategories(
|
||||
"Building",
|
||||
"Defense",
|
||||
"Infantry",
|
||||
"Vehicle",
|
||||
"Ship",
|
||||
"Plane" );
|
||||
UnitCategory = Categories.SelectMany( x => x.Value.Select( y => new KeyValuePair<string, string>( y, x.Key ) ) ).ToDictionary( x => x.Key, x => x.Value );
|
||||
"Plane");
|
||||
UnitCategory = Categories.SelectMany(x => x.Value.Select(y => new KeyValuePair<string, string>(y, x.Key))).ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
UnitInfo = new InfoLoader<UnitInfo>(
|
||||
Pair.New<string,Func<string,UnitInfo>>( "Building", s => new UnitInfo.BuildingInfo(s)),
|
||||
Pair.New<string,Func<string,UnitInfo>>( "Infantry", s => new UnitInfo.InfantryInfo(s)),
|
||||
Pair.New<string,Func<string,UnitInfo>>( "Vehicle", s => new UnitInfo.VehicleInfo(s)),
|
||||
Pair.New<string,Func<string,UnitInfo>>( "Ship", s => new UnitInfo.VehicleInfo(s)),
|
||||
Pair.New<string,Func<string,UnitInfo>>( "Plane", s => new UnitInfo.VehicleInfo(s)));
|
||||
Pair.New<string, Func<string, UnitInfo>>("Building", s => new UnitInfo.BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Defense", s => new UnitInfo.BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Infantry", s => new UnitInfo.InfantryInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Vehicle", s => new UnitInfo.VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Ship", s => new UnitInfo.VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Plane", s => new UnitInfo.VehicleInfo(s)));
|
||||
|
||||
LoadCategories(
|
||||
"Weapon",
|
||||
"Warhead",
|
||||
"Projectile" );
|
||||
"Projectile");
|
||||
|
||||
WeaponInfo = new InfoLoader<WeaponInfo>(
|
||||
Pair.New<string,Func<string,WeaponInfo>>("Weapon", _ => new WeaponInfo()));
|
||||
Pair.New<string, Func<string, WeaponInfo>>("Weapon", _ => new WeaponInfo()));
|
||||
WarheadInfo = new InfoLoader<WarheadInfo>(
|
||||
Pair.New<string,Func<string,WarheadInfo>>("Warhead", _ => new WarheadInfo()));
|
||||
Pair.New<string, Func<string, WarheadInfo>>("Warhead", _ => new WarheadInfo()));
|
||||
|
||||
ProjectileInfo = new InfoLoader<ProjectileInfo>(
|
||||
Pair.New<string, Func<string, ProjectileInfo>>("Projectile", _ => new ProjectileInfo()));
|
||||
@@ -61,10 +63,10 @@ namespace OpenRa.Game
|
||||
TechTree = new TechTree();
|
||||
}
|
||||
|
||||
static void LoadCategories( params string[] types )
|
||||
static void LoadCategories(params string[] types)
|
||||
{
|
||||
foreach( var t in types )
|
||||
Categories[ t ] = AllRules.GetSection( t + "Types" ).Select( x => x.Key.ToLowerInvariant() ).ToList();
|
||||
foreach (var t in types)
|
||||
Categories[t] = AllRules.GetSection(t + "Types").Select(x => x.Key.ToLowerInvariant()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user