unhack hardcoded cnc menus
This commit is contained in:
@@ -63,6 +63,7 @@ namespace OpenRA.FileFormats
|
||||
public readonly string[] Sequences = { };
|
||||
public readonly string[] Chrome = { };
|
||||
public readonly string[] Assemblies = { };
|
||||
public readonly string[] ChromeLayout = { };
|
||||
|
||||
public Manifest(string[] mods)
|
||||
{
|
||||
@@ -77,6 +78,7 @@ namespace OpenRA.FileFormats
|
||||
Sequences = YamlList(yaml, "Sequences");
|
||||
Chrome = YamlList(yaml, "Chrome");
|
||||
Assemblies = YamlList(yaml, "Assemblies");
|
||||
ChromeLayout = YamlList(yaml, "ChromeLayout");
|
||||
}
|
||||
|
||||
static string[] YamlList(Dictionary<string, MiniYaml> ys, string key) { return ys[key].Nodes.Keys.ToArray(); }
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA
|
||||
Sprite mapChooserSprite;
|
||||
int mapOffset = 0;
|
||||
|
||||
public Chrome(Renderer r)
|
||||
public Chrome(Renderer r, Manifest m)
|
||||
{
|
||||
this.renderer = r;
|
||||
rgbaRenderer = new SpriteRenderer(renderer, true, renderer.RgbaSpriteShader);
|
||||
@@ -129,8 +129,8 @@ namespace OpenRA
|
||||
ready.PlayRepeating("ready");
|
||||
clock = new Animation("clock");
|
||||
|
||||
// TODO: make this generic
|
||||
var widgetYaml = MiniYaml.FromFile("mods/cnc/menus.yaml");
|
||||
var widgetYaml = m.ChromeLayout.Select(a => MiniYaml.FromFile(a)).Aggregate(MiniYaml.Merge);
|
||||
|
||||
// Hack around a bug in MiniYaml
|
||||
widgetYaml.Values.FirstOrDefault().Value = widgetYaml.Keys.FirstOrDefault();
|
||||
WidgetLoader.rootWidget = WidgetLoader.LoadWidget(widgetYaml.Values.FirstOrDefault());
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace OpenRA
|
||||
skipMakeAnims = false;
|
||||
Timer.Time( "map actors: {0}" );
|
||||
|
||||
chrome = new Chrome(renderer);
|
||||
chrome = new Chrome(renderer, manifest);
|
||||
Timer.Time( "chrome: {0}" );
|
||||
|
||||
Timer.Time( "----end ChangeMap" );
|
||||
|
||||
@@ -43,3 +43,6 @@ Chrome:
|
||||
Assemblies:
|
||||
mods/cnc/OpenRA.Mods.Cnc.dll: Cnc mod traits
|
||||
mods/ra/OpenRA.Mods.RA.dll: Red alert mod traits
|
||||
|
||||
ChromeLayout:
|
||||
mods/cnc/menus.yaml:
|
||||
118
mods/ra/menus.yaml
Normal file
118
mods/ra/menus.yaml
Normal file
@@ -0,0 +1,118 @@
|
||||
Container:
|
||||
Children:
|
||||
Background@MAINMENU_BG:
|
||||
Id:MAINMENU_BG
|
||||
X:WINDOW_RIGHT/2 - 125
|
||||
Y:WINDOW_BOTTOM/2 - 100
|
||||
Width:250
|
||||
Height:200
|
||||
Children:
|
||||
Label@MAINMENU_LABEL_TITLE:
|
||||
Id:MAINMENU_LABEL_TITLE
|
||||
X:0
|
||||
Y:20
|
||||
Width:250
|
||||
Height:25
|
||||
Text:OpenRA Main Menu
|
||||
Align:Center
|
||||
Button@MAINMENU_BUTTON_JOIN:
|
||||
Id:MAINMENU_BUTTON_JOIN
|
||||
X:45
|
||||
Y:70
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Join Game
|
||||
Delegate:ServerBrowserDelegate
|
||||
Button@MAINMENU_BUTTON_CREATE:
|
||||
Id:MAINMENU_BUTTON_CREATE
|
||||
X:45
|
||||
Y:110
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Create Game
|
||||
Delegate:MainMenuButtonsDelegate
|
||||
Button@MAINMENU_BUTTON_QUIT:
|
||||
Id:MAINMENU_BUTTON_QUIT
|
||||
X:45
|
||||
Y:150
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Quit
|
||||
Delegate:MainMenuButtonsDelegate
|
||||
Background@CREATESERVER_BG:
|
||||
Id:CREATESERVER_BG
|
||||
X:WINDOW_RIGHT/2 - 225
|
||||
Y:WINDOW_BOTTOM/2 - 72
|
||||
Width:450
|
||||
Height:145
|
||||
Visible:false
|
||||
Children:
|
||||
Label@CREATESERVER_LABEL_TITLE:
|
||||
Id:CREATESERVER_LABEL_TITLE
|
||||
X:0
|
||||
Y:20
|
||||
Width:250
|
||||
Height:25
|
||||
Text:Create Server
|
||||
Align:Center
|
||||
Button@CREATESERVER_CHECKBOX_HIDDEN:
|
||||
Id:CREATESERVER_CHECKBOX_HIDDEN
|
||||
X:100
|
||||
Y:60
|
||||
Width:20
|
||||
Height:20
|
||||
Label@CREATESERVER_LABEL_HIDDENGAME:
|
||||
Id:CREATESERVER_LABEL_HIDDENGAME
|
||||
X:135
|
||||
Y:60
|
||||
Width:300
|
||||
Height:25
|
||||
Text:Hide from Server Browser
|
||||
Button@CREATESERVER_BUTTON_CANCEL:
|
||||
Id:CREATESERVER_BUTTON_CANCEL
|
||||
X:100
|
||||
Y:100
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Cancel
|
||||
Delegate:MainMenuButtonsDelegate
|
||||
Button@CREATESERVER_BUTTON_START:
|
||||
Id:CREATESERVER_BUTTON_START
|
||||
X:270
|
||||
Y:100
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Create
|
||||
Delegate:MainMenuButtonsDelegate
|
||||
Background@JOINSERVER_BG:
|
||||
Id:JOINSERVER_BG
|
||||
X:WINDOW_RIGHT/2 - 225
|
||||
Y:WINDOW_BOTTOM/2 - 200
|
||||
Width:450
|
||||
Height:400
|
||||
Visible:false
|
||||
Children:
|
||||
Label@JOINSERVER_LABEL_TITLE:
|
||||
Id:JOINSERVER_LABEL_TITLE
|
||||
X:0
|
||||
Y:20
|
||||
Width:450
|
||||
Height:25
|
||||
Text:Quick'n'dirty Server Browser
|
||||
Align:Center
|
||||
Button@JOINSERVER_BUTTON_DIRECTCONNECT:
|
||||
Id:JOINSERVER_BUTTON_DIRECTCONNECT
|
||||
X:PARENT_RIGHT - 360
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Direct Connect
|
||||
Delegate:ServerBrowserDelegate
|
||||
Button@JOINSERVER_BUTTON_CANCEL:
|
||||
Id:JOINSERVER_BUTTON_CANCEL
|
||||
X:PARENT_RIGHT - 180
|
||||
Y:PARENT_BOTTOM - 45
|
||||
Width:160
|
||||
Height:25
|
||||
Text:Cancel
|
||||
Delegate:ServerBrowserDelegate
|
||||
@@ -35,3 +35,6 @@ Chrome:
|
||||
|
||||
Assemblies:
|
||||
mods/ra/OpenRA.Mods.RA.dll: Traits used
|
||||
|
||||
ChromeLayout:
|
||||
mods/ra/menus.yaml:
|
||||
Reference in New Issue
Block a user