diff --git a/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs b/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs index d37af5d5c3..723133ae6c 100644 --- a/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs @@ -19,10 +19,20 @@ namespace OpenRA.Widgets.Delegates string CurrentSong = null; public MusicPlayerDelegate() { - var bg = Widget.RootWidget.GetWidget("MUSIC_BG"); - //bg.Visible = Game.Settings.MusicPlayer; + var bg = Widget.RootWidget.GetWidget("MUSIC_MENU"); CurrentSong = GetNextSong(); + bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => { + Game.Settings.Save(); + Widget.RootWidget.CloseWindow(); + return true; + }; + + Widget.RootWidget.GetWidget("MAINMENU_BUTTON_MUSIC").OnMouseUp = mi => { + Widget.RootWidget.OpenWindow("MUSIC_MENU"); + return true; + }; + bg.GetWidget("BUTTON_PLAY").OnMouseUp = mi => { if (CurrentSong == null) @@ -64,9 +74,14 @@ namespace OpenRA.Widgets.Delegates return bg.GetWidget("BUTTON_PLAY").OnMouseUp(mi); }; - bg.GetWidget("TIME").GetText = () => "{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60, + bg.GetWidget("TIME").GetText = () => + { + if (CurrentSong == null) + return ""; + return "{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60, Rules.Music[CurrentSong].Length / 60, Rules.Music[CurrentSong].Length % 60); - + }; + var ml = bg.GetWidget("MUSIC_LIST"); var itemTemplate = ml.GetWidget("MUSIC_TEMPLATE"); int offset = itemTemplate.Bounds.Y; diff --git a/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs index 77d5c8bdcd..379bbbb607 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs @@ -29,30 +29,35 @@ namespace OpenRA.Mods.RA.Widgets.Delegates return true; }; - optionsBG.GetWidget("BUTTON_DISCONNECT").OnMouseUp = mi => { + optionsBG.GetWidget("DISCONNECT").OnMouseUp = mi => { optionsBG.Visible = false; Game.Disconnect(); return true; }; - optionsBG.GetWidget("BUTTON_SETTINGS").OnMouseUp = mi => { + optionsBG.GetWidget("SETTINGS").OnMouseUp = mi => { r.OpenWindow("SETTINGS_MENU"); return true; }; - optionsBG.GetWidget("BUTTON_RESUME").OnMouseUp = mi => + optionsBG.GetWidget("MUSIC").OnMouseUp = mi => { + r.OpenWindow("MUSIC_MENU"); + return true; + }; + + optionsBG.GetWidget("RESUME").OnMouseUp = mi => { optionsBG.Visible = false; return true; }; - optionsBG.GetWidget("BUTTON_SURRENDER").OnMouseUp = mi => + optionsBG.GetWidget("SURRENDER").OnMouseUp = mi => { Game.IssueOrder(new Order("Surrender", Game.world.LocalPlayer.PlayerActor)); return true; }; - optionsBG.GetWidget("BUTTON_QUIT").OnMouseUp = mi => { + optionsBG.GetWidget("QUIT").OnMouseUp = mi => { Game.Exit(); return true; }; diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 8684e15a54..09bc8de6b1 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -110,7 +110,7 @@ Container@INGAME_ROOT: X:(WINDOW_RIGHT - WIDTH)/2 Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:300 - Height:280 + Height:320 Visible:false Children: Label@LABEL_TITLE: @@ -122,44 +122,52 @@ Container@INGAME_ROOT: Text:Options Align:Center Bold:True - Button@BUTTON_RESUME: - Id:BUTTON_RESUME + Button@RESUME: + Id:RESUME X:(PARENT_RIGHT - WIDTH)/2 Y:60 Width:160 Height:25 Text:Resume Bold:True - Button@BUTTON_SURRENDER: - Id:BUTTON_SURRENDER + Button@SETTINGS: + Id:SETTINGS X:(PARENT_RIGHT - WIDTH)/2 Y:100 Width:160 Height:25 - Text:Surrender + Text:Settings Bold:True - Button@BUTTON_SETTINGS: - Id:BUTTON_SETTINGS + Button@MUSIC: + Id:MUSIC X:(PARENT_RIGHT - WIDTH)/2 Y:140 Width:160 Height:25 - Text:Settings - Bold:True - Button@BUTTON_DISCONNECT: - Id:BUTTON_DISCONNECT + Text:Music + Bold:True + Button@SURRENDER: + Id:SURRENDER X:(PARENT_RIGHT - WIDTH)/2 Y:180 Width:160 Height:25 - Text:Disconnect + Text:Surrender Bold:True - Button@BUTTON_QUIT: - Id:BUTTON_QUIT + Button@DISCONNECT: + Id:DISCONNECT X:(PARENT_RIGHT - WIDTH)/2 Y:220 Width:160 Height:25 + Text:Disconnect + Bold:True + Button@QUIT: + Id:QUIT + X:(PARENT_RIGHT - WIDTH)/2 + Y:260 + Width:160 + Height:25 Text:Quit Bold:True Background@DIPLOMACY_BG: diff --git a/mods/cnc/chrome/mainmenu.yaml b/mods/cnc/chrome/mainmenu.yaml index d3105fe812..a031c4fb69 100644 --- a/mods/cnc/chrome/mainmenu.yaml +++ b/mods/cnc/chrome/mainmenu.yaml @@ -3,7 +3,7 @@ Background@MAINMENU_BG: X:(WINDOW_RIGHT - WIDTH)/2 Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:250 - Height:250 + Height:290 Delegate:MainMenuButtonsDelegate Children: Label@MAINMENU_LABEL_TITLE: @@ -39,10 +39,18 @@ Background@MAINMENU_BG: Height:25 Text:Settings Bold:True + Button@MAINMENU_BUTTON_MUSIC: + Id:MAINMENU_BUTTON_MUSIC + X:45 + Y:190 + Width:160 + Height:25 + Text:Music + Bold:True Button@MAINMENU_BUTTON_QUIT: Id:MAINMENU_BUTTON_QUIT X:45 - Y:190 + Y:230 Width:160 Height:25 Text:Quit @@ -51,7 +59,7 @@ Background@MAINMENU_BG: Id:MAINMENU_BUTTON_VIDEOPLAYER Visible:false X:45 - Y:230 + Y:260 Width:160 Height:25 Text:Video Player @@ -87,4 +95,159 @@ Background@PERF_BG: X:20 Y:205 Width:170 - Height:40 \ No newline at end of file + Height:40 +Background@MUSIC_MENU: + Id:MUSIC_MENU + Delegate:MusicPlayerDelegate + X:(WINDOW_RIGHT - WIDTH)/2 + Y:(WINDOW_BOTTOM - HEIGHT)/2 + Width: 450 + Height: 250 + Visible: false + Children: + Label@SETTINGS_LABEL_TITLE: + Id:SETTINGS_LABEL_TITLE + X:0 + Y:20 + Width:450 + Height:25 + Text:Music + Align:Center + Bold:True + Button@BUTTON_CLOSE: + Id:BUTTON_CLOSE + X:PARENT_RIGHT - 180 + Y:PARENT_BOTTOM - 45 + Width:160 + Height:25 + Text:Close + Bold:True + Container@BUTTONS: + X:PARENT_RIGHT - 150 + Y:50 + Children: + Button@BUTTON_PLAY: + Id:BUTTON_PLAY + X:35 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_PLAY: + Id:IMAGE_PLAY + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:play + Button@BUTTON_PAUSE: + Id:BUTTON_PAUSE + Visible:false + X:35 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_PAUSE: + Id:IMAGE_PAUSE + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:pause + Button@BUTTON_STOP: + Id:BUTTON_STOP + X:70 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_STOP: + Id:IMAGE_STOP + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:stop + Button@BUTTON_NEXT: + Id:BUTTON_NEXT + X:105 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_NEXT: + Id:IMAGE_NEXT + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:next + Button@BUTTON_PREV: + Id:BUTTON_PREV + X:0 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_PREV: + Id:IMAGE_PREV + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:prev + Label@TIME: + Id:TIME + X:PARENT_RIGHT - 150 + Y:75 + Width:140 + Height:25 + Align: Center + ListBox@MUSIC_LIST: + Id:MUSIC_LIST + X:10 + Y:50 + Width:280 + Height:140 + Children: + Label@MUSIC_TEMPLATE: + Id:MUSIC_TEMPLATE + Width:PARENT_RIGHT-28 + Height:25 + ClickThrough:false + X:2 + Y:0 + Visible:false + Children: + Label@TITLE: + Id:TITLE + X:5 + Width:PARENT_RIGHT - 10 + Height:PARENT_BOTTOM + Align: Left + Label@LENGTH: + Id:LENGTH + X:5 + Width:PARENT_RIGHT - 10 + Height:PARENT_BOTTOM + Align: Right + Checkbox@SHUFFLE: + Id:SHUFFLE + X:PARENT_RIGHT - 150 + Y:110 + Width:100 + Height:20 + Text:Shuffle + Checkbox@REPEAT: + Id:REPEAT + X:PARENT_RIGHT - 150 + Y:140 + Width:100 + Height:20 + Text:Repeat \ No newline at end of file diff --git a/mods/ra/chrome/ingame.yaml b/mods/ra/chrome/ingame.yaml index 76964377ac..9f8f6ae9f3 100644 --- a/mods/ra/chrome/ingame.yaml +++ b/mods/ra/chrome/ingame.yaml @@ -119,7 +119,7 @@ Container@INGAME_ROOT: X:(WINDOW_RIGHT - WIDTH)/2 Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:300 - Height:280 + Height:320 Visible:false Children: Label@LABEL_TITLE: @@ -131,44 +131,52 @@ Container@INGAME_ROOT: Text:Options Align:Center Bold:True - Button@BUTTON_RESUME: - Id:BUTTON_RESUME + Button@RESUME: + Id:RESUME X:(PARENT_RIGHT - WIDTH)/2 Y:60 Width:160 Height:25 Text:Resume Bold:True - Button@BUTTON_SURRENDER: - Id:BUTTON_SURRENDER + Button@SETTINGS: + Id:SETTINGS X:(PARENT_RIGHT - WIDTH)/2 Y:100 Width:160 Height:25 - Text:Surrender + Text:Settings Bold:True - Button@BUTTON_SETTINGS: - Id:BUTTON_SETTINGS + Button@MUSIC: + Id:MUSIC X:(PARENT_RIGHT - WIDTH)/2 Y:140 Width:160 Height:25 - Text:Settings - Bold:True - Button@BUTTON_DISCONNECT: - Id:BUTTON_DISCONNECT + Text:Music + Bold:True + Button@SURRENDER: + Id:SURRENDER X:(PARENT_RIGHT - WIDTH)/2 Y:180 Width:160 Height:25 - Text:Disconnect + Text:Surrender Bold:True - Button@BUTTON_QUIT: - Id:BUTTON_QUIT + Button@DISCONNECT: + Id:DISCONNECT X:(PARENT_RIGHT - WIDTH)/2 Y:220 Width:160 Height:25 + Text:Disconnect + Bold:True + Button@QUIT: + Id:QUIT + X:(PARENT_RIGHT - WIDTH)/2 + Y:260 + Width:160 + Height:25 Text:Quit Bold:True Background@DIPLOMACY_BG: diff --git a/mods/ra/chrome/mainmenu.yaml b/mods/ra/chrome/mainmenu.yaml index 2dcc8865d5..a031c4fb69 100644 --- a/mods/ra/chrome/mainmenu.yaml +++ b/mods/ra/chrome/mainmenu.yaml @@ -3,7 +3,7 @@ Background@MAINMENU_BG: X:(WINDOW_RIGHT - WIDTH)/2 Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:250 - Height:250 + Height:290 Delegate:MainMenuButtonsDelegate Children: Label@MAINMENU_LABEL_TITLE: @@ -39,10 +39,18 @@ Background@MAINMENU_BG: Height:25 Text:Settings Bold:True + Button@MAINMENU_BUTTON_MUSIC: + Id:MAINMENU_BUTTON_MUSIC + X:45 + Y:190 + Width:160 + Height:25 + Text:Music + Bold:True Button@MAINMENU_BUTTON_QUIT: Id:MAINMENU_BUTTON_QUIT X:45 - Y:190 + Y:230 Width:160 Height:25 Text:Quit @@ -51,7 +59,7 @@ Background@MAINMENU_BG: Id:MAINMENU_BUTTON_VIDEOPLAYER Visible:false X:45 - Y:230 + Y:260 Width:160 Height:25 Text:Video Player @@ -88,104 +96,125 @@ Background@PERF_BG: Y:205 Width:170 Height:40 -Background@MUSIC_BG: - Id:MUSIC_BG +Background@MUSIC_MENU: + Id:MUSIC_MENU Delegate:MusicPlayerDelegate - X:WINDOW_RIGHT - WIDTH - 20 - Y:WINDOW_BOTTOM - HEIGHT - 20 - Width: 300 - Height: 210 + X:(WINDOW_RIGHT - WIDTH)/2 + Y:(WINDOW_BOTTOM - HEIGHT)/2 + Width: 450 + Height: 250 Visible: false Children: - Button@BUTTON_PLAY: - Id:BUTTON_PLAY - X:50 - Y:15 - Width:25 + Label@SETTINGS_LABEL_TITLE: + Id:SETTINGS_LABEL_TITLE + X:0 + Y:20 + Width:450 Height:25 + Text:Music + Align:Center + Bold:True + Button@BUTTON_CLOSE: + Id:BUTTON_CLOSE + X:PARENT_RIGHT - 180 + Y:PARENT_BOTTOM - 45 + Width:160 + Height:25 + Text:Close + Bold:True + Container@BUTTONS: + X:PARENT_RIGHT - 150 + Y:50 Children: - Image@IMAGE_PLAY: - Id:IMAGE_PLAY + Button@BUTTON_PLAY: + Id:BUTTON_PLAY + X:35 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_PLAY: + Id:IMAGE_PLAY + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:play + Button@BUTTON_PAUSE: + Id:BUTTON_PAUSE + Visible:false + X:35 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_PAUSE: + Id:IMAGE_PAUSE + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:pause + Button@BUTTON_STOP: + Id:BUTTON_STOP + X:70 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_STOP: + Id:IMAGE_STOP + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:stop + Button@BUTTON_NEXT: + Id:BUTTON_NEXT + X:105 + Y:0 + Width:25 + Height:25 + Children: + Image@IMAGE_NEXT: + Id:IMAGE_NEXT + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:next + Button@BUTTON_PREV: + Id:BUTTON_PREV X:0 Y:0 Width:25 Height:25 - ImageCollection:music - ImageName:play - Button@BUTTON_PAUSE: - Id:BUTTON_PAUSE - Visible:false - X:50 - Y:15 - Width:25 - Height:25 - Children: - Image@IMAGE_PAUSE: - Id:IMAGE_PAUSE - X:0 - Y:0 - Width:25 - Height:25 - ImageCollection:music - ImageName:pause - Button@BUTTON_STOP: - Id:BUTTON_STOP - X:85 - Y:15 - Width:25 - Height:25 - Children: - Image@IMAGE_STOP: - Id:IMAGE_STOP - X:0 - Y:0 - Width:25 - Height:25 - ImageCollection:music - ImageName:stop - Button@BUTTON_NEXT: - Id:BUTTON_NEXT - X:120 - Y:15 - Width:25 - Height:25 - Children: - Image@IMAGE_NEXT: - Id:IMAGE_NEXT - X:0 - Y:0 - Width:25 - Height:25 - ImageCollection:music - ImageName:next - Button@BUTTON_PREV: - Id:BUTTON_PREV - X:15 - Y:15 - Width:25 - Height:25 - Children: - Image@IMAGE_PREV: - Id:IMAGE_PREV - X:0 - Y:0 - Width:25 - Height:25 - ImageCollection:music - ImageName:prev + Children: + Image@IMAGE_PREV: + Id:IMAGE_PREV + X:0 + Y:0 + Width:25 + Height:25 + ImageCollection:music + ImageName:prev Label@TIME: Id:TIME - X:PARENT_RIGHT - WIDTH - 20 - Y:15 - Width:100 + X:PARENT_RIGHT - 150 + Y:75 + Width:140 Height:25 - Align: Right + Align: Center ListBox@MUSIC_LIST: Id:MUSIC_LIST X:10 Y:50 Width:280 - Height:120 + Height:140 Children: Label@MUSIC_TEMPLATE: Id:MUSIC_TEMPLATE @@ -210,15 +239,15 @@ Background@MUSIC_BG: Align: Right Checkbox@SHUFFLE: Id:SHUFFLE - X:15 - Y:175 + X:PARENT_RIGHT - 150 + Y:110 Width:100 Height:20 Text:Shuffle Checkbox@REPEAT: Id:REPEAT - X:120 - Y:175 + X:PARENT_RIGHT - 150 + Y:140 Width:100 Height:20 Text:Repeat \ No newline at end of file