Close the ingame menu upon voting
(cherry picked from commit d5c940ba4c)
This commit is contained in:
@@ -40,12 +40,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly World world;
|
||||
readonly ModData modData;
|
||||
readonly Action<bool> hideMenu;
|
||||
readonly Action closeMenu;
|
||||
readonly IObjectivesPanel iop;
|
||||
IngameInfoPanel activePanel;
|
||||
readonly bool hasError;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public GameInfoLogic(Widget widget, ModData modData, World world, IngameInfoPanel initialPanel, Action<bool> hideMenu)
|
||||
public GameInfoLogic(Widget widget, ModData modData, World world, IngameInfoPanel initialPanel, Action<bool> hideMenu, Action closeMenu)
|
||||
{
|
||||
var panels = new Dictionary<IngameInfoPanel, (string Panel, string Label, Action<ButtonWidget, Widget> Setup)>()
|
||||
{
|
||||
@@ -59,6 +60,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
this.world = world;
|
||||
this.modData = modData;
|
||||
this.hideMenu = hideMenu;
|
||||
this.closeMenu = closeMenu;
|
||||
activePanel = initialPanel;
|
||||
|
||||
var visiblePanels = new List<IngameInfoPanel>();
|
||||
@@ -140,7 +142,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var panel = hasError ? "SCRIPT_ERROR_PANEL" : iop.PanelName;
|
||||
Game.LoadWidget(world, panel, objectivesPanelContainer, new WidgetArgs()
|
||||
{
|
||||
{ "hideMenu", hideMenu }
|
||||
{ "hideMenu", hideMenu },
|
||||
{ "closeMenu", closeMenu },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
const string VoteKickVoteCancel = "dialog-vote-kick.vote-cancel";
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public GameInfoStatsLogic(Widget widget, ModData modData, World world, OrderManager orderManager, WorldRenderer worldRenderer, Action<bool> hideMenu)
|
||||
public GameInfoStatsLogic(Widget widget, ModData modData, World world, OrderManager orderManager, WorldRenderer worldRenderer, Action<bool> hideMenu, Action closeMenu)
|
||||
{
|
||||
var player = world.LocalPlayer;
|
||||
var playerPanel = widget.Get<ScrollPanelWidget>("PLAYER_LIST");
|
||||
@@ -163,6 +163,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
|
||||
hideMenu(false);
|
||||
closeMenu();
|
||||
},
|
||||
confirmText: VoteKickVoteStart,
|
||||
onCancel: () => hideMenu(false));
|
||||
@@ -178,6 +179,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
|
||||
hideMenu(false);
|
||||
closeMenu();
|
||||
},
|
||||
confirmText: VoteKickVoteFor,
|
||||
onOther: () =>
|
||||
@@ -185,6 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Ui.CloseWindow();
|
||||
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {false}"));
|
||||
hideMenu(false);
|
||||
closeMenu();
|
||||
},
|
||||
otherText: VoteKickVoteAgainst,
|
||||
onCancel: () => hideMenu(false),
|
||||
|
||||
@@ -200,7 +200,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var gameInfoPanel = Game.LoadWidget(world, "GAME_INFO_PANEL", panelRoot, new WidgetArgs()
|
||||
{
|
||||
{ "initialPanel", initialPanel },
|
||||
{ "hideMenu", requestHideMenu }
|
||||
{ "hideMenu", requestHideMenu },
|
||||
{ "closeMenu", CloseMenu },
|
||||
});
|
||||
|
||||
gameInfoPanel.IsVisible = () => !hideMenu;
|
||||
|
||||
Reference in New Issue
Block a user