This commit is contained in:
Matthias Mailänder
2014-06-16 10:22:10 +02:00
parent 88480e0dc2
commit 83e33b99e8

View File

@@ -96,9 +96,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
void SetupFilters() void SetupFilters()
{ {
//
// Game type // Game type
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_GAMETYPE_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_GAMETYPE_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -120,8 +118,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => filter.Type == option.First, () => filter.Type == option.First,
() => { filter.Type = option.First; ApplyFilter(); } () => { filter.Type = option.First; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option.Second; item.Get<LabelWidget>("LABEL").GetText = () => option.Second;
return item; return item;
}; };
@@ -131,9 +128,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Date type // Date type
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_DATE_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_DATE_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -157,8 +152,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => filter.Date == option.First, () => filter.Date == option.First,
() => { filter.Date = option.First; ApplyFilter(); } () => { filter.Date = option.First; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option.Second; item.Get<LabelWidget>("LABEL").GetText = () => option.Second;
return item; return item;
}; };
@@ -168,9 +163,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Duration // Duration
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_DURATION_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_DURATION_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -194,8 +187,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => filter.Duration == option.First, () => filter.Duration == option.First,
() => { filter.Duration = option.First; ApplyFilter(); } () => { filter.Duration = option.First; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option.Second; item.Get<LabelWidget>("LABEL").GetText = () => option.Second;
return item; return item;
}; };
@@ -205,9 +197,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Map // Map
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_MAPNAME_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_MAPNAME_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -225,8 +215,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => string.Compare(filter.MapName, option, true) == 0, () => string.Compare(filter.MapName, option, true) == 0,
() => { filter.MapName = option; ApplyFilter(); } () => { filter.MapName = option; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText; item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
return item; return item;
}; };
@@ -236,9 +225,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Players // Players
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_PLAYER_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_PLAYER_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -256,8 +243,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => string.Compare(filter.PlayerName, option, true) == 0, () => string.Compare(filter.PlayerName, option, true) == 0,
() => { filter.PlayerName = option; ApplyFilter(); } () => { filter.PlayerName = option; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText; item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
return item; return item;
}; };
@@ -267,9 +253,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Outcome (depends on Player) // Outcome (depends on Player)
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_OUTCOME_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_OUTCOME_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -293,8 +277,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => filter.Outcome == option.First, () => filter.Outcome == option.First,
() => { filter.Outcome = option.First; ApplyFilter(); } () => { filter.Outcome = option.First; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option.Second; item.Get<LabelWidget>("LABEL").GetText = () => option.Second;
return item; return item;
}; };
@@ -304,9 +287,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Faction (depends on Player) // Faction (depends on Player)
//
{ {
var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_FACTION_DROPDOWNBUTTON"); var ddb = panel.GetOrNull<DropDownButtonWidget>("FLT_FACTION_DROPDOWNBUTTON");
if (ddb != null) if (ddb != null)
@@ -326,8 +307,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var item = ScrollItemWidget.Setup( var item = ScrollItemWidget.Setup(
tpl, tpl,
() => string.Compare(filter.Faction, option, true) == 0, () => string.Compare(filter.Faction, option, true) == 0,
() => { filter.Faction = option; ApplyFilter(); } () => { filter.Faction = option; ApplyFilter(); });
);
item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText; item.Get<LabelWidget>("LABEL").GetText = () => option ?? anyText;
return item; return item;
}; };
@@ -337,9 +317,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
//
// Reset button // Reset button
//
{ {
var button = panel.Get<ButtonWidget>("FLT_RESET_BUTTON"); var button = panel.Get<ButtonWidget>("FLT_RESET_BUTTON");
button.IsDisabled = () => filter.IsEmpty; button.IsDisabled = () => filter.IsEmpty;
@@ -508,6 +486,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
t = TimeSpan.FromDays(30d); t = TimeSpan.FromDays(30d);
break; break;
} }
if (replay.GameInfo.StartTimeUtc < DateTime.UtcNow - t) if (replay.GameInfo.StartTimeUtc < DateTime.UtcNow - t)
return false; return false;
} }
@@ -610,7 +589,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var group = kv.Key; var group = kv.Key;
if (group.Length > 0) if (group.Length > 0)
{ {
var header = ScrollItemWidget.Setup(playerHeader, () => true, () => {}); var header = ScrollItemWidget.Setup(playerHeader, () => true, () => { });
header.Get<LabelWidget>("LABEL").GetText = () => group; header.Get<LabelWidget>("LABEL").GetText = () => group;
playerList.AddChild(header); playerList.AddChild(header);
} }
@@ -700,12 +679,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
} }
enum GameType enum GameType
{ {
Any, Any,
Singleplayer, Singleplayer,
Multiplayer Multiplayer
} }
enum DateType enum DateType
{ {
Any, Any,
@@ -714,6 +695,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
LastFortnight, LastFortnight,
LastMonth LastMonth
} }
enum DurationType enum DurationType
{ {
Any, Any,