Skip to content

Commit

Permalink
Replaced Widget visibility by Yoga implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
IceReaper committed May 19, 2020
1 parent 1e13ec3 commit 9c541ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions OpenRA.Game/Widgets/Widget.cs
Expand Up @@ -45,7 +45,7 @@ public static void CloseWindow()
if (WindowList.Count > 0)
{
var restore = WindowList.Peek();
Root.AddChild(restore);
restore.Visible = true;

if (restore.LogicObjects != null)
foreach (var l in restore.LogicObjects)
Expand All @@ -62,7 +62,7 @@ public static Widget OpenWindow(string id, WidgetArgs args)
{
var window = Game.ModData.WidgetLoader.LoadWidget(args, Root, id);
if (WindowList.Count > 0)
Root.RemoveChild(WindowList.Peek());
WindowList.Peek().Visible = false;
WindowList.Push(window);
return window;
}
Expand Down Expand Up @@ -183,7 +183,7 @@ public abstract class Widget
public string Height = "0";
public string[] Logic = { };
public ChromeLogic[] LogicObjects { get; private set; }
public bool Visible = true;
public bool Visible { get { return Node.Display == YogaDisplay.Flex; } set { Node.Display = value ? YogaDisplay.Flex : YogaDisplay.None; } }
public bool IgnoreMouseOver;
public bool IgnoreChildMouseOver;

Expand All @@ -200,7 +200,6 @@ public Widget(Widget widget)
Width = widget.Width;
Height = widget.Height;
Logic = widget.Logic;
Visible = widget.Visible;

Node.CopyStyle(widget.Node);
Node.CalculateLayout();
Expand Down
10 changes: 5 additions & 5 deletions OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs
Expand Up @@ -438,7 +438,7 @@ void OpenMissionBrowserPanel()
Game.OpenWindow("MISSIONBROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => SwitchMenu(MenuType.Singleplayer) },
{ "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Missions; } }
{ "onStart", () => { lastGameState = MenuPanel.Missions; } }
});
}

Expand All @@ -448,7 +448,7 @@ void OpenSkirmishLobbyPanel()
Game.OpenWindow("SERVER_LOBBY", new WidgetArgs
{
{ "onExit", () => { Game.Disconnect(); SwitchMenu(MenuType.Singleplayer); } },
{ "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Skirmish; } },
{ "onStart", () => { lastGameState = MenuPanel.Skirmish; } },
{ "skirmishMode", true }
});
}
Expand All @@ -458,7 +458,7 @@ void OpenMultiplayerPanel()
SwitchMenu(MenuType.None);
Ui.OpenWindow("MULTIPLAYER_PANEL", new WidgetArgs
{
{ "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Multiplayer; } },
{ "onStart", () => { lastGameState = MenuPanel.Multiplayer; } },
{ "onExit", () => SwitchMenu(MenuType.Main) },
{ "directConnectEndPoint", null },
});
Expand All @@ -470,7 +470,7 @@ void OpenReplayBrowserPanel()
Ui.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => SwitchMenu(MenuType.Extras) },
{ "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Replays; } }
{ "onStart", () => { lastGameState = MenuPanel.Replays; } }
});
}

Expand All @@ -480,7 +480,7 @@ void OpenGameSaveBrowserPanel()
Ui.OpenWindow("GAMESAVE_BROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => SwitchMenu(MenuType.Singleplayer) },
{ "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.GameSaves; } },
{ "onStart", () => { lastGameState = MenuPanel.GameSaves; } },
{ "isSavePanel", false },
{ "world", null }
});
Expand Down

0 comments on commit 9c541ee

Please sign in to comment.