Move widget delegates into Mods.

This commit is contained in:
Paul Chote
2010-11-26 10:30:40 +13:00
parent 4ea04f461a
commit 58a92de5a1
17 changed files with 53 additions and 48 deletions

View File

@@ -77,8 +77,9 @@ namespace OpenRA
ConnectionStateChanged( orderManager );
}
internal static int RenderFrame = 0;
internal static int LocalTick { get { return orderManager.LocalFrameNumber; } }
public static int RenderFrame = 0;
public static int NetFrameNumber { get { return orderManager.NetFrameNumber; } }
public static int LocalTick { get { return orderManager.LocalFrameNumber; } }
const int NetTickScale = 3; // 120ms net tick for 40ms local tick
public static event Action<OrderManager> ConnectionStateChanged = _ => { };

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -83,12 +83,6 @@
<Compile Include="Traits\Player\PlayerResources.cs" />
<Compile Include="Traits\World\Shroud.cs" />
<Compile Include="Widgets\ChatEntryWidget.cs" />
<Compile Include="Widgets\Delegates\ConnectionDialogsDelegate.cs" />
<Compile Include="Widgets\Delegates\CreateServerMenuDelegate.cs" />
<Compile Include="Widgets\Delegates\DiplomacyDelegate.cs" />
<Compile Include="Widgets\Delegates\MainMenuButtonsDelegate.cs" />
<Compile Include="Widgets\Delegates\ServerBrowserDelegate.cs" />
<Compile Include="Widgets\Delegates\SettingsMenuDelegate.cs" />
<Compile Include="Widgets\MapPreviewWidget.cs" />
<Compile Include="Widgets\WidgetUtils.cs" />
<Compile Include="Effects\DelayedAction.cs" />
@@ -165,16 +159,12 @@
<Compile Include="Widgets\BackgroundWidget.cs" />
<Compile Include="Widgets\LabelWidget.cs" />
<Compile Include="Widgets\CheckboxWidget.cs" />
<Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" />
<Compile Include="Widgets\PerfGraphWidget.cs" />
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
<Compile Include="Widgets\Delegates\LobbyDelegate.cs" />
<Compile Include="Widgets\ColorBlockWidget.cs" />
<Compile Include="GameRules\MusicInfo.cs" />
<Compile Include="Widgets\ImageWidget.cs" />
<Compile Include="Widgets\TextFieldWidget.cs" />
<Compile Include="Widgets\ChatDisplayWidget.cs" />
<Compile Include="Widgets\Delegates\MapChooserDelegate.cs" />
<Compile Include="Widgets\ListBoxWidget.cs" />
<Compile Include="Widgets\SliderWidget.cs" />
<Compile Include="Widgets\TimerWidget.cs" />
@@ -186,7 +176,6 @@
<Compile Include="Traits\RevealsShroud.cs" />
<Compile Include="Traits\Health.cs" />
<Compile Include="Widgets\VqaPlayerWidget.cs" />
<Compile Include="Widgets\Delegates\VideoPlayerDelegate.cs" />
<Compile Include="GameRules\Settings.cs" />
<Compile Include="Support\Arguments.cs" />
<Compile Include="Traits\ActorStance.cs" />
@@ -216,7 +205,6 @@
<Compile Include="Traits\Activities\CancelableActivity.cs" />
<Compile Include="Traits\SharesCell.cs" />
<Compile Include="Widgets\PasswordFieldWidget.cs" />
<Compile Include="Widgets\Delegates\DeveloperModeDelegate.cs" />
<Compile Include="Widgets\ScrollingTextWidget.cs" />
</ItemGroup>
<ItemGroup>
@@ -239,9 +227,6 @@
<ItemGroup>
<Content Include="OpenRA.ico" />
</ItemGroup>
<ItemGroup>
<Folder Include="ServerTraits\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -12,7 +12,7 @@ using OpenRA.Graphics;
namespace OpenRA.Widgets
{
class BackgroundWidget : Widget
public class BackgroundWidget : Widget
{
public readonly string Background = "dialog";

View File

@@ -345,7 +345,7 @@ namespace OpenRA.Widgets
}
}
class ContainerWidget : Widget {
public class ContainerWidget : Widget {
public ContainerWidget() : base() { }
public ContainerWidget(Widget other) : base(other) { }

View File

@@ -312,6 +312,18 @@
<Compile Include="ServerTraits\LobbyCommands.cs" />
<Compile Include="Scripting\RASpecialPowers.cs" />
<Compile Include="PaletteFromCurrentTileset.cs" />
<Compile Include="Widgets\Delegates\ConnectionDialogsDelegate.cs" />
<Compile Include="Widgets\Delegates\CreateServerMenuDelegate.cs" />
<Compile Include="Widgets\Delegates\DeveloperModeDelegate.cs" />
<Compile Include="Widgets\Delegates\DiplomacyDelegate.cs" />
<Compile Include="Widgets\Delegates\LobbyDelegate.cs" />
<Compile Include="Widgets\Delegates\MainMenuButtonsDelegate.cs" />
<Compile Include="Widgets\Delegates\MapChooserDelegate.cs" />
<Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" />
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
<Compile Include="Widgets\Delegates\ServerBrowserDelegate.cs" />
<Compile Include="Widgets\Delegates\SettingsMenuDelegate.cs" />
<Compile Include="Widgets\Delegates\VideoPlayerDelegate.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -9,8 +9,9 @@
#endregion
using OpenRA.Network;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class ConnectionDialogsDelegate : IWidgetDelegate
{

View File

@@ -10,8 +10,9 @@
using System.Linq;
using System.Net;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class CreateServerMenuDelegate : IWidgetDelegate
{

View File

@@ -23,7 +23,7 @@ using OpenRA;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class DeveloperModeDelegate : IWidgetDelegate
{

View File

@@ -13,8 +13,9 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class DiplomacyDelegate : IWidgetDelegate
{

View File

@@ -7,14 +7,13 @@
* see LICENSE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Network;
using OpenRA.Graphics;
using System;
namespace OpenRA.Widgets.Delegates
{

View File

@@ -8,12 +8,13 @@
*/
#endregion
using OpenRA.FileFormats;
using OpenRA.Server;
using OpenRA.Network;
using System.Collections.Generic;
using OpenRA.FileFormats;
using OpenRA.Network;
using OpenRA.Server;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class MainMenuButtonsDelegate : IWidgetDelegate
{

View File

@@ -12,8 +12,9 @@ using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Network;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class MapChooserDelegate : IWidgetDelegate
{

View File

@@ -1,7 +1,3 @@
using System.Linq;
using OpenRA.FileFormats;
using System.Drawing;
using OpenRA.Support;
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
@@ -12,7 +8,13 @@ using OpenRA.Support;
*/
#endregion
namespace OpenRA.Widgets.Delegates
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Support;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class MusicPlayerDelegate : IWidgetDelegate
{

View File

@@ -9,8 +9,9 @@
#endregion
using OpenRA.Support;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class PerfDebugDelegate : IWidgetDelegate
{
@@ -24,7 +25,7 @@ namespace OpenRA.Widgets.Delegates
var perfText = perfRoot.GetWidget<LabelWidget>("TEXT");
perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F(
Game.RenderFrame,
Game.orderManager.NetFrameNumber,
Game.NetFrameNumber,
PerfHistory.items["render"].LastValue,
PerfHistory.items["tick_time"].LastValue,
Game.LocalTick,

View File

@@ -13,8 +13,9 @@ using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Server;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class ServerBrowserDelegate : IWidgetDelegate
{

View File

@@ -9,11 +9,11 @@
#endregion
using System;
using System.Windows.Forms;
using OpenRA.FileFormats.Graphics;
using OpenRA.GameRules;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class SettingsMenuDelegate : IWidgetDelegate
{
@@ -111,10 +111,8 @@ namespace OpenRA.Widgets.Delegates
{
try {
var w = int.Parse(width.Text);
if (w > Game.Settings.Graphics.MinResolution.X && w <= Screen.PrimaryScreen.Bounds.Size.Width)
if (w > Game.Settings.Graphics.MinResolution.X)
Game.Settings.Graphics.WindowedSize = new int2(w, Game.Settings.Graphics.WindowedSize.Y);
else
width.Text = Game.Settings.Graphics.WindowedSize.X.ToString();
}
catch (FormatException) {
width.Text = Game.Settings.Graphics.WindowedSize.X.ToString();
@@ -130,7 +128,7 @@ namespace OpenRA.Widgets.Delegates
{
try {
var h = int.Parse(height.Text);
if (h > Game.Settings.Graphics.MinResolution.Y && h <= Screen.PrimaryScreen.Bounds.Size.Height)
if (h > Game.Settings.Graphics.MinResolution.Y)
Game.Settings.Graphics.WindowedSize = new int2(Game.Settings.Graphics.WindowedSize.X, h);
else
height.Text = Game.Settings.Graphics.WindowedSize.Y.ToString();

View File

@@ -10,8 +10,9 @@
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.Widgets;
namespace OpenRA.Widgets.Delegates
namespace OpenRA.Mods.RA.Widgets.Delegates
{
public class VideoPlayerDelegate : IWidgetDelegate
{