Add music player to lobby.

This commit is contained in:
Paul Chote
2015-10-04 17:29:13 +01:00
parent 72ea009042
commit 73adfe0bfc
15 changed files with 725 additions and 390 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly Ruleset modRules;
readonly World shellmapWorld;
enum PanelType { Players, Options, Kick, ForceStart }
enum PanelType { Players, Options, Music, Kick, ForceStart }
PanelType panel = PanelType.Players;
readonly Widget lobby;
@@ -276,10 +276,27 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var optionsBin = Ui.LoadWidget("LOBBY_OPTIONS_BIN", lobby.Get("TOP_PANELS_ROOT"), new WidgetArgs());
optionsBin.IsVisible = () => panel == PanelType.Options;
var optionsButton = lobby.Get<ButtonWidget>("OPTIONS_BUTTON");
optionsButton.IsDisabled = () => Map.RuleStatus != MapRuleStatus.Cached || panel == PanelType.Kick || panel == PanelType.ForceStart;
optionsButton.GetText = () => panel == PanelType.Options ? "Players" : "Options";
optionsButton.OnClick = () => panel = (panel == PanelType.Options) ? PanelType.Players : PanelType.Options;
var musicBin = Ui.LoadWidget("LOBBY_MUSIC_BIN", lobby.Get("TOP_PANELS_ROOT"), new WidgetArgs
{
{ "onExit", DoNothing },
{ "world", worldRenderer.World }
});
musicBin.IsVisible = () => panel == PanelType.Music;
var optionsTab = lobby.Get<ButtonWidget>("OPTIONS_TAB");
optionsTab.IsHighlighted = () => panel == PanelType.Options;
optionsTab.IsDisabled = () => Map.RuleStatus != MapRuleStatus.Cached || panel == PanelType.Kick || panel == PanelType.ForceStart;
optionsTab.OnClick = () => panel = PanelType.Options;
var playersTab = lobby.Get<ButtonWidget>("PLAYERS_TAB");
playersTab.IsHighlighted = () => panel == PanelType.Players;
playersTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
playersTab.OnClick = () => panel = PanelType.Players;
var musicTab = lobby.GetOrNull<ButtonWidget>("MUSIC_TAB");
musicTab.IsHighlighted = () => panel == PanelType.Music;
musicTab.IsDisabled = () => panel == PanelType.Kick || panel == PanelType.ForceStart;
musicTab.OnClick = () => panel = PanelType.Music;
// Force start panel
Action startGame = () =>
@@ -584,14 +601,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
chatTemplate = chatPanel.Get("CHAT_TEMPLATE");
chatPanel.RemoveChildren();
var musicButton = lobby.GetOrNull<ButtonWidget>("MUSIC_BUTTON");
if (musicButton != null)
musicButton.OnClick = () => Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs
{
{ "onExit", DoNothing },
{ "world", worldRenderer.World }
});
var settingsButton = lobby.GetOrNull<ButtonWidget>("SETTINGS_BUTTON");
if (settingsButton != null)
{