Remove the now-redundant CncWidgetUtils.cs
This commit is contained in:
@@ -87,7 +87,6 @@
|
|||||||
<Compile Include="RenderGunboat.cs" />
|
<Compile Include="RenderGunboat.cs" />
|
||||||
<Compile Include="SpawnViceroid.cs" />
|
<Compile Include="SpawnViceroid.cs" />
|
||||||
<Compile Include="TiberiumRefinery.cs" />
|
<Compile Include="TiberiumRefinery.cs" />
|
||||||
<Compile Include="Widgets\CncWidgetUtils.cs" />
|
|
||||||
<Compile Include="Widgets\Logic\CncConquestObjectivesLogic.cs" />
|
<Compile Include="Widgets\Logic\CncConquestObjectivesLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncIngameChromeLogic.cs" />
|
<Compile Include="Widgets\Logic\CncIngameChromeLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncIngameMenuLogic.cs" />
|
<Compile Include="Widgets\Logic\CncIngameMenuLogic.cs" />
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation. For more information,
|
|
||||||
* see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Widgets
|
|
||||||
{
|
|
||||||
public static class CncWidgetUtils
|
|
||||||
{
|
|
||||||
public static void PromptConfirmAction(string title, string text, Action onConfirm, Action onCancel)
|
|
||||||
{
|
|
||||||
var prompt = Ui.OpenWindow("CONFIRM_PROMPT");
|
|
||||||
prompt.Get<LabelWidget>("PROMPT_TITLE").GetText = () => title;
|
|
||||||
prompt.Get<LabelWidget>("PROMPT_TEXT").GetText = () => text;
|
|
||||||
|
|
||||||
prompt.Get<ButtonWidget>("CONFIRM_BUTTON").OnClick = () =>
|
|
||||||
{
|
|
||||||
Ui.CloseWindow();
|
|
||||||
onConfirm();
|
|
||||||
};
|
|
||||||
|
|
||||||
prompt.Get<ButtonWidget>("CANCEL_BUTTON").OnClick = () =>
|
|
||||||
{
|
|
||||||
Ui.CloseWindow();
|
|
||||||
onCancel();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,6 +12,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.RA;
|
using OpenRA.Mods.RA;
|
||||||
|
using OpenRA.Mods.RA.Widgets;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
@@ -53,13 +54,13 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
Action doNothing = () => { };
|
Action doNothing = () => { };
|
||||||
|
|
||||||
menu.Get<ButtonWidget>("QUIT_BUTTON").OnClick = () =>
|
menu.Get<ButtonWidget>("QUIT_BUTTON").OnClick = () =>
|
||||||
CncWidgetUtils.PromptConfirmAction("Abort Mission", "Leave this game and return to the menu?", onQuit, doNothing);
|
ConfirmationDialogs.PromptConfirmAction("Abort Mission", "Leave this game and return to the menu?", onQuit, doNothing);
|
||||||
|
|
||||||
Action onSurrender = () => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
Action onSurrender = () => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
||||||
var surrenderButton = menu.Get<ButtonWidget>("SURRENDER_BUTTON");
|
var surrenderButton = menu.Get<ButtonWidget>("SURRENDER_BUTTON");
|
||||||
surrenderButton.IsDisabled = () => (world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined);
|
surrenderButton.IsDisabled = () => (world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined);
|
||||||
surrenderButton.OnClick = () =>
|
surrenderButton.OnClick = () =>
|
||||||
CncWidgetUtils.PromptConfirmAction("Surrender", "Are you sure you want to surrender?", onSurrender, doNothing);
|
ConfirmationDialogs.PromptConfirmAction("Surrender", "Are you sure you want to surrender?", onSurrender, doNothing);
|
||||||
|
|
||||||
menu.Get<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
|
menu.Get<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user