Remove the now-redundant CncWidgetUtils.cs

This commit is contained in:
Paul Chote
2014-05-18 18:38:03 +12:00
parent 05eb56b1e2
commit b3313be217
3 changed files with 3 additions and 40 deletions

View File

@@ -87,7 +87,6 @@
<Compile Include="RenderGunboat.cs" />
<Compile Include="SpawnViceroid.cs" />
<Compile Include="TiberiumRefinery.cs" />
<Compile Include="Widgets\CncWidgetUtils.cs" />
<Compile Include="Widgets\Logic\CncConquestObjectivesLogic.cs" />
<Compile Include="Widgets\Logic\CncIngameChromeLogic.cs" />
<Compile Include="Widgets\Logic\CncIngameMenuLogic.cs" />

View File

@@ -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();
};
}
}
}

View File

@@ -12,6 +12,7 @@ using System;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Widgets;
using OpenRA.Traits;
using OpenRA.Widgets;
@@ -53,13 +54,13 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Action doNothing = () => { };
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));
var surrenderButton = menu.Get<ButtonWidget>("SURRENDER_BUTTON");
surrenderButton.IsDisabled = () => (world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined);
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 = () =>
{