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