moved rootWidget back to Chrome
This commit is contained in:
@@ -131,10 +131,11 @@ namespace OpenRA
|
|||||||
|
|
||||||
var widgetYaml = m.ChromeLayout.Select(a => MiniYaml.FromFile(a)).Aggregate(MiniYaml.Merge);
|
var widgetYaml = m.ChromeLayout.Select(a => MiniYaml.FromFile(a)).Aggregate(MiniYaml.Merge);
|
||||||
|
|
||||||
WidgetLoader.rootWidget = WidgetLoader.LoadWidget( widgetYaml.FirstOrDefault() );
|
rootWidget = WidgetLoader.LoadWidget( widgetYaml.FirstOrDefault() );
|
||||||
WidgetLoader.rootWidget.Initialize();
|
rootWidget.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Widget rootWidget;
|
||||||
List<string> visibleTabs = new List<string>();
|
List<string> visibleTabs = new List<string>();
|
||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
@@ -421,10 +422,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawMainMenu( World world )
|
public void DrawMainMenu(World world) { rootWidget.Draw(); }
|
||||||
{
|
|
||||||
WidgetLoader.rootWidget.Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DrawLobby( World world )
|
public void DrawLobby( World world )
|
||||||
{
|
{
|
||||||
@@ -1047,7 +1045,7 @@ namespace OpenRA
|
|||||||
int2 lastMousePos;
|
int2 lastMousePos;
|
||||||
public bool HandleInput(World world, MouseInput mi)
|
public bool HandleInput(World world, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (WidgetLoader.rootWidget.HandleInput(mi))
|
if (rootWidget.HandleInput(mi))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (mi.Event == MouseInputEvent.Move)
|
if (mi.Event == MouseInputEvent.Move)
|
||||||
@@ -1067,7 +1065,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public bool HitTest(int2 mousePos)
|
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()));
|
|| buttons.Any(a => a.First.Contains(mousePos.ToPoint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
if (w.Id == "MAINMENU_BUTTON_CREATE")
|
if (w.Id == "MAINMENU_BUTTON_CREATE")
|
||||||
{
|
{
|
||||||
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
||||||
WidgetLoader.rootWidget.GetWidget("CREATESERVER_BG").Visible = true;
|
Game.chrome.rootWidget.GetWidget("CREATESERVER_BG").Visible = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Create Server" submenu
|
// "Create Server" submenu
|
||||||
if (w.Id == "CREATESERVER_BUTTON_CANCEL")
|
if (w.Id == "CREATESERVER_BUTTON_CANCEL")
|
||||||
{
|
{
|
||||||
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
||||||
WidgetLoader.rootWidget.GetWidget("CREATESERVER_BG").Visible = false;
|
Game.chrome.rootWidget.GetWidget("CREATESERVER_BG").Visible = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,9 +54,9 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
// Main Menu root
|
// Main Menu root
|
||||||
if (w.Id == "MAINMENU_BUTTON_JOIN")
|
if (w.Id == "MAINMENU_BUTTON_JOIN")
|
||||||
{
|
{
|
||||||
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
||||||
Widget bg = WidgetLoader.rootWidget.GetWidget("JOINSERVER_BG");
|
Widget bg = Game.chrome.rootWidget.GetWidget("JOINSERVER_BG");
|
||||||
bg.Visible = true;
|
bg.Visible = true;
|
||||||
|
|
||||||
int height = 50;
|
int height = 50;
|
||||||
@@ -100,9 +100,9 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (w.Id == "JOINSERVER_BUTTON_CANCEL")
|
if (w.Id == "JOINSERVER_BUTTON_CANCEL")
|
||||||
{
|
{
|
||||||
WidgetLoader.rootWidget.GetWidget("JOINSERVER_BG").Visible = false;
|
Game.chrome.rootWidget.GetWidget("JOINSERVER_BG").Visible = false;
|
||||||
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
class WidgetLoader
|
class WidgetLoader
|
||||||
{
|
{
|
||||||
public static Widget rootWidget;
|
|
||||||
public static Widget LoadWidget(KeyValuePair<string, MiniYaml> node)
|
public static Widget LoadWidget(KeyValuePair<string, MiniYaml> node)
|
||||||
{
|
{
|
||||||
var widget = NewWidget(node.Key);
|
var widget = NewWidget(node.Key);
|
||||||
|
|||||||
Reference in New Issue
Block a user