Quick-fix for "Invisible chrome" bug
This commit is contained in:
@@ -131,12 +131,15 @@ 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);
|
||||||
|
|
||||||
|
if (rootWidget == null)
|
||||||
|
{
|
||||||
rootWidget = WidgetLoader.LoadWidget( widgetYaml.FirstOrDefault() );
|
rootWidget = WidgetLoader.LoadWidget( widgetYaml.FirstOrDefault() );
|
||||||
rootWidget.Initialize();
|
rootWidget.Initialize();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Widget rootWidget;
|
public static Widget rootWidget = null;
|
||||||
public Widget selectedWidget;
|
public static Widget selectedWidget;
|
||||||
|
|
||||||
List<string> visibleTabs = new List<string>();
|
List<string> visibleTabs = new List<string>();
|
||||||
|
|
||||||
|
|||||||
@@ -93,31 +93,31 @@ namespace OpenRA.Graphics
|
|||||||
switch( Game.orderManager.Connection.ConnectionState )
|
switch( Game.orderManager.Connection.ConnectionState )
|
||||||
{
|
{
|
||||||
case ConnectionState.PreConnecting:
|
case ConnectionState.PreConnecting:
|
||||||
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
Chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
|
||||||
break;
|
break;
|
||||||
case ConnectionState.Connecting:
|
case ConnectionState.Connecting:
|
||||||
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = true;
|
Chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = true;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
|
||||||
|
|
||||||
//(Game.chrome.rootWidget.GetWidget("CONNECTION_GROUP_FAILED") as LabelWidget).Text = "Connecting abort";
|
//(Game.chrome.rootWidget.GetWidget("CONNECTION_GROUP_FAILED") as LabelWidget).Text = "Connecting abort";
|
||||||
|
|
||||||
//Game.chrome.DrawDialog("Connecting to {0}:{1}...".F( Game.Settings.NetworkHost, Game.Settings.NetworkPort ));
|
//Game.chrome.DrawDialog("Connecting to {0}:{1}...".F( Game.Settings.NetworkHost, Game.Settings.NetworkPort ));
|
||||||
break;
|
break;
|
||||||
case ConnectionState.NotConnected:
|
case ConnectionState.NotConnected:
|
||||||
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = true;
|
Chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = true;
|
||||||
|
|
||||||
//(Game.chrome.rootWidget.GetWidget("CONNECTION_GROUP_FAILED") as LabelWidget).Text = "Not Connected Retry/fail";
|
//(Game.chrome.rootWidget.GetWidget("CONNECTION_GROUP_FAILED") as LabelWidget).Text = "Not Connected Retry/fail";
|
||||||
//Game.chrome.DrawDialog("Connection failed.", "Retry", _ => {}, "Cancel",_ => {});
|
//Game.chrome.DrawDialog("Connection failed.", "Retry", _ => {}, "Cancel",_ => {});
|
||||||
break;
|
break;
|
||||||
case ConnectionState.Connected:
|
case ConnectionState.Connected:
|
||||||
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("CONNECTING_BG").Visible = false;
|
||||||
Game.chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
|
Chrome.rootWidget.GetWidget("CONNECTION_FAILED_BG").Visible = false;
|
||||||
//Game.chrome.DrawLobby( world );
|
//Game.chrome.DrawLobby( world );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -128,9 +128,9 @@ namespace OpenRA.Graphics
|
|||||||
Game.chrome.DrawLobby();
|
Game.chrome.DrawLobby();
|
||||||
|
|
||||||
lastConnectionState = state;
|
lastConnectionState = state;
|
||||||
Game.chrome.DrawWidgets(world);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Game.chrome.DrawWidgets(world);
|
||||||
|
|
||||||
var cursorName = Game.chrome.HitTest(mousePos) ? "default" : Game.controller.ChooseCursor( world );
|
var cursorName = Game.chrome.HitTest(mousePos) ? "default" : Game.controller.ChooseCursor( world );
|
||||||
var c = new Cursor(cursorName);
|
var c = new Cursor(cursorName);
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ namespace OpenRA.Widgets
|
|||||||
public int VisualHeight = 1;
|
public int VisualHeight = 1;
|
||||||
public override bool HandleInput(MouseInput mi)
|
public override bool HandleInput(MouseInput mi)
|
||||||
{
|
{
|
||||||
if (Game.chrome.selectedWidget == this)
|
if (Chrome.selectedWidget == this)
|
||||||
Depressed = (GetEventBounds().Contains(mi.Location.X,mi.Location.Y)) ? true : false;
|
Depressed = (GetEventBounds().Contains(mi.Location.X,mi.Location.Y)) ? true : false;
|
||||||
|
|
||||||
// Relinquish focus
|
// Relinquish focus
|
||||||
if (Game.chrome.selectedWidget == this && mi.Event == MouseInputEvent.Up)
|
if (Chrome.selectedWidget == this && mi.Event == MouseInputEvent.Up)
|
||||||
{
|
{
|
||||||
Game.chrome.selectedWidget = null;
|
Chrome.selectedWidget = null;
|
||||||
Depressed = false;
|
Depressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Widgets
|
|||||||
// We also want to play a click sound
|
// We also want to play a click sound
|
||||||
if (mi.Event == MouseInputEvent.Down)
|
if (mi.Event == MouseInputEvent.Down)
|
||||||
{
|
{
|
||||||
Game.chrome.selectedWidget = this;
|
Chrome.selectedWidget = this;
|
||||||
Depressed = true;
|
Depressed = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
public ConnectionDialogsDelegate()
|
public ConnectionDialogsDelegate()
|
||||||
{
|
{
|
||||||
var r = Game.chrome.rootWidget;
|
var r = Chrome.rootWidget;
|
||||||
r.GetWidget("CONNECTION_BUTTON_ABORT").OnMouseUp = mi => {
|
r.GetWidget("CONNECTION_BUTTON_ABORT").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
|
r.ShowMenu("MAINMENU_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
r.GetWidget("CONNECTION_BUTTON_CANCEL").OnMouseUp = mi => {
|
r.GetWidget("CONNECTION_BUTTON_CANCEL").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
|
r.ShowMenu("MAINMENU_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
r.GetWidget("CONNECTION_BUTTON_RETRY").OnMouseUp = mi => {
|
r.GetWidget("CONNECTION_BUTTON_RETRY").OnMouseUp = mi => {
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
public CreateServerMenuDelegate()
|
public CreateServerMenuDelegate()
|
||||||
{
|
{
|
||||||
var r = Game.chrome.rootWidget;
|
var r = Chrome.rootWidget;
|
||||||
r.GetWidget("MAINMENU_BUTTON_CREATE").OnMouseUp = mi => {
|
r.GetWidget("MAINMENU_BUTTON_CREATE").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("CREATESERVER_BG");
|
r.ShowMenu("CREATESERVER_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
r.GetWidget("CREATESERVER_BUTTON_CANCEL").OnMouseUp = mi => {
|
r.GetWidget("CREATESERVER_BUTTON_CANCEL").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
|
r.ShowMenu("MAINMENU_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
r.GetWidget("CREATESERVER_BUTTON_START").OnMouseUp = mi => {
|
r.GetWidget("CREATESERVER_BUTTON_START").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu(null);
|
r.ShowMenu(null);
|
||||||
Log.Write("Creating server");
|
Log.Write("Creating server");
|
||||||
|
|
||||||
// TODO: Get this from a map chooser
|
// TODO: Get this from a map chooser
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
public MainMenuButtonsDelegate()
|
public MainMenuButtonsDelegate()
|
||||||
{
|
{
|
||||||
Game.chrome.rootWidget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => {Game.Exit(); return true;};
|
Chrome.rootWidget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => {Game.Exit(); return true;};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
public ServerBrowserDelegate()
|
public ServerBrowserDelegate()
|
||||||
{
|
{
|
||||||
var r = Game.chrome.rootWidget;
|
var r = Chrome.rootWidget;
|
||||||
r.GetWidget("MAINMENU_BUTTON_JOIN").OnMouseUp =
|
r.GetWidget("MAINMENU_BUTTON_JOIN").OnMouseUp =
|
||||||
mi => {
|
mi => {
|
||||||
var bg = Game.chrome.rootWidget.ShowMenu("JOINSERVER_BG");
|
var bg = r.ShowMenu("JOINSERVER_BG");
|
||||||
int height = 50;
|
int height = 50;
|
||||||
int width = 300;
|
int width = 300;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
b.GetType().GetField("Delegate").SetValue(b, "ServerBrowserDelegate");
|
b.GetType().GetField("Delegate").SetValue(b, "ServerBrowserDelegate");
|
||||||
|
|
||||||
b.OnMouseUp = nmi => {
|
b.OnMouseUp = nmi => {
|
||||||
Game.chrome.rootWidget.GetWidget("JOINSERVER_BG").Visible = false;
|
r.GetWidget("JOINSERVER_BG").Visible = false;
|
||||||
Game.JoinServer(GameList[i].Address.Split(':')[0], int.Parse(GameList[i].Address.Split(':')[1]));
|
Game.JoinServer(GameList[i].Address.Split(':')[0], int.Parse(GameList[i].Address.Split(':')[1]));
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -74,7 +74,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
};
|
};
|
||||||
|
|
||||||
r.GetWidget("JOINSERVER_BUTTON_CANCEL").OnMouseUp = mi => {
|
r.GetWidget("JOINSERVER_BUTTON_CANCEL").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
|
r.ShowMenu("MAINMENU_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
public SettingsMenuDelegate()
|
public SettingsMenuDelegate()
|
||||||
{
|
{
|
||||||
var r = Game.chrome.rootWidget;
|
var r = Chrome.rootWidget;
|
||||||
|
|
||||||
// Checkboxes
|
// Checkboxes
|
||||||
r.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_UNITDEBUG").Checked = () => {return Game.Settings.UnitDebug;};
|
r.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_UNITDEBUG").Checked = () => {return Game.Settings.UnitDebug;};
|
||||||
@@ -45,12 +45,12 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
// Menu Buttons
|
// Menu Buttons
|
||||||
r.GetWidget("MAINMENU_BUTTON_SETTINGS").OnMouseUp = mi => {
|
r.GetWidget("MAINMENU_BUTTON_SETTINGS").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("SETTINGS_BG");
|
r.ShowMenu("SETTINGS_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
r.GetWidget("SETTINGS_BUTTON_OK").OnMouseUp = mi => {
|
r.GetWidget("SETTINGS_BUTTON_OK").OnMouseUp = mi => {
|
||||||
Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
|
r.ShowMenu("MAINMENU_BG");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user