Add a Credits menu. Fixes #2864.
This commit is contained in:
@@ -82,6 +82,15 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
});
|
||||
};
|
||||
|
||||
settingsMenu.Get<ButtonWidget>("CREDITS_BUTTON").OnClick = () =>
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Ui.OpenWindow("CREDITS_PANEL", new WidgetArgs()
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Settings },
|
||||
});
|
||||
};
|
||||
|
||||
settingsMenu.Get<ButtonWidget>("SETTINGS_BUTTON").OnClick = () =>
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
<Compile Include="Render\WithVoxelBody.cs" />
|
||||
<Compile Include="Render\WithVoxelBarrel.cs" />
|
||||
<Compile Include="Render\WithVoxelWalkerBody.cs" />
|
||||
<Compile Include="Widgets\Logic\CreditsLogic.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
@@ -501,4 +502,4 @@ cd "$(SolutionDir)thirdparty/"
|
||||
copy "FuzzyLogicLibrary.dll" "$(SolutionDir)"
|
||||
cd "$(SolutionDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
46
OpenRA.Mods.RA/Widgets/Logic/CreditsLogic.cs
Normal file
46
OpenRA.Mods.RA/Widgets/Logic/CreditsLogic.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
public class CreditsLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public CreditsLogic(Widget widget, Action onExit)
|
||||
{
|
||||
var panel = widget.Get("CREDITS_PANEL");
|
||||
|
||||
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
|
||||
{
|
||||
Ui.CloseWindow();
|
||||
onExit();
|
||||
};
|
||||
|
||||
var scrollPanel = panel.Get<ScrollPanelWidget>("CREDITS_DISPLAY");
|
||||
var template = scrollPanel.Get<LabelWidget>("CREDITS_TEMPLATE");
|
||||
scrollPanel.RemoveChildren();
|
||||
|
||||
var lines = FileSystem.Open("AUTHORS").ReadAllLines();
|
||||
foreach (var l in lines)
|
||||
{
|
||||
// Improve the formatting
|
||||
var line = l.Replace("\t", " ").Replace("*", "\u2022");
|
||||
var label = template.Clone() as LabelWidget;
|
||||
label.GetText = () => line;
|
||||
scrollPanel.AddChild(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
});
|
||||
};
|
||||
|
||||
widget.Get<ButtonWidget>("MAINMENU_BUTTON_CREDITS").OnClick = () =>
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
Ui.OpenWindow("CREDITS_PANEL", new WidgetArgs()
|
||||
{
|
||||
{ "onExit", () => Menu = MenuType.Main },
|
||||
});
|
||||
};
|
||||
|
||||
widget.Get<ButtonWidget>("MAINMENU_BUTTON_REPLAY_VIEWER").OnClick = () =>
|
||||
{
|
||||
Menu = MenuType.None;
|
||||
|
||||
36
mods/cnc/chrome/credits.yaml
Normal file
36
mods/cnc/chrome/credits.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
Container@CREDITS_PANEL:
|
||||
Logic:CreditsLogic
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - 400)/2
|
||||
Width:400
|
||||
Height:435
|
||||
Children:
|
||||
Label@CREDITS_TITLE:
|
||||
Width:PARENT_RIGHT
|
||||
Y:0-25
|
||||
Font:BigBold
|
||||
Contrast:true
|
||||
Align:Center
|
||||
Text:Credits
|
||||
Background@bg:
|
||||
Width:PARENT_RIGHT
|
||||
Height:400
|
||||
Background:panel-black
|
||||
Children:
|
||||
ScrollPanel@CREDITS_DISPLAY:
|
||||
X:15
|
||||
Y:15
|
||||
Width:PARENT_RIGHT - 30
|
||||
Height:PARENT_BOTTOM - 30
|
||||
Children:
|
||||
Label@CREDITS_TEMPLATE:
|
||||
X:8
|
||||
Height:16
|
||||
VAlign:Top
|
||||
Button@BACK_BUTTON:
|
||||
X:PARENT_RIGHT-140
|
||||
Y:400
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Back
|
||||
Key:escape
|
||||
@@ -157,6 +157,12 @@ Container@MENU_BACKGROUND:
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Settings
|
||||
Button@CREDITS_BUTTON:
|
||||
X:450
|
||||
Y:0
|
||||
Width:140
|
||||
Height:35
|
||||
Text:Credits
|
||||
Button@BACK_BUTTON:
|
||||
Key:escape
|
||||
X:600
|
||||
|
||||
@@ -77,6 +77,7 @@ ChromeLayout:
|
||||
mods/cnc/chrome/music.yaml
|
||||
mods/cnc/chrome/modchooser.yaml
|
||||
mods/cnc/chrome/settings.yaml
|
||||
mods/cnc/chrome/credits.yaml
|
||||
mods/cnc/chrome/cheats.yaml
|
||||
mods/cnc/chrome/dialogs.yaml
|
||||
mods/cnc/chrome/objectives.yaml
|
||||
|
||||
@@ -2,7 +2,7 @@ Background@MAINMENU:
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||
Width:250
|
||||
Height:460
|
||||
Height:500
|
||||
Visible:true
|
||||
Logic:MainMenuButtonsLogic
|
||||
Children:
|
||||
@@ -63,16 +63,23 @@ Background@MAINMENU:
|
||||
Height:25
|
||||
Text:Replay Viewer
|
||||
Font:Bold
|
||||
Button@MAINMENU_BUTTON_ASSET_BROWSER:
|
||||
Button@MAINMENU_BUTTON_CREDITS:
|
||||
X:45
|
||||
Y:350
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Credits
|
||||
Font:Bold
|
||||
Button@MAINMENU_BUTTON_ASSET_BROWSER:
|
||||
X:45
|
||||
Y:390
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Asset Browser
|
||||
Font:Bold
|
||||
Button@MAINMENU_BUTTON_QUIT:
|
||||
X:45
|
||||
Y:390
|
||||
Y:430
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Quit
|
||||
|
||||
@@ -56,6 +56,7 @@ ChromeLayout:
|
||||
mods/ra/chrome/ingame-observerstats.yaml
|
||||
mods/d2k/chrome/mainmenu.yaml
|
||||
mods/ra/chrome/settings.yaml
|
||||
mods/ra/chrome/credits.yaml
|
||||
mods/d2k/chrome/lobby.yaml
|
||||
mods/d2k/chrome/color-picker.yaml
|
||||
mods/ra/chrome/map-chooser.yaml
|
||||
|
||||
33
mods/ra/chrome/credits.yaml
Normal file
33
mods/ra/chrome/credits.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
Background@CREDITS_PANEL:
|
||||
Logic:CreditsLogic
|
||||
X:(WINDOW_RIGHT - WIDTH)/2
|
||||
Y:(WINDOW_BOTTOM - 400)/2
|
||||
Width:400
|
||||
Height:450
|
||||
Children:
|
||||
Label@CREDITS_TITLE:
|
||||
Width:PARENT_RIGHT
|
||||
Y:20
|
||||
Height:25
|
||||
Font:Bold
|
||||
Align:Center
|
||||
Text:Credits
|
||||
ScrollPanel@CREDITS_DISPLAY:
|
||||
X:15
|
||||
Y:50
|
||||
Width:PARENT_RIGHT - 30
|
||||
Height:345
|
||||
Children:
|
||||
Label@CREDITS_TEMPLATE:
|
||||
X:8
|
||||
Height:16
|
||||
VAlign:Top
|
||||
Button@BACK_BUTTON:
|
||||
X:PARENT_RIGHT - 180
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Close
|
||||
Font:Bold
|
||||
Key:escape
|
||||
|
||||
@@ -23,7 +23,7 @@ Container@MAINMENU:
|
||||
X:(WINDOW_RIGHT - WIDTH)/8
|
||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||
Width:250
|
||||
Height:555
|
||||
Height:605
|
||||
Logic:MainMenuButtonsLogic
|
||||
Children:
|
||||
Label@MAINMENU_LABEL_TITLE:
|
||||
@@ -83,16 +83,23 @@ Container@MAINMENU:
|
||||
Height:35
|
||||
Text:Replay Viewer
|
||||
Font:Bold
|
||||
Button@MAINMENU_BUTTON_ASSET_BROWSER:
|
||||
Button@MAINMENU_BUTTON_CREDITS:
|
||||
X:45
|
||||
Y:430
|
||||
Width:160
|
||||
Height:35
|
||||
Text:Credits
|
||||
Font:Bold
|
||||
Button@MAINMENU_BUTTON_ASSET_BROWSER:
|
||||
X:45
|
||||
Y:480
|
||||
Width:160
|
||||
Height:35
|
||||
Text:Asset Browser
|
||||
Font:Bold
|
||||
Button@MAINMENU_BUTTON_QUIT:
|
||||
X:45
|
||||
Y:480
|
||||
Y:530
|
||||
Width:160
|
||||
Height:35
|
||||
Text:Quit
|
||||
|
||||
@@ -68,6 +68,7 @@ ChromeLayout:
|
||||
mods/ra/chrome/ingame-observerstats.yaml
|
||||
mods/ra/chrome/mainmenu.yaml
|
||||
mods/ra/chrome/settings.yaml
|
||||
mods/ra/chrome/credits.yaml
|
||||
mods/ra/chrome/lobby.yaml
|
||||
mods/ra/chrome/color-picker.yaml
|
||||
mods/ra/chrome/map-chooser.yaml
|
||||
|
||||
Reference in New Issue
Block a user