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 World world;
|
||||||
readonly ModData modData;
|
readonly ModData modData;
|
||||||
readonly Action<bool> hideMenu;
|
readonly Action<bool> hideMenu;
|
||||||
|
readonly Action closeMenu;
|
||||||
readonly IObjectivesPanel iop;
|
readonly IObjectivesPanel iop;
|
||||||
IngameInfoPanel activePanel;
|
IngameInfoPanel activePanel;
|
||||||
readonly bool hasError;
|
readonly bool hasError;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[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)>()
|
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.world = world;
|
||||||
this.modData = modData;
|
this.modData = modData;
|
||||||
this.hideMenu = hideMenu;
|
this.hideMenu = hideMenu;
|
||||||
|
this.closeMenu = closeMenu;
|
||||||
activePanel = initialPanel;
|
activePanel = initialPanel;
|
||||||
|
|
||||||
var visiblePanels = new List<IngameInfoPanel>();
|
var visiblePanels = new List<IngameInfoPanel>();
|
||||||
@@ -140,7 +142,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var panel = hasError ? "SCRIPT_ERROR_PANEL" : iop.PanelName;
|
var panel = hasError ? "SCRIPT_ERROR_PANEL" : iop.PanelName;
|
||||||
Game.LoadWidget(world, panel, objectivesPanelContainer, new WidgetArgs()
|
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";
|
const string VoteKickVoteCancel = "dialog-vote-kick.vote-cancel";
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[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 player = world.LocalPlayer;
|
||||||
var playerPanel = widget.Get<ScrollPanelWidget>("PLAYER_LIST");
|
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}"));
|
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
|
||||||
hideMenu(false);
|
hideMenu(false);
|
||||||
|
closeMenu();
|
||||||
},
|
},
|
||||||
confirmText: VoteKickVoteStart,
|
confirmText: VoteKickVoteStart,
|
||||||
onCancel: () => hideMenu(false));
|
onCancel: () => hideMenu(false));
|
||||||
@@ -178,6 +179,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
|
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
|
||||||
hideMenu(false);
|
hideMenu(false);
|
||||||
|
closeMenu();
|
||||||
},
|
},
|
||||||
confirmText: VoteKickVoteFor,
|
confirmText: VoteKickVoteFor,
|
||||||
onOther: () =>
|
onOther: () =>
|
||||||
@@ -185,6 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Ui.CloseWindow();
|
Ui.CloseWindow();
|
||||||
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {false}"));
|
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {false}"));
|
||||||
hideMenu(false);
|
hideMenu(false);
|
||||||
|
closeMenu();
|
||||||
},
|
},
|
||||||
otherText: VoteKickVoteAgainst,
|
otherText: VoteKickVoteAgainst,
|
||||||
onCancel: () => hideMenu(false),
|
onCancel: () => hideMenu(false),
|
||||||
|
|||||||
@@ -200,7 +200,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var gameInfoPanel = Game.LoadWidget(world, "GAME_INFO_PANEL", panelRoot, new WidgetArgs()
|
var gameInfoPanel = Game.LoadWidget(world, "GAME_INFO_PANEL", panelRoot, new WidgetArgs()
|
||||||
{
|
{
|
||||||
{ "initialPanel", initialPanel },
|
{ "initialPanel", initialPanel },
|
||||||
{ "hideMenu", requestHideMenu }
|
{ "hideMenu", requestHideMenu },
|
||||||
|
{ "closeMenu", CloseMenu },
|
||||||
});
|
});
|
||||||
|
|
||||||
gameInfoPanel.IsVisible = () => !hideMenu;
|
gameInfoPanel.IsVisible = () => !hideMenu;
|
||||||
|
|||||||
Reference in New Issue
Block a user