Move widget delegates into Mods.
This commit is contained in:
@@ -77,8 +77,9 @@ namespace OpenRA
|
|||||||
ConnectionStateChanged( orderManager );
|
ConnectionStateChanged( orderManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static int RenderFrame = 0;
|
public static int RenderFrame = 0;
|
||||||
internal static int LocalTick { get { return orderManager.LocalFrameNumber; } }
|
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
|
const int NetTickScale = 3; // 120ms net tick for 40ms local tick
|
||||||
|
|
||||||
public static event Action<OrderManager> ConnectionStateChanged = _ => { };
|
public static event Action<OrderManager> ConnectionStateChanged = _ => { };
|
||||||
|
|||||||
@@ -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">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -83,12 +83,6 @@
|
|||||||
<Compile Include="Traits\Player\PlayerResources.cs" />
|
<Compile Include="Traits\Player\PlayerResources.cs" />
|
||||||
<Compile Include="Traits\World\Shroud.cs" />
|
<Compile Include="Traits\World\Shroud.cs" />
|
||||||
<Compile Include="Widgets\ChatEntryWidget.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\MapPreviewWidget.cs" />
|
||||||
<Compile Include="Widgets\WidgetUtils.cs" />
|
<Compile Include="Widgets\WidgetUtils.cs" />
|
||||||
<Compile Include="Effects\DelayedAction.cs" />
|
<Compile Include="Effects\DelayedAction.cs" />
|
||||||
@@ -165,16 +159,12 @@
|
|||||||
<Compile Include="Widgets\BackgroundWidget.cs" />
|
<Compile Include="Widgets\BackgroundWidget.cs" />
|
||||||
<Compile Include="Widgets\LabelWidget.cs" />
|
<Compile Include="Widgets\LabelWidget.cs" />
|
||||||
<Compile Include="Widgets\CheckboxWidget.cs" />
|
<Compile Include="Widgets\CheckboxWidget.cs" />
|
||||||
<Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" />
|
|
||||||
<Compile Include="Widgets\PerfGraphWidget.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="Widgets\ColorBlockWidget.cs" />
|
||||||
<Compile Include="GameRules\MusicInfo.cs" />
|
<Compile Include="GameRules\MusicInfo.cs" />
|
||||||
<Compile Include="Widgets\ImageWidget.cs" />
|
<Compile Include="Widgets\ImageWidget.cs" />
|
||||||
<Compile Include="Widgets\TextFieldWidget.cs" />
|
<Compile Include="Widgets\TextFieldWidget.cs" />
|
||||||
<Compile Include="Widgets\ChatDisplayWidget.cs" />
|
<Compile Include="Widgets\ChatDisplayWidget.cs" />
|
||||||
<Compile Include="Widgets\Delegates\MapChooserDelegate.cs" />
|
|
||||||
<Compile Include="Widgets\ListBoxWidget.cs" />
|
<Compile Include="Widgets\ListBoxWidget.cs" />
|
||||||
<Compile Include="Widgets\SliderWidget.cs" />
|
<Compile Include="Widgets\SliderWidget.cs" />
|
||||||
<Compile Include="Widgets\TimerWidget.cs" />
|
<Compile Include="Widgets\TimerWidget.cs" />
|
||||||
@@ -186,7 +176,6 @@
|
|||||||
<Compile Include="Traits\RevealsShroud.cs" />
|
<Compile Include="Traits\RevealsShroud.cs" />
|
||||||
<Compile Include="Traits\Health.cs" />
|
<Compile Include="Traits\Health.cs" />
|
||||||
<Compile Include="Widgets\VqaPlayerWidget.cs" />
|
<Compile Include="Widgets\VqaPlayerWidget.cs" />
|
||||||
<Compile Include="Widgets\Delegates\VideoPlayerDelegate.cs" />
|
|
||||||
<Compile Include="GameRules\Settings.cs" />
|
<Compile Include="GameRules\Settings.cs" />
|
||||||
<Compile Include="Support\Arguments.cs" />
|
<Compile Include="Support\Arguments.cs" />
|
||||||
<Compile Include="Traits\ActorStance.cs" />
|
<Compile Include="Traits\ActorStance.cs" />
|
||||||
@@ -216,7 +205,6 @@
|
|||||||
<Compile Include="Traits\Activities\CancelableActivity.cs" />
|
<Compile Include="Traits\Activities\CancelableActivity.cs" />
|
||||||
<Compile Include="Traits\SharesCell.cs" />
|
<Compile Include="Traits\SharesCell.cs" />
|
||||||
<Compile Include="Widgets\PasswordFieldWidget.cs" />
|
<Compile Include="Widgets\PasswordFieldWidget.cs" />
|
||||||
<Compile Include="Widgets\Delegates\DeveloperModeDelegate.cs" />
|
|
||||||
<Compile Include="Widgets\ScrollingTextWidget.cs" />
|
<Compile Include="Widgets\ScrollingTextWidget.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -239,9 +227,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="OpenRA.ico" />
|
<Content Include="OpenRA.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="ServerTraits\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class BackgroundWidget : Widget
|
public class BackgroundWidget : Widget
|
||||||
{
|
{
|
||||||
public readonly string Background = "dialog";
|
public readonly string Background = "dialog";
|
||||||
|
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ContainerWidget : Widget {
|
public class ContainerWidget : Widget {
|
||||||
public ContainerWidget() : base() { }
|
public ContainerWidget() : base() { }
|
||||||
|
|
||||||
public ContainerWidget(Widget other) : base(other) { }
|
public ContainerWidget(Widget other) : base(other) { }
|
||||||
|
|||||||
@@ -312,6 +312,18 @@
|
|||||||
<Compile Include="ServerTraits\LobbyCommands.cs" />
|
<Compile Include="ServerTraits\LobbyCommands.cs" />
|
||||||
<Compile Include="Scripting\RASpecialPowers.cs" />
|
<Compile Include="Scripting\RASpecialPowers.cs" />
|
||||||
<Compile Include="PaletteFromCurrentTileset.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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class ConnectionDialogsDelegate : IWidgetDelegate
|
public class ConnectionDialogsDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class CreateServerMenuDelegate : IWidgetDelegate
|
public class CreateServerMenuDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@ using OpenRA;
|
|||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class DeveloperModeDelegate : IWidgetDelegate
|
public class DeveloperModeDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -13,8 +13,9 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class DiplomacyDelegate : IWidgetDelegate
|
public class DiplomacyDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -7,14 +7,13 @@
|
|||||||
* see LICENSE.
|
* see LICENSE.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
@@ -8,12 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Server;
|
|
||||||
using OpenRA.Network;
|
|
||||||
using System.Collections.Generic;
|
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
|
public class MainMenuButtonsDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -12,8 +12,9 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class MapChooserDelegate : IWidgetDelegate
|
public class MapChooserDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
using System.Linq;
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using System.Drawing;
|
|
||||||
using OpenRA.Support;
|
|
||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
@@ -10,9 +6,15 @@ using OpenRA.Support;
|
|||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see LICENSE.
|
* see LICENSE.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#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
|
public class MusicPlayerDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -9,8 +9,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class PerfDebugDelegate : IWidgetDelegate
|
public class PerfDebugDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
var perfText = perfRoot.GetWidget<LabelWidget>("TEXT");
|
var perfText = perfRoot.GetWidget<LabelWidget>("TEXT");
|
||||||
perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F(
|
perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F(
|
||||||
Game.RenderFrame,
|
Game.RenderFrame,
|
||||||
Game.orderManager.NetFrameNumber,
|
Game.NetFrameNumber,
|
||||||
PerfHistory.items["render"].LastValue,
|
PerfHistory.items["render"].LastValue,
|
||||||
PerfHistory.items["tick_time"].LastValue,
|
PerfHistory.items["tick_time"].LastValue,
|
||||||
Game.LocalTick,
|
Game.LocalTick,
|
||||||
@@ -13,8 +13,9 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Server;
|
using OpenRA.Server;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class ServerBrowserDelegate : IWidgetDelegate
|
public class ServerBrowserDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -9,11 +9,11 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
|
||||||
using OpenRA.FileFormats.Graphics;
|
using OpenRA.FileFormats.Graphics;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class SettingsMenuDelegate : IWidgetDelegate
|
public class SettingsMenuDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
@@ -111,10 +111,8 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var w = int.Parse(width.Text);
|
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);
|
Game.Settings.Graphics.WindowedSize = new int2(w, Game.Settings.Graphics.WindowedSize.Y);
|
||||||
else
|
|
||||||
width.Text = Game.Settings.Graphics.WindowedSize.X.ToString();
|
|
||||||
}
|
}
|
||||||
catch (FormatException) {
|
catch (FormatException) {
|
||||||
width.Text = Game.Settings.Graphics.WindowedSize.X.ToString();
|
width.Text = Game.Settings.Graphics.WindowedSize.X.ToString();
|
||||||
@@ -130,7 +128,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var h = int.Parse(height.Text);
|
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);
|
Game.Settings.Graphics.WindowedSize = new int2(Game.Settings.Graphics.WindowedSize.X, h);
|
||||||
else
|
else
|
||||||
height.Text = Game.Settings.Graphics.WindowedSize.Y.ToString();
|
height.Text = Game.Settings.Graphics.WindowedSize.Y.ToString();
|
||||||
@@ -9,9 +9,10 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||||
{
|
{
|
||||||
public class VideoPlayerDelegate : IWidgetDelegate
|
public class VideoPlayerDelegate : IWidgetDelegate
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user