moved rootWidget back to Chrome

This commit is contained in:
Chris Forbes
2010-03-16 19:58:34 +13:00
parent 6855732954
commit 3d77bcac69
3 changed files with 17 additions and 20 deletions

View File

@@ -131,10 +131,11 @@ namespace OpenRA
var widgetYaml = m.ChromeLayout.Select(a => MiniYaml.FromFile(a)).Aggregate(MiniYaml.Merge);
WidgetLoader.rootWidget = WidgetLoader.LoadWidget( widgetYaml.FirstOrDefault() );
WidgetLoader.rootWidget.Initialize();
rootWidget = WidgetLoader.LoadWidget( widgetYaml.FirstOrDefault() );
rootWidget.Initialize();
}
public Widget rootWidget;
List<string> visibleTabs = new List<string>();
public void Tick(World world)
@@ -421,10 +422,7 @@ namespace OpenRA
}
public void DrawMainMenu( World world )
{
WidgetLoader.rootWidget.Draw();
}
public void DrawMainMenu(World world) { rootWidget.Draw(); }
public void DrawLobby( World world )
{
@@ -1047,7 +1045,7 @@ namespace OpenRA
int2 lastMousePos;
public bool HandleInput(World world, MouseInput mi)
{
if (WidgetLoader.rootWidget.HandleInput(mi))
if (rootWidget.HandleInput(mi))
return true;
if (mi.Event == MouseInputEvent.Move)
@@ -1067,7 +1065,7 @@ namespace OpenRA
public bool HitTest(int2 mousePos)
{
return WidgetLoader.rootWidget.EventBounds.Contains(mousePos.X, mousePos.Y)
return rootWidget.EventBounds.Contains(mousePos.X, mousePos.Y)
|| buttons.Any(a => a.First.Contains(mousePos.ToPoint()));
}

View File

@@ -22,16 +22,16 @@ namespace OpenRA.Widgets.Delegates
if (w.Id == "MAINMENU_BUTTON_CREATE")
{
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
WidgetLoader.rootWidget.GetWidget("CREATESERVER_BG").Visible = true;
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
Game.chrome.rootWidget.GetWidget("CREATESERVER_BG").Visible = true;
return true;
}
// "Create Server" submenu
if (w.Id == "CREATESERVER_BUTTON_CANCEL")
{
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
WidgetLoader.rootWidget.GetWidget("CREATESERVER_BG").Visible = false;
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
Game.chrome.rootWidget.GetWidget("CREATESERVER_BG").Visible = false;
return true;
}
@@ -55,8 +55,8 @@ namespace OpenRA.Widgets.Delegates
// Main Menu root
if (w.Id == "MAINMENU_BUTTON_JOIN")
{
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
Widget bg = WidgetLoader.rootWidget.GetWidget("JOINSERVER_BG");
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
Widget bg = Game.chrome.rootWidget.GetWidget("JOINSERVER_BG");
bg.Visible = true;
int height = 50;
@@ -101,8 +101,8 @@ namespace OpenRA.Widgets.Delegates
if (w.Id == "JOINSERVER_BUTTON_CANCEL")
{
WidgetLoader.rootWidget.GetWidget("JOINSERVER_BG").Visible = false;
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
Game.chrome.rootWidget.GetWidget("JOINSERVER_BG").Visible = false;
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
return true;
}

View File

@@ -7,7 +7,6 @@ namespace OpenRA
{
class WidgetLoader
{
public static Widget rootWidget;
public static Widget LoadWidget(KeyValuePair<string, MiniYaml> node)
{
var widget = NewWidget(node.Key);